Add statistics on the sync and save org ID with fieldseeker tables

We need the org ID so that we can avoid bleedover between different
organizations.
This commit is contained in:
Eli Ribble 2025-11-07 09:30:31 +00:00
parent bf6e40d877
commit b0432f3243
No known key found for this signature in database
178 changed files with 9075 additions and 6223 deletions

114
arcgis.go
View file

@ -239,6 +239,19 @@ func refreshFieldseekerData(ctx context.Context, newOauthCh <-chan struct{}) {
}()
}
orgs, err := models.Organizations.Query().All(ctx, PGInstance.BobDB)
if err != nil {
slog.Error("Failed to get orgs", slog.String("err", err.Error()))
return
}
for _, org := range orgs {
wg.Add(1)
go func() {
defer wg.Done()
periodicallyExportFieldseeker(workerCtx, org)
}()
}
select {
case <-ctx.Done():
slog.Info("Exiting refresh worker...")
@ -253,17 +266,17 @@ func refreshFieldseekerData(ctx context.Context, newOauthCh <-chan struct{}) {
}
}
func downloadAllRecords(ctx context.Context, fssync *fieldseeker.FieldSeeker, layer arcgis.LayerFeature) (int, int, error) {
func downloadAllRecords(ctx context.Context, fssync *fieldseeker.FieldSeeker, layer arcgis.LayerFeature, org_id int32) (int, int, int, error) {
inserts := 0
updates := 0
offset := 0
count, err := fssync.QueryCount(layer.ID)
if err != nil {
return inserts, updates, fmt.Errorf("Failed to get counts for layer %s (%d): %v", layer.Name, layer.ID, err)
return inserts, updates, 0, fmt.Errorf("Failed to get counts for layer %s (%d): %v", layer.Name, layer.ID, err)
}
slog.Info("Starting on layer", slog.String("name", layer.Name), slog.Int("id", layer.ID))
if count.Count == 0 {
return inserts, updates, nil
return inserts, updates, 0, nil
}
for {
if offset >= count.Count {
@ -279,22 +292,58 @@ func downloadAllRecords(ctx context.Context, fssync *fieldseeker.FieldSeeker, la
layer.ID,
query)
if err != nil {
return inserts, updates, fmt.Errorf("Failed to get layer %s (%d) at offset %d: %v", layer.Name, layer.ID, offset, err)
return inserts, updates, count.Count - inserts - updates, fmt.Errorf("Failed to get layer %s (%d) at offset %d: %v", layer.Name, layer.ID, offset, err)
}
i, u, err := saveOrUpdateDBRecords(ctx, "FS_"+layer.Name, qr)
i, u, err := saveOrUpdateDBRecords(ctx, "FS_"+layer.Name, qr, org_id)
if err != nil {
saveRawQuery(fssync, layer, query, "failure.json")
return inserts, updates, fmt.Errorf("Failed to save records: %v", err)
return inserts, updates, count.Count - inserts - updates, fmt.Errorf("Failed to save records: %v", err)
}
inserts += i
updates += u
offset += len(qr.Features)
}
slog.Info("Finished layer", slog.Int("inserts", inserts), slog.Int("updates", updates), slog.Int("no change", count.Count-inserts-updates))
return inserts, updates, nil
return inserts, updates, count.Count - inserts - updates, nil
}
func exportFieldseekerData(ctx context.Context, oauth *models.OauthToken) error {
func getOAuthForOrg(ctx context.Context, org *models.Organization) (*models.OauthToken, error) {
users, err := org.User().All(ctx, PGInstance.BobDB)
if err != nil {
return nil, fmt.Errorf("Failed to query all users for org: %v", err)
}
for _, user := range users {
oauths, err := user.UserOauthTokens().All(ctx, PGInstance.BobDB)
if err != nil {
return nil, fmt.Errorf("Failed to query all oauth tokens for org: %v", err)
}
for _, oauth := range oauths {
return oauth, nil
}
}
return nil, errors.New("No oauth tokens found")
}
func periodicallyExportFieldseeker(ctx context.Context, org *models.Organization) error {
pollTicker := time.NewTicker(1)
for {
select {
case <-ctx.Done():
return nil
case <-pollTicker.C:
oauth, err := getOAuthForOrg(ctx, org)
if err != nil {
return fmt.Errorf("Failed to get oauth for org: %v", err)
}
err = exportFieldseekerData(ctx, org, oauth)
if err != nil {
return fmt.Errorf("Failed to export Fieldseeker data: %v", err)
}
pollTicker = time.NewTicker(15 * time.Minute)
}
}
}
func exportFieldseekerData(ctx context.Context, org *models.Organization, oauth *models.OauthToken) error {
slog.Info("Update Fieldseeker data")
ar := arcgis.NewArcGIS(
arcgis.AuthenticatorOAuth{
@ -317,15 +366,25 @@ func exportFieldseekerData(ctx context.Context, oauth *models.OauthToken) error
}
inserts := 0
updates := 0
unchanged := 0
for _, layer := range fssync.FeatureServerLayers() {
i, u, err := downloadAllRecords(ctx, fssync, layer)
i, u, un, err := downloadAllRecords(ctx, fssync, layer, row.OrganizationID)
if err != nil {
return fmt.Errorf("Failed to get layer %s: %v", layer, err)
}
inserts += i
updates += u
unchanged += un
}
setter := models.FieldseekerSyncSetter{
RecordsCreated: omit.From(int32(inserts)),
RecordsUpdated: omit.From(int32(updates)),
RecordsUnchanged: omit.From(int32(unchanged)),
}
err = org.InsertFieldseekerSyncs(ctx, PGInstance.BobDB, &setter)
//err = user.InsertUserOauthTokens(ctx, PGInstance.BobDB, &setter)
return nil
}
@ -341,7 +400,6 @@ func maintainOAuth(ctx context.Context, oauth *models.OauthToken) {
refreshDelay = time.Until(oauth.AccessTokenExpires)
}
refreshTicker := time.NewTicker(refreshDelay)
pollTicker := time.NewTicker(1)
for {
select {
case <-ctx.Done():
@ -352,12 +410,6 @@ func maintainOAuth(ctx context.Context, oauth *models.OauthToken) {
slog.Error("Failed to refresh token", slog.String("err", err.Error()))
return
}
case <-pollTicker.C:
err := exportFieldseekerData(ctx, oauth)
if err != nil {
slog.Error("Failed to export Fieldseeker data", slog.String("err", err.Error()))
}
pollTicker = time.NewTicker(15 * time.Minute)
}
}
@ -501,7 +553,7 @@ func saveRawQuery(fssync *fieldseeker.FieldSeeker, layer arcgis.LayerFeature, qu
slog.Info("Wrote failed query", slog.String("filename", filename))
}
func saveOrUpdateDBRecords(ctx context.Context, table string, qr *arcgis.QueryResult) (int, int, error) {
func saveOrUpdateDBRecords(ctx context.Context, table string, qr *arcgis.QueryResult, org_id int32) (int, int, error) {
inserts, updates := 0, 0
sorted_columns := make([]string, 0, len(qr.Fields))
for _, f := range qr.Fields {
@ -527,12 +579,12 @@ func saveOrUpdateDBRecords(ctx context.Context, table string, qr *arcgis.QueryRe
// If we have no matching row we'll need to create it
if len(row) == 0 {
if err := insertRowFromFeature(ctx, table, sorted_columns, &feature); err != nil {
if err := insertRowFromFeature(ctx, table, sorted_columns, &feature, org_id); err != nil {
return inserts, updates, fmt.Errorf("Failed to insert row: %v", err)
}
inserts += 1
} else if hasUpdates(row, feature) {
if err := updateRowFromFeature(ctx, table, sorted_columns, &feature); err != nil {
if err := updateRowFromFeature(ctx, table, sorted_columns, &feature, org_id); err != nil {
return inserts, updates, fmt.Errorf("Failed to update row: %v", err)
}
updates += 1
@ -603,20 +655,20 @@ func rowmapViaQuery(ctx context.Context, table string, sorted_columns []string,
return result, nil
}
func insertRowFromFeature(ctx context.Context, table string, sorted_columns []string, feature *arcgis.Feature) error {
func insertRowFromFeature(ctx context.Context, table string, sorted_columns []string, feature *arcgis.Feature, org_id int32) error {
var options pgx.TxOptions
transaction, err := PGInstance.PGXPool.BeginTx(ctx, options)
if err != nil {
return fmt.Errorf("Unable to start transaction")
}
err = insertRowFromFeatureFS(ctx, transaction, table, sorted_columns, feature)
err = insertRowFromFeatureFS(ctx, transaction, table, sorted_columns, feature, org_id)
if err != nil {
transaction.Rollback(ctx)
return fmt.Errorf("Unable to insert FS: %v", err)
}
err = insertRowFromFeatureHistory(ctx, transaction, table, sorted_columns, feature, 1)
err = insertRowFromFeatureHistory(ctx, transaction, table, sorted_columns, feature, org_id, 1)
if err != nil {
transaction.Rollback(ctx)
return fmt.Errorf("Failed to insert history: %v", err)
@ -629,7 +681,7 @@ func insertRowFromFeature(ctx context.Context, table string, sorted_columns []st
return nil
}
func insertRowFromFeatureFS(ctx context.Context, transaction pgx.Tx, table string, sorted_columns []string, feature *arcgis.Feature) error {
func insertRowFromFeatureFS(ctx context.Context, transaction pgx.Tx, table string, sorted_columns []string, feature *arcgis.Feature, org_id int32) error {
// Create the query to produce the main row
var sb strings.Builder
sb.WriteString("INSERT INTO ")
@ -640,7 +692,7 @@ func insertRowFromFeatureFS(ctx context.Context, transaction pgx.Tx, table strin
sb.WriteString(",")
}
// Specially add the geometry values since they aren't in the fields
sb.WriteString("geometry_x,geometry_y,updated")
sb.WriteString("geometry_x,geometry_y,organization_id,updated")
sb.WriteString(")\nVALUES (")
for _, field := range sorted_columns {
sb.WriteString("@")
@ -648,7 +700,7 @@ func insertRowFromFeatureFS(ctx context.Context, transaction pgx.Tx, table strin
sb.WriteString(",")
}
// Specially add the geometry values since they aren't in the fields
sb.WriteString("@geometry_x,@geometry_y,@updated)")
sb.WriteString("@geometry_x,@geometry_y,@organization_id,@updated)")
args := pgx.NamedArgs{}
for k, v := range feature.Attributes {
@ -657,6 +709,7 @@ func insertRowFromFeatureFS(ctx context.Context, transaction pgx.Tx, table strin
// specially add geometry since it isn't in the list of attributes
args["geometry_x"] = feature.Geometry.X
args["geometry_y"] = feature.Geometry.Y
args["organization_id"] = org_id
args["updated"] = time.Now()
_, err := transaction.Exec(ctx, sb.String(), args)
@ -718,7 +771,7 @@ func hasUpdates(row map[string]string, feature arcgis.Feature) bool {
}
return false
}
func updateRowFromFeature(ctx context.Context, table string, sorted_columns []string, feature *arcgis.Feature) error {
func updateRowFromFeature(ctx context.Context, table string, sorted_columns []string, feature *arcgis.Feature, org_id int32) error {
// Get the current highest version for the row in question
history_table := toHistoryTable(table)
var sb strings.Builder
@ -741,7 +794,7 @@ func updateRowFromFeature(ctx context.Context, table string, sorted_columns []st
return fmt.Errorf("Unable to start transaction")
}
err = insertRowFromFeatureHistory(ctx, transaction, table, sorted_columns, feature, version+1)
err = insertRowFromFeatureHistory(ctx, transaction, table, sorted_columns, feature, org_id, version+1)
if err != nil {
transaction.Rollback(ctx)
return fmt.Errorf("Failed to insert history: %v", err)
@ -758,7 +811,7 @@ func updateRowFromFeature(ctx context.Context, table string, sorted_columns []st
}
return nil
}
func insertRowFromFeatureHistory(ctx context.Context, transaction pgx.Tx, table string, sorted_columns []string, feature *arcgis.Feature, version int) error {
func insertRowFromFeatureHistory(ctx context.Context, transaction pgx.Tx, table string, sorted_columns []string, feature *arcgis.Feature, org_id int32, version int) error {
history_table := toHistoryTable(table)
var sb strings.Builder
sb.WriteString("INSERT INTO ")
@ -769,7 +822,7 @@ func insertRowFromFeatureHistory(ctx context.Context, transaction pgx.Tx, table
sb.WriteString(",")
}
// Specially add the geometry values since they aren't in the fields
sb.WriteString("created,geometry_x,geometry_y,version")
sb.WriteString("created,geometry_x,geometry_y,organization_id,version")
sb.WriteString(")\nVALUES (")
for _, field := range sorted_columns {
sb.WriteString("@")
@ -777,12 +830,13 @@ func insertRowFromFeatureHistory(ctx context.Context, transaction pgx.Tx, table
sb.WriteString(",")
}
// Specially add the geometry values since they aren't in the fields
sb.WriteString("@created,@geometry_x,@geometry_y,@version)")
sb.WriteString("@created,@geometry_x,@geometry_y,@organization_id,@version)")
args := pgx.NamedArgs{}
for k, v := range feature.Attributes {
args[k] = v
}
args["created"] = time.Now()
args["organization_id"] = org_id
args["version"] = version
if _, err := transaction.Exec(ctx, sb.String(), args); err != nil {
return fmt.Errorf("Failed to insert history row into %s: %v", table, err)

View file

@ -0,0 +1,17 @@
// Code generated by BobGen psql v0.41.1. DO NOT EDIT.
// This file is meant to be re-generated in place and/or deleted at any time.
package dberrors
var FieldseekerSyncErrors = &fieldseekerSyncErrors{
ErrUniqueFieldseekerSyncPkey: &UniqueConstraintError{
schema: "",
table: "fieldseeker_sync",
columns: []string{"id"},
s: "fieldseeker_sync_pkey",
},
}
type fieldseekerSyncErrors struct {
ErrUniqueFieldseekerSyncPkey *UniqueConstraintError
}

View file

@ -0,0 +1,157 @@
// Code generated by BobGen psql v0.41.1. DO NOT EDIT.
// This file is meant to be re-generated in place and/or deleted at any time.
package dbinfo
import "github.com/aarondl/opt/null"
var FieldseekerSyncs = Table[
fieldseekerSyncColumns,
fieldseekerSyncIndexes,
fieldseekerSyncForeignKeys,
fieldseekerSyncUniques,
fieldseekerSyncChecks,
]{
Schema: "",
Name: "fieldseeker_sync",
Columns: fieldseekerSyncColumns{
ID: column{
Name: "id",
DBType: "integer",
Default: "nextval('fieldseeker_sync_id_seq'::regclass)",
Comment: "",
Nullable: false,
Generated: false,
AutoIncr: false,
},
Created: column{
Name: "created",
DBType: "timestamp without time zone",
Default: "CURRENT_TIMESTAMP",
Comment: "",
Nullable: false,
Generated: false,
AutoIncr: false,
},
RecordsCreated: column{
Name: "records_created",
DBType: "integer",
Default: "",
Comment: "",
Nullable: false,
Generated: false,
AutoIncr: false,
},
RecordsUpdated: column{
Name: "records_updated",
DBType: "integer",
Default: "",
Comment: "",
Nullable: false,
Generated: false,
AutoIncr: false,
},
RecordsUnchanged: column{
Name: "records_unchanged",
DBType: "integer",
Default: "",
Comment: "",
Nullable: false,
Generated: false,
AutoIncr: false,
},
OrganizationID: column{
Name: "organization_id",
DBType: "integer",
Default: "",
Comment: "",
Nullable: false,
Generated: false,
AutoIncr: false,
},
},
Indexes: fieldseekerSyncIndexes{
FieldseekerSyncPkey: index{
Type: "btree",
Name: "fieldseeker_sync_pkey",
Columns: []indexColumn{
{
Name: "id",
Desc: null.FromCond(false, true),
IsExpression: false,
},
},
Unique: true,
Comment: "",
NullsFirst: []bool{false},
NullsDistinct: false,
Where: "",
Include: []string{},
},
},
PrimaryKey: &constraint{
Name: "fieldseeker_sync_pkey",
Columns: []string{"id"},
Comment: "",
},
ForeignKeys: fieldseekerSyncForeignKeys{
FieldseekerSyncFieldseekerSyncOrganizationIDFkey: foreignKey{
constraint: constraint{
Name: "fieldseeker_sync.fieldseeker_sync_organization_id_fkey",
Columns: []string{"organization_id"},
Comment: "",
},
ForeignTable: "organization",
ForeignColumns: []string{"id"},
},
},
Comment: "",
}
type fieldseekerSyncColumns struct {
ID column
Created column
RecordsCreated column
RecordsUpdated column
RecordsUnchanged column
OrganizationID column
}
func (c fieldseekerSyncColumns) AsSlice() []column {
return []column{
c.ID, c.Created, c.RecordsCreated, c.RecordsUpdated, c.RecordsUnchanged, c.OrganizationID,
}
}
type fieldseekerSyncIndexes struct {
FieldseekerSyncPkey index
}
func (i fieldseekerSyncIndexes) AsSlice() []index {
return []index{
i.FieldseekerSyncPkey,
}
}
type fieldseekerSyncForeignKeys struct {
FieldseekerSyncFieldseekerSyncOrganizationIDFkey foreignKey
}
func (f fieldseekerSyncForeignKeys) AsSlice() []foreignKey {
return []foreignKey{
f.FieldseekerSyncFieldseekerSyncOrganizationIDFkey,
}
}
type fieldseekerSyncUniques struct{}
func (u fieldseekerSyncUniques) AsSlice() []constraint {
return []constraint{}
}
type fieldseekerSyncChecks struct{}
func (c fieldseekerSyncChecks) AsSlice() []check {
return []check{}
}

View file

@ -18,9 +18,9 @@ var FSContainerrelates = Table[
OrganizationID: column{
Name: "organization_id",
DBType: "integer",
Default: "NULL",
Default: "",
Comment: "",
Nullable: true,
Nullable: false,
Generated: false,
AutoIncr: false,
},

View file

@ -18,9 +18,9 @@ var FSFieldscoutinglogs = Table[
OrganizationID: column{
Name: "organization_id",
DBType: "integer",
Default: "NULL",
Default: "",
Comment: "",
Nullable: true,
Nullable: false,
Generated: false,
AutoIncr: false,
},

View file

@ -18,9 +18,9 @@ var FSHabitatrelates = Table[
OrganizationID: column{
Name: "organization_id",
DBType: "integer",
Default: "NULL",
Default: "",
Comment: "",
Nullable: true,
Nullable: false,
Generated: false,
AutoIncr: false,
},

View file

@ -18,9 +18,9 @@ var FSInspectionsamples = Table[
OrganizationID: column{
Name: "organization_id",
DBType: "integer",
Default: "NULL",
Default: "",
Comment: "",
Nullable: true,
Nullable: false,
Generated: false,
AutoIncr: false,
},

View file

@ -18,9 +18,9 @@ var FSInspectionsampledetails = Table[
OrganizationID: column{
Name: "organization_id",
DBType: "integer",
Default: "NULL",
Default: "",
Comment: "",
Nullable: true,
Nullable: false,
Generated: false,
AutoIncr: false,
},

View file

@ -18,9 +18,9 @@ var FSLinelocations = Table[
OrganizationID: column{
Name: "organization_id",
DBType: "integer",
Default: "NULL",
Default: "",
Comment: "",
Nullable: true,
Nullable: false,
Generated: false,
AutoIncr: false,
},

View file

@ -18,9 +18,9 @@ var FSLocationtrackings = Table[
OrganizationID: column{
Name: "organization_id",
DBType: "integer",
Default: "NULL",
Default: "",
Comment: "",
Nullable: true,
Nullable: false,
Generated: false,
AutoIncr: false,
},

View file

@ -18,9 +18,9 @@ var FSMosquitoinspections = Table[
OrganizationID: column{
Name: "organization_id",
DBType: "integer",
Default: "NULL",
Default: "",
Comment: "",
Nullable: true,
Nullable: false,
Generated: false,
AutoIncr: false,
},

View file

@ -18,9 +18,9 @@ var FSPointlocations = Table[
OrganizationID: column{
Name: "organization_id",
DBType: "integer",
Default: "NULL",
Default: "",
Comment: "",
Nullable: true,
Nullable: false,
Generated: false,
AutoIncr: false,
},

View file

@ -18,9 +18,9 @@ var FSPolygonlocations = Table[
OrganizationID: column{
Name: "organization_id",
DBType: "integer",
Default: "NULL",
Default: "",
Comment: "",
Nullable: true,
Nullable: false,
Generated: false,
AutoIncr: false,
},

View file

@ -18,9 +18,9 @@ var FSPools = Table[
OrganizationID: column{
Name: "organization_id",
DBType: "integer",
Default: "NULL",
Default: "",
Comment: "",
Nullable: true,
Nullable: false,
Generated: false,
AutoIncr: false,
},

View file

@ -18,9 +18,9 @@ var FSPooldetails = Table[
OrganizationID: column{
Name: "organization_id",
DBType: "integer",
Default: "NULL",
Default: "",
Comment: "",
Nullable: true,
Nullable: false,
Generated: false,
AutoIncr: false,
},

View file

@ -18,9 +18,9 @@ var FSProposedtreatmentareas = Table[
OrganizationID: column{
Name: "organization_id",
DBType: "integer",
Default: "NULL",
Default: "",
Comment: "",
Nullable: true,
Nullable: false,
Generated: false,
AutoIncr: false,
},

View file

@ -18,9 +18,9 @@ var FSQamosquitoinspections = Table[
OrganizationID: column{
Name: "organization_id",
DBType: "integer",
Default: "NULL",
Default: "",
Comment: "",
Nullable: true,
Nullable: false,
Generated: false,
AutoIncr: false,
},

View file

@ -18,9 +18,9 @@ var FSRodentlocations = Table[
OrganizationID: column{
Name: "organization_id",
DBType: "integer",
Default: "NULL",
Default: "",
Comment: "",
Nullable: true,
Nullable: false,
Generated: false,
AutoIncr: false,
},

View file

@ -18,9 +18,9 @@ var FSSamplecollections = Table[
OrganizationID: column{
Name: "organization_id",
DBType: "integer",
Default: "NULL",
Default: "",
Comment: "",
Nullable: true,
Nullable: false,
Generated: false,
AutoIncr: false,
},

View file

@ -18,9 +18,9 @@ var FSSamplelocations = Table[
OrganizationID: column{
Name: "organization_id",
DBType: "integer",
Default: "NULL",
Default: "",
Comment: "",
Nullable: true,
Nullable: false,
Generated: false,
AutoIncr: false,
},

View file

@ -18,9 +18,9 @@ var FSServicerequests = Table[
OrganizationID: column{
Name: "organization_id",
DBType: "integer",
Default: "NULL",
Default: "",
Comment: "",
Nullable: true,
Nullable: false,
Generated: false,
AutoIncr: false,
},

View file

@ -18,9 +18,9 @@ var FSSpeciesabundances = Table[
OrganizationID: column{
Name: "organization_id",
DBType: "integer",
Default: "NULL",
Default: "",
Comment: "",
Nullable: true,
Nullable: false,
Generated: false,
AutoIncr: false,
},

View file

@ -18,9 +18,9 @@ var FSStormdrains = Table[
OrganizationID: column{
Name: "organization_id",
DBType: "integer",
Default: "NULL",
Default: "",
Comment: "",
Nullable: true,
Nullable: false,
Generated: false,
AutoIncr: false,
},

View file

@ -18,9 +18,9 @@ var FSTimecards = Table[
OrganizationID: column{
Name: "organization_id",
DBType: "integer",
Default: "NULL",
Default: "",
Comment: "",
Nullable: true,
Nullable: false,
Generated: false,
AutoIncr: false,
},

View file

@ -18,9 +18,9 @@ var FSTrapdata = Table[
OrganizationID: column{
Name: "organization_id",
DBType: "integer",
Default: "NULL",
Default: "",
Comment: "",
Nullable: true,
Nullable: false,
Generated: false,
AutoIncr: false,
},

View file

@ -18,9 +18,9 @@ var FSTraplocations = Table[
OrganizationID: column{
Name: "organization_id",
DBType: "integer",
Default: "NULL",
Default: "",
Comment: "",
Nullable: true,
Nullable: false,
Generated: false,
AutoIncr: false,
},

View file

@ -18,9 +18,9 @@ var FSTreatments = Table[
OrganizationID: column{
Name: "organization_id",
DBType: "integer",
Default: "NULL",
Default: "",
Comment: "",
Nullable: true,
Nullable: false,
Generated: false,
AutoIncr: false,
},

View file

@ -18,9 +18,9 @@ var FSTreatmentareas = Table[
OrganizationID: column{
Name: "organization_id",
DBType: "integer",
Default: "NULL",
Default: "",
Comment: "",
Nullable: true,
Nullable: false,
Generated: false,
AutoIncr: false,
},

View file

@ -18,9 +18,9 @@ var FSZones = Table[
OrganizationID: column{
Name: "organization_id",
DBType: "integer",
Default: "NULL",
Default: "",
Comment: "",
Nullable: true,
Nullable: false,
Generated: false,
AutoIncr: false,
},

View file

@ -18,9 +18,9 @@ var FSZones2s = Table[
OrganizationID: column{
Name: "organization_id",
DBType: "integer",
Default: "NULL",
Default: "",
Comment: "",
Nullable: true,
Nullable: false,
Generated: false,
AutoIncr: false,
},

View file

@ -18,9 +18,9 @@ var HistoryContainerrelates = Table[
OrganizationID: column{
Name: "organization_id",
DBType: "integer",
Default: "NULL",
Default: "",
Comment: "",
Nullable: true,
Nullable: false,
Generated: false,
AutoIncr: false,
},
@ -114,6 +114,15 @@ var HistoryContainerrelates = Table[
Generated: false,
AutoIncr: false,
},
Created: column{
Name: "created",
DBType: "timestamp without time zone",
Default: "NULL",
Comment: "",
Nullable: true,
Generated: false,
AutoIncr: false,
},
CreatedDate: column{
Name: "created_date",
DBType: "bigint",
@ -234,6 +243,7 @@ type historyContainerrelateColumns struct {
Mosquitoinspid column
Objectid column
Treatmentid column
Created column
CreatedDate column
CreatedUser column
GeometryX column
@ -245,7 +255,7 @@ type historyContainerrelateColumns struct {
func (c historyContainerrelateColumns) AsSlice() []column {
return []column{
c.OrganizationID, c.Containertype, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Globalid, c.Inspsampleid, c.Mosquitoinspid, c.Objectid, c.Treatmentid, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version,
c.OrganizationID, c.Containertype, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Globalid, c.Inspsampleid, c.Mosquitoinspid, c.Objectid, c.Treatmentid, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version,
}
}

View file

@ -18,9 +18,9 @@ var HistoryFieldscoutinglogs = Table[
OrganizationID: column{
Name: "organization_id",
DBType: "integer",
Default: "NULL",
Default: "",
Comment: "",
Nullable: true,
Nullable: false,
Generated: false,
AutoIncr: false,
},
@ -87,6 +87,15 @@ var HistoryFieldscoutinglogs = Table[
Generated: false,
AutoIncr: false,
},
Created: column{
Name: "created",
DBType: "timestamp without time zone",
Default: "NULL",
Comment: "",
Nullable: true,
Generated: false,
AutoIncr: false,
},
CreatedDate: column{
Name: "created_date",
DBType: "bigint",
@ -204,6 +213,7 @@ type historyFieldscoutinglogColumns struct {
Globalid column
Objectid column
Status column
Created column
CreatedDate column
CreatedUser column
GeometryX column
@ -215,7 +225,7 @@ type historyFieldscoutinglogColumns struct {
func (c historyFieldscoutinglogColumns) AsSlice() []column {
return []column{
c.OrganizationID, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Globalid, c.Objectid, c.Status, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version,
c.OrganizationID, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Globalid, c.Objectid, c.Status, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version,
}
}

View file

@ -18,9 +18,9 @@ var HistoryHabitatrelates = Table[
OrganizationID: column{
Name: "organization_id",
DBType: "integer",
Default: "NULL",
Default: "",
Comment: "",
Nullable: true,
Nullable: false,
Generated: false,
AutoIncr: false,
},
@ -96,6 +96,15 @@ var HistoryHabitatrelates = Table[
Generated: false,
AutoIncr: false,
},
Created: column{
Name: "created",
DBType: "timestamp without time zone",
Default: "NULL",
Comment: "",
Nullable: true,
Generated: false,
AutoIncr: false,
},
CreatedDate: column{
Name: "created_date",
DBType: "bigint",
@ -214,6 +223,7 @@ type historyHabitatrelateColumns struct {
Globalid column
Habitattype column
Objectid column
Created column
CreatedDate column
CreatedUser column
GeometryX column
@ -225,7 +235,7 @@ type historyHabitatrelateColumns struct {
func (c historyHabitatrelateColumns) AsSlice() []column {
return []column{
c.OrganizationID, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.ForeignID, c.Globalid, c.Habitattype, c.Objectid, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version,
c.OrganizationID, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.ForeignID, c.Globalid, c.Habitattype, c.Objectid, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version,
}
}

View file

@ -18,9 +18,9 @@ var HistoryInspectionsamples = Table[
OrganizationID: column{
Name: "organization_id",
DBType: "integer",
Default: "NULL",
Default: "",
Comment: "",
Nullable: true,
Nullable: false,
Generated: false,
AutoIncr: false,
},
@ -114,6 +114,15 @@ var HistoryInspectionsamples = Table[
Generated: false,
AutoIncr: false,
},
Created: column{
Name: "created",
DBType: "timestamp without time zone",
Default: "NULL",
Comment: "",
Nullable: true,
Generated: false,
AutoIncr: false,
},
CreatedDate: column{
Name: "created_date",
DBType: "bigint",
@ -234,6 +243,7 @@ type historyInspectionsampleColumns struct {
Objectid column
Processed column
Sampleid column
Created column
CreatedDate column
CreatedUser column
GeometryX column
@ -245,7 +255,7 @@ type historyInspectionsampleColumns struct {
func (c historyInspectionsampleColumns) AsSlice() []column {
return []column{
c.OrganizationID, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Globalid, c.Idbytech, c.InspID, c.Objectid, c.Processed, c.Sampleid, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version,
c.OrganizationID, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Globalid, c.Idbytech, c.InspID, c.Objectid, c.Processed, c.Sampleid, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version,
}
}

View file

@ -18,9 +18,9 @@ var HistoryInspectionsampledetails = Table[
OrganizationID: column{
Name: "organization_id",
DBType: "integer",
Default: "NULL",
Default: "",
Comment: "",
Nullable: true,
Nullable: false,
Generated: false,
AutoIncr: false,
},
@ -213,6 +213,15 @@ var HistoryInspectionsampledetails = Table[
Generated: false,
AutoIncr: false,
},
Created: column{
Name: "created",
DBType: "timestamp without time zone",
Default: "NULL",
Comment: "",
Nullable: true,
Generated: false,
AutoIncr: false,
},
CreatedDate: column{
Name: "created_date",
DBType: "bigint",
@ -344,6 +353,7 @@ type historyInspectionsampledetailColumns struct {
Lpupcount column
Objectid column
Processed column
Created column
CreatedDate column
CreatedUser column
GeometryX column
@ -355,7 +365,7 @@ type historyInspectionsampledetailColumns struct {
func (c historyInspectionsampledetailColumns) AsSlice() []column {
return []column{
c.OrganizationID, c.Comments, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Fadultact, c.Fdomstage, c.Feggcount, c.Fieldspecies, c.Flarvcount, c.Flstages, c.Fpupcount, c.Globalid, c.InspsampleID, c.Labspecies, c.Ldomstage, c.Leggcount, c.Llarvcount, c.Lpupcount, c.Objectid, c.Processed, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version,
c.OrganizationID, c.Comments, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Fadultact, c.Fdomstage, c.Feggcount, c.Fieldspecies, c.Flarvcount, c.Flstages, c.Fpupcount, c.Globalid, c.InspsampleID, c.Labspecies, c.Ldomstage, c.Leggcount, c.Llarvcount, c.Lpupcount, c.Objectid, c.Processed, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version,
}
}

View file

@ -18,9 +18,9 @@ var HistoryLinelocations = Table[
OrganizationID: column{
Name: "organization_id",
DBType: "integer",
Default: "NULL",
Default: "",
Comment: "",
Nullable: true,
Nullable: false,
Generated: false,
AutoIncr: false,
},
@ -420,6 +420,15 @@ var HistoryLinelocations = Table[
Generated: false,
AutoIncr: false,
},
Created: column{
Name: "created",
DBType: "timestamp without time zone",
Default: "NULL",
Comment: "",
Nullable: true,
Generated: false,
AutoIncr: false,
},
CreatedDate: column{
Name: "created_date",
DBType: "bigint",
@ -574,6 +583,7 @@ type historyLinelocationColumns struct {
WidthMeters column
Zone column
Zone2 column
Created column
CreatedDate column
CreatedUser column
GeometryX column
@ -585,7 +595,7 @@ type historyLinelocationColumns struct {
func (c historyLinelocationColumns) AsSlice() []column {
return []column{
c.OrganizationID, c.Accessdesc, c.Acres, c.Active, c.Comments, c.Creationdate, c.Creator, c.Description, c.Externalid, c.Editdate, c.Editor, c.Globalid, c.Habitat, c.Hectares, c.Jurisdiction, c.Larvinspectinterval, c.Lastinspectactiontaken, c.Lastinspectactivity, c.Lastinspectavglarvae, c.Lastinspectavgpupae, c.Lastinspectbreeding, c.Lastinspectconditions, c.Lastinspectdate, c.Lastinspectfieldspecies, c.Lastinspectlstages, c.Lasttreatactivity, c.Lasttreatdate, c.Lasttreatproduct, c.Lasttreatqty, c.Lasttreatqtyunit, c.LengthFT, c.LengthMeters, c.Locationnumber, c.Name, c.Nextactiondatescheduled, c.Objectid, c.Priority, c.Symbology, c.ShapeLength, c.Usetype, c.Waterorigin, c.WidthFT, c.WidthMeters, c.Zone, c.Zone2, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version,
c.OrganizationID, c.Accessdesc, c.Acres, c.Active, c.Comments, c.Creationdate, c.Creator, c.Description, c.Externalid, c.Editdate, c.Editor, c.Globalid, c.Habitat, c.Hectares, c.Jurisdiction, c.Larvinspectinterval, c.Lastinspectactiontaken, c.Lastinspectactivity, c.Lastinspectavglarvae, c.Lastinspectavgpupae, c.Lastinspectbreeding, c.Lastinspectconditions, c.Lastinspectdate, c.Lastinspectfieldspecies, c.Lastinspectlstages, c.Lasttreatactivity, c.Lasttreatdate, c.Lasttreatproduct, c.Lasttreatqty, c.Lasttreatqtyunit, c.LengthFT, c.LengthMeters, c.Locationnumber, c.Name, c.Nextactiondatescheduled, c.Objectid, c.Priority, c.Symbology, c.ShapeLength, c.Usetype, c.Waterorigin, c.WidthFT, c.WidthMeters, c.Zone, c.Zone2, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version,
}
}

View file

@ -18,9 +18,9 @@ var HistoryLocationtrackings = Table[
OrganizationID: column{
Name: "organization_id",
DBType: "integer",
Default: "NULL",
Default: "",
Comment: "",
Nullable: true,
Nullable: false,
Generated: false,
AutoIncr: false,
},
@ -96,6 +96,15 @@ var HistoryLocationtrackings = Table[
Generated: false,
AutoIncr: false,
},
Created: column{
Name: "created",
DBType: "timestamp without time zone",
Default: "NULL",
Comment: "",
Nullable: true,
Generated: false,
AutoIncr: false,
},
CreatedDate: column{
Name: "created_date",
DBType: "bigint",
@ -214,6 +223,7 @@ type historyLocationtrackingColumns struct {
Fieldtech column
Globalid column
Objectid column
Created column
CreatedDate column
CreatedUser column
GeometryX column
@ -225,7 +235,7 @@ type historyLocationtrackingColumns struct {
func (c historyLocationtrackingColumns) AsSlice() []column {
return []column{
c.OrganizationID, c.Accuracy, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Fieldtech, c.Globalid, c.Objectid, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version,
c.OrganizationID, c.Accuracy, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Fieldtech, c.Globalid, c.Objectid, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version,
}
}

View file

@ -18,9 +18,9 @@ var HistoryMosquitoinspections = Table[
OrganizationID: column{
Name: "organization_id",
DBType: "integer",
Default: "NULL",
Default: "",
Comment: "",
Nullable: true,
Nullable: false,
Generated: false,
AutoIncr: false,
},
@ -483,6 +483,15 @@ var HistoryMosquitoinspections = Table[
Generated: false,
AutoIncr: false,
},
Created: column{
Name: "created",
DBType: "timestamp without time zone",
Default: "NULL",
Comment: "",
Nullable: true,
Generated: false,
AutoIncr: false,
},
CreatedDate: column{
Name: "created_date",
DBType: "bigint",
@ -662,6 +671,7 @@ type historyMosquitoinspectionColumns struct {
Windspeed column
Zone column
Zone2 column
Created column
CreatedDate column
CreatedUser column
GeometryX column
@ -675,7 +685,7 @@ type historyMosquitoinspectionColumns struct {
func (c historyMosquitoinspectionColumns) AsSlice() []column {
return []column{
c.OrganizationID, c.Actiontaken, c.Activity, c.Adultact, c.Avetemp, c.Avglarvae, c.Avgpupae, c.Breeding, c.Cbcount, c.Comments, c.Containercount, c.Creationdate, c.Creator, c.Domstage, c.Eggs, c.Enddatetime, c.Editdate, c.Editor, c.Fieldspecies, c.Fieldtech, c.Globalid, c.Jurisdiction, c.Larvaepresent, c.Linelocid, c.Locationname, c.Lstages, c.Numdips, c.Objectid, c.Personalcontact, c.Pointlocid, c.Polygonlocid, c.Posdips, c.Positivecontainercount, c.Pupaepresent, c.Raingauge, c.Recordstatus, c.Reviewed, c.Reviewedby, c.Revieweddate, c.Sdid, c.Sitecond, c.Srid, c.Startdatetime, c.Tirecount, c.Totlarvae, c.Totpupae, c.Visualmonitoring, c.Vmcomments, c.Winddir, c.Windspeed, c.Zone, c.Zone2, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Adminaction, c.Ptaid, c.Version,
c.OrganizationID, c.Actiontaken, c.Activity, c.Adultact, c.Avetemp, c.Avglarvae, c.Avgpupae, c.Breeding, c.Cbcount, c.Comments, c.Containercount, c.Creationdate, c.Creator, c.Domstage, c.Eggs, c.Enddatetime, c.Editdate, c.Editor, c.Fieldspecies, c.Fieldtech, c.Globalid, c.Jurisdiction, c.Larvaepresent, c.Linelocid, c.Locationname, c.Lstages, c.Numdips, c.Objectid, c.Personalcontact, c.Pointlocid, c.Polygonlocid, c.Posdips, c.Positivecontainercount, c.Pupaepresent, c.Raingauge, c.Recordstatus, c.Reviewed, c.Reviewedby, c.Revieweddate, c.Sdid, c.Sitecond, c.Srid, c.Startdatetime, c.Tirecount, c.Totlarvae, c.Totpupae, c.Visualmonitoring, c.Vmcomments, c.Winddir, c.Windspeed, c.Zone, c.Zone2, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Adminaction, c.Ptaid, c.Version,
}
}

View file

@ -18,9 +18,9 @@ var HistoryPointlocations = Table[
OrganizationID: column{
Name: "organization_id",
DBType: "integer",
Default: "NULL",
Default: "",
Comment: "",
Nullable: true,
Nullable: false,
Generated: false,
AutoIncr: false,
},

View file

@ -18,9 +18,9 @@ var HistoryPolygonlocations = Table[
OrganizationID: column{
Name: "organization_id",
DBType: "integer",
Default: "NULL",
Default: "",
Comment: "",
Nullable: true,
Nullable: false,
Generated: false,
AutoIncr: false,
},

View file

@ -18,9 +18,9 @@ var HistoryPools = Table[
OrganizationID: column{
Name: "organization_id",
DBType: "integer",
Default: "NULL",
Default: "",
Comment: "",
Nullable: true,
Nullable: false,
Generated: false,
AutoIncr: false,
},
@ -213,6 +213,15 @@ var HistoryPools = Table[
Generated: false,
AutoIncr: false,
},
Created: column{
Name: "created",
DBType: "timestamp without time zone",
Default: "NULL",
Comment: "",
Nullable: true,
Generated: false,
AutoIncr: false,
},
CreatedDate: column{
Name: "created_date",
DBType: "bigint",
@ -371,6 +380,7 @@ type historyPoolColumns struct {
Testmethod column
Testtech column
TrapdataID column
Created column
CreatedDate column
CreatedUser column
GeometryX column
@ -385,7 +395,7 @@ type historyPoolColumns struct {
func (c historyPoolColumns) AsSlice() []column {
return []column{
c.OrganizationID, c.Comments, c.Creationdate, c.Creator, c.Datesent, c.Datetested, c.Diseasepos, c.Diseasetested, c.Editdate, c.Editor, c.Gatewaysync, c.Globalid, c.Lab, c.LabID, c.Objectid, c.Poolyear, c.Processed, c.Sampleid, c.Survtech, c.Testmethod, c.Testtech, c.TrapdataID, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Vectorsurvcollectionid, c.Vectorsurvpoolid, c.Vectorsurvtrapdataid, c.Version,
c.OrganizationID, c.Comments, c.Creationdate, c.Creator, c.Datesent, c.Datetested, c.Diseasepos, c.Diseasetested, c.Editdate, c.Editor, c.Gatewaysync, c.Globalid, c.Lab, c.LabID, c.Objectid, c.Poolyear, c.Processed, c.Sampleid, c.Survtech, c.Testmethod, c.Testtech, c.TrapdataID, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Vectorsurvcollectionid, c.Vectorsurvpoolid, c.Vectorsurvtrapdataid, c.Version,
}
}

View file

@ -18,9 +18,9 @@ var HistoryPooldetails = Table[
OrganizationID: column{
Name: "organization_id",
DBType: "integer",
Default: "NULL",
Default: "",
Comment: "",
Nullable: true,
Nullable: false,
Generated: false,
AutoIncr: false,
},
@ -114,6 +114,15 @@ var HistoryPooldetails = Table[
Generated: false,
AutoIncr: false,
},
Created: column{
Name: "created",
DBType: "timestamp without time zone",
Default: "NULL",
Comment: "",
Nullable: true,
Generated: false,
AutoIncr: false,
},
CreatedDate: column{
Name: "created_date",
DBType: "bigint",
@ -234,6 +243,7 @@ type historyPooldetailColumns struct {
PoolID column
Species column
TrapdataID column
Created column
CreatedDate column
CreatedUser column
GeometryX column
@ -245,7 +255,7 @@ type historyPooldetailColumns struct {
func (c historyPooldetailColumns) AsSlice() []column {
return []column{
c.OrganizationID, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Females, c.Globalid, c.Objectid, c.PoolID, c.Species, c.TrapdataID, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version,
c.OrganizationID, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Females, c.Globalid, c.Objectid, c.PoolID, c.Species, c.TrapdataID, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version,
}
}

View file

@ -18,9 +18,9 @@ var HistoryProposedtreatmentareas = Table[
OrganizationID: column{
Name: "organization_id",
DBType: "integer",
Default: "NULL",
Default: "",
Comment: "",
Nullable: true,
Nullable: false,
Generated: false,
AutoIncr: false,
},

View file

@ -18,9 +18,9 @@ var HistoryQamosquitoinspections = Table[
OrganizationID: column{
Name: "organization_id",
DBType: "integer",
Default: "NULL",
Default: "",
Comment: "",
Nullable: true,
Nullable: false,
Generated: false,
AutoIncr: false,
},
@ -546,6 +546,15 @@ var HistoryQamosquitoinspections = Table[
Generated: false,
AutoIncr: false,
},
Created: column{
Name: "created",
DBType: "timestamp without time zone",
Default: "NULL",
Comment: "",
Nullable: true,
Generated: false,
AutoIncr: false,
},
CreatedDate: column{
Name: "created_date",
DBType: "bigint",
@ -714,6 +723,7 @@ type historyQamosquitoinspectionColumns struct {
Windspeed column
Zone column
Zone2 column
Created column
CreatedDate column
CreatedUser column
GeometryX column
@ -725,7 +735,7 @@ type historyQamosquitoinspectionColumns struct {
func (c historyQamosquitoinspectionColumns) AsSlice() []column {
return []column{
c.OrganizationID, c.Acresbreeding, c.Actiontaken, c.Adultactivity, c.Aquaticorganisms, c.Avetemp, c.Breedingpotential, c.Comments, c.Creationdate, c.Creator, c.Enddatetime, c.Editdate, c.Editor, c.Fieldtech, c.Fish, c.Globalid, c.Habvalue1, c.Habvalue1percent, c.Habvalue2, c.Habvalue2percent, c.Larvaeinsidetreatedarea, c.Larvaeoutsidetreatedarea, c.Larvaepresent, c.Larvaereason, c.Linelocid, c.Locationname, c.LR, c.Mosquitohabitat, c.Movingwater, c.Negdips, c.Nowaterever, c.Objectid, c.Pointlocid, c.Polygonlocid, c.Posdips, c.Potential, c.Raingauge, c.Recordstatus, c.Reviewed, c.Reviewedby, c.Revieweddate, c.Sitetype, c.Soilconditions, c.Sourcereduction, c.Startdatetime, c.Totalacres, c.Vegetation, c.Waterconditions, c.Waterduration, c.Watermovement1, c.Watermovement1percent, c.Watermovement2, c.Watermovement2percent, c.Waterpresent, c.Watersource, c.Winddir, c.Windspeed, c.Zone, c.Zone2, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version,
c.OrganizationID, c.Acresbreeding, c.Actiontaken, c.Adultactivity, c.Aquaticorganisms, c.Avetemp, c.Breedingpotential, c.Comments, c.Creationdate, c.Creator, c.Enddatetime, c.Editdate, c.Editor, c.Fieldtech, c.Fish, c.Globalid, c.Habvalue1, c.Habvalue1percent, c.Habvalue2, c.Habvalue2percent, c.Larvaeinsidetreatedarea, c.Larvaeoutsidetreatedarea, c.Larvaepresent, c.Larvaereason, c.Linelocid, c.Locationname, c.LR, c.Mosquitohabitat, c.Movingwater, c.Negdips, c.Nowaterever, c.Objectid, c.Pointlocid, c.Polygonlocid, c.Posdips, c.Potential, c.Raingauge, c.Recordstatus, c.Reviewed, c.Reviewedby, c.Revieweddate, c.Sitetype, c.Soilconditions, c.Sourcereduction, c.Startdatetime, c.Totalacres, c.Vegetation, c.Waterconditions, c.Waterduration, c.Watermovement1, c.Watermovement1percent, c.Watermovement2, c.Watermovement2percent, c.Waterpresent, c.Watersource, c.Winddir, c.Windspeed, c.Zone, c.Zone2, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version,
}
}

View file

@ -18,9 +18,9 @@ var HistoryRodentlocations = Table[
OrganizationID: column{
Name: "organization_id",
DBType: "integer",
Default: "NULL",
Default: "",
Comment: "",
Nullable: true,
Nullable: false,
Generated: false,
AutoIncr: false,
},
@ -249,6 +249,15 @@ var HistoryRodentlocations = Table[
Generated: false,
AutoIncr: false,
},
Created: column{
Name: "created",
DBType: "timestamp without time zone",
Default: "NULL",
Comment: "",
Nullable: true,
Generated: false,
AutoIncr: false,
},
CreatedDate: column{
Name: "created_date",
DBType: "bigint",
@ -393,6 +402,7 @@ type historyRodentlocationColumns struct {
Usetype column
Zone column
Zone2 column
Created column
CreatedDate column
CreatedUser column
GeometryX column
@ -405,7 +415,7 @@ type historyRodentlocationColumns struct {
func (c historyRodentlocationColumns) AsSlice() []column {
return []column{
c.OrganizationID, c.Accessdesc, c.Active, c.Comments, c.Creationdate, c.Creator, c.Description, c.Externalid, c.Editdate, c.Editor, c.Globalid, c.Habitat, c.Lastinspectaction, c.Lastinspectconditions, c.Lastinspectdate, c.Lastinspectrodentevidence, c.Lastinspectspecies, c.Locationname, c.Locationnumber, c.Nextactiondatescheduled, c.Objectid, c.Priority, c.Symbology, c.Usetype, c.Zone, c.Zone2, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Jurisdiction, c.Version,
c.OrganizationID, c.Accessdesc, c.Active, c.Comments, c.Creationdate, c.Creator, c.Description, c.Externalid, c.Editdate, c.Editor, c.Globalid, c.Habitat, c.Lastinspectaction, c.Lastinspectconditions, c.Lastinspectdate, c.Lastinspectrodentevidence, c.Lastinspectspecies, c.Locationname, c.Locationnumber, c.Nextactiondatescheduled, c.Objectid, c.Priority, c.Symbology, c.Usetype, c.Zone, c.Zone2, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Jurisdiction, c.Version,
}
}

View file

@ -18,9 +18,9 @@ var HistorySamplecollections = Table[
OrganizationID: column{
Name: "organization_id",
DBType: "integer",
Default: "NULL",
Default: "",
Comment: "",
Nullable: true,
Nullable: false,
Generated: false,
AutoIncr: false,
},
@ -402,6 +402,15 @@ var HistorySamplecollections = Table[
Generated: false,
AutoIncr: false,
},
Created: column{
Name: "created",
DBType: "timestamp without time zone",
Default: "NULL",
Comment: "",
Nullable: true,
Generated: false,
AutoIncr: false,
},
CreatedDate: column{
Name: "created_date",
DBType: "bigint",
@ -554,6 +563,7 @@ type historySamplecollectionColumns struct {
Windspeed column
Zone column
Zone2 column
Created column
CreatedDate column
CreatedUser column
GeometryX column
@ -565,7 +575,7 @@ type historySamplecollectionColumns struct {
func (c historySamplecollectionColumns) AsSlice() []column {
return []column{
c.OrganizationID, c.Activity, c.Avetemp, c.Chickenid, c.Comments, c.Creationdate, c.Creator, c.Datesent, c.Datetested, c.Diseasepos, c.Diseasetested, c.Enddatetime, c.Editdate, c.Editor, c.Fieldtech, c.Flockid, c.Gatewaysync, c.Globalid, c.Lab, c.Locationname, c.LocID, c.Objectid, c.Processed, c.Raingauge, c.Recordstatus, c.Reviewed, c.Reviewedby, c.Revieweddate, c.Samplecond, c.Samplecount, c.Sampleid, c.Sampletype, c.Sex, c.Sitecond, c.Species, c.Startdatetime, c.Survtech, c.Testmethod, c.Testtech, c.Winddir, c.Windspeed, c.Zone, c.Zone2, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version,
c.OrganizationID, c.Activity, c.Avetemp, c.Chickenid, c.Comments, c.Creationdate, c.Creator, c.Datesent, c.Datetested, c.Diseasepos, c.Diseasetested, c.Enddatetime, c.Editdate, c.Editor, c.Fieldtech, c.Flockid, c.Gatewaysync, c.Globalid, c.Lab, c.Locationname, c.LocID, c.Objectid, c.Processed, c.Raingauge, c.Recordstatus, c.Reviewed, c.Reviewedby, c.Revieweddate, c.Samplecond, c.Samplecount, c.Sampleid, c.Sampletype, c.Sex, c.Sitecond, c.Species, c.Startdatetime, c.Survtech, c.Testmethod, c.Testtech, c.Winddir, c.Windspeed, c.Zone, c.Zone2, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version,
}
}

View file

@ -18,9 +18,9 @@ var HistorySamplelocations = Table[
OrganizationID: column{
Name: "organization_id",
DBType: "integer",
Default: "NULL",
Default: "",
Comment: "",
Nullable: true,
Nullable: false,
Generated: false,
AutoIncr: false,
},
@ -204,6 +204,15 @@ var HistorySamplelocations = Table[
Generated: false,
AutoIncr: false,
},
Created: column{
Name: "created",
DBType: "timestamp without time zone",
Default: "NULL",
Comment: "",
Nullable: true,
Generated: false,
AutoIncr: false,
},
CreatedDate: column{
Name: "created_date",
DBType: "bigint",
@ -334,6 +343,7 @@ type historySamplelocationColumns struct {
Usetype column
Zone column
Zone2 column
Created column
CreatedDate column
CreatedUser column
GeometryX column
@ -345,7 +355,7 @@ type historySamplelocationColumns struct {
func (c historySamplelocationColumns) AsSlice() []column {
return []column{
c.OrganizationID, c.Accessdesc, c.Active, c.Comments, c.Creationdate, c.Creator, c.Description, c.Externalid, c.Editdate, c.Editor, c.Gatewaysync, c.Globalid, c.Habitat, c.Locationnumber, c.Name, c.Nextactiondatescheduled, c.Objectid, c.Priority, c.Usetype, c.Zone, c.Zone2, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version,
c.OrganizationID, c.Accessdesc, c.Active, c.Comments, c.Creationdate, c.Creator, c.Description, c.Externalid, c.Editdate, c.Editor, c.Gatewaysync, c.Globalid, c.Habitat, c.Locationnumber, c.Name, c.Nextactiondatescheduled, c.Objectid, c.Priority, c.Usetype, c.Zone, c.Zone2, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version,
}
}

View file

@ -18,9 +18,9 @@ var HistoryServicerequests = Table[
OrganizationID: column{
Name: "organization_id",
DBType: "integer",
Default: "NULL",
Default: "",
Comment: "",
Nullable: true,
Nullable: false,
Generated: false,
AutoIncr: false,
},
@ -726,6 +726,15 @@ var HistoryServicerequests = Table[
Generated: false,
AutoIncr: false,
},
Created: column{
Name: "created",
DBType: "timestamp without time zone",
Default: "NULL",
Comment: "",
Nullable: true,
Generated: false,
AutoIncr: false,
},
CreatedDate: column{
Name: "created_date",
DBType: "bigint",
@ -950,6 +959,7 @@ type historyServicerequestColumns struct {
Yvalue column
Zone column
Zone2 column
Created column
CreatedDate column
CreatedUser column
GeometryX column
@ -965,7 +975,7 @@ type historyServicerequestColumns struct {
func (c historyServicerequestColumns) AsSlice() []column {
return []column{
c.OrganizationID, c.Accepted, c.Acceptedby, c.Accepteddate, c.Allowed, c.Assignedtech, c.Clraddr1, c.Clraddr2, c.Clranon, c.Clrcity, c.Clrcompany, c.Clrcontpref, c.Clremail, c.Clrfname, c.Clrother, c.Clrphone1, c.Clrphone2, c.Clrstate, c.Clrzip, c.Comments, c.Creationdate, c.Creator, c.Datetimeclosed, c.Duedate, c.Entrytech, c.Estcompletedate, c.Externalerror, c.Externalid, c.Editdate, c.Editor, c.Firstresponsedate, c.Globalid, c.Issuesreported, c.Jurisdiction, c.Nextaction, c.Notificationtimestamp, c.Notified, c.Notifieddate, c.Objectid, c.Pointlocid, c.Priority, c.Recdatetime, c.Recordstatus, c.Rejectedby, c.Rejecteddate, c.Rejectedreason, c.Reqaddr1, c.Reqaddr2, c.Reqcity, c.Reqcompany, c.Reqcrossst, c.Reqdescr, c.Reqfldnotes, c.Reqmapgrid, c.Reqnotesforcust, c.Reqnotesfortech, c.Reqpermission, c.Reqprogramactions, c.Reqstate, c.Reqsubdiv, c.Reqtarget, c.Reqzip, c.Responsedaycount, c.Reviewed, c.Reviewedby, c.Revieweddate, c.Scheduled, c.Scheduleddate, c.Source, c.SRNumber, c.Status, c.Supervisor, c.Techclosed, c.Validx, c.Validy, c.Xvalue, c.Yvalue, c.Zone, c.Zone2, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Dog, c.Spanish, c.ScheduleNotes, c.SchedulePeriod, c.Version,
c.OrganizationID, c.Accepted, c.Acceptedby, c.Accepteddate, c.Allowed, c.Assignedtech, c.Clraddr1, c.Clraddr2, c.Clranon, c.Clrcity, c.Clrcompany, c.Clrcontpref, c.Clremail, c.Clrfname, c.Clrother, c.Clrphone1, c.Clrphone2, c.Clrstate, c.Clrzip, c.Comments, c.Creationdate, c.Creator, c.Datetimeclosed, c.Duedate, c.Entrytech, c.Estcompletedate, c.Externalerror, c.Externalid, c.Editdate, c.Editor, c.Firstresponsedate, c.Globalid, c.Issuesreported, c.Jurisdiction, c.Nextaction, c.Notificationtimestamp, c.Notified, c.Notifieddate, c.Objectid, c.Pointlocid, c.Priority, c.Recdatetime, c.Recordstatus, c.Rejectedby, c.Rejecteddate, c.Rejectedreason, c.Reqaddr1, c.Reqaddr2, c.Reqcity, c.Reqcompany, c.Reqcrossst, c.Reqdescr, c.Reqfldnotes, c.Reqmapgrid, c.Reqnotesforcust, c.Reqnotesfortech, c.Reqpermission, c.Reqprogramactions, c.Reqstate, c.Reqsubdiv, c.Reqtarget, c.Reqzip, c.Responsedaycount, c.Reviewed, c.Reviewedby, c.Revieweddate, c.Scheduled, c.Scheduleddate, c.Source, c.SRNumber, c.Status, c.Supervisor, c.Techclosed, c.Validx, c.Validy, c.Xvalue, c.Yvalue, c.Zone, c.Zone2, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Dog, c.Spanish, c.ScheduleNotes, c.SchedulePeriod, c.Version,
}
}

View file

@ -18,9 +18,9 @@ var HistorySpeciesabundances = Table[
OrganizationID: column{
Name: "organization_id",
DBType: "integer",
Default: "NULL",
Default: "",
Comment: "",
Nullable: true,
Nullable: false,
Generated: false,
AutoIncr: false,
},
@ -195,6 +195,15 @@ var HistorySpeciesabundances = Table[
Generated: false,
AutoIncr: false,
},
Created: column{
Name: "created",
DBType: "timestamp without time zone",
Default: "NULL",
Comment: "",
Nullable: true,
Generated: false,
AutoIncr: false,
},
CreatedDate: column{
Name: "created_date",
DBType: "bigint",
@ -378,6 +387,7 @@ type historySpeciesabundanceColumns struct {
Total column
TrapdataID column
Unknown column
Created column
CreatedDate column
CreatedUser column
GeometryX column
@ -395,7 +405,7 @@ type historySpeciesabundanceColumns struct {
func (c historySpeciesabundanceColumns) AsSlice() []column {
return []column{
c.OrganizationID, c.Bloodedfem, c.Creationdate, c.Creator, c.Eggs, c.Editdate, c.Editor, c.Females, c.Gravidfem, c.Globalid, c.Larvae, c.Males, c.Objectid, c.Poolstogen, c.Processed, c.Pupae, c.Species, c.Total, c.TrapdataID, c.Unknown, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Globalzscore, c.H3R7, c.H3R8, c.R7score, c.R8score, c.Yearweek, c.Version,
c.OrganizationID, c.Bloodedfem, c.Creationdate, c.Creator, c.Eggs, c.Editdate, c.Editor, c.Females, c.Gravidfem, c.Globalid, c.Larvae, c.Males, c.Objectid, c.Poolstogen, c.Processed, c.Pupae, c.Species, c.Total, c.TrapdataID, c.Unknown, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Globalzscore, c.H3R7, c.H3R8, c.R7score, c.R8score, c.Yearweek, c.Version,
}
}

View file

@ -18,9 +18,9 @@ var HistoryStormdrains = Table[
OrganizationID: column{
Name: "organization_id",
DBType: "integer",
Default: "NULL",
Default: "",
Comment: "",
Nullable: true,
Nullable: false,
Generated: false,
AutoIncr: false,
},
@ -159,6 +159,15 @@ var HistoryStormdrains = Table[
Generated: false,
AutoIncr: false,
},
Created: column{
Name: "created",
DBType: "timestamp without time zone",
Default: "NULL",
Comment: "",
Nullable: true,
Generated: false,
AutoIncr: false,
},
CreatedDate: column{
Name: "created_date",
DBType: "bigint",
@ -284,6 +293,7 @@ type historyStormdrainColumns struct {
Type column
Zone column
Zone2 column
Created column
CreatedDate column
CreatedUser column
GeometryX column
@ -295,7 +305,7 @@ type historyStormdrainColumns struct {
func (c historyStormdrainColumns) AsSlice() []column {
return []column{
c.OrganizationID, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Globalid, c.Jurisdiction, c.Lastaction, c.Laststatus, c.Lasttreatdate, c.Nexttreatmentdate, c.Objectid, c.Symbology, c.Type, c.Zone, c.Zone2, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version,
c.OrganizationID, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Globalid, c.Jurisdiction, c.Lastaction, c.Laststatus, c.Lasttreatdate, c.Nexttreatmentdate, c.Objectid, c.Symbology, c.Type, c.Zone, c.Zone2, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version,
}
}

View file

@ -18,9 +18,9 @@ var HistoryTimecards = Table[
OrganizationID: column{
Name: "organization_id",
DBType: "integer",
Default: "NULL",
Default: "",
Comment: "",
Nullable: true,
Nullable: false,
Generated: false,
AutoIncr: false,
},
@ -231,6 +231,15 @@ var HistoryTimecards = Table[
Generated: false,
AutoIncr: false,
},
Created: column{
Name: "created",
DBType: "timestamp without time zone",
Default: "NULL",
Comment: "",
Nullable: true,
Generated: false,
AutoIncr: false,
},
CreatedDate: column{
Name: "created_date",
DBType: "bigint",
@ -373,6 +382,7 @@ type historyTimecardColumns struct {
Traplocid column
Zone column
Zone2 column
Created column
CreatedDate column
CreatedUser column
GeometryX column
@ -385,7 +395,7 @@ type historyTimecardColumns struct {
func (c historyTimecardColumns) AsSlice() []column {
return []column{
c.OrganizationID, c.Activity, c.Comments, c.Creationdate, c.Creator, c.Enddatetime, c.Equiptype, c.Externalid, c.Editdate, c.Editor, c.Fieldtech, c.Globalid, c.Lclocid, c.Linelocid, c.Locationname, c.Objectid, c.Pointlocid, c.Polygonlocid, c.Samplelocid, c.Srid, c.Startdatetime, c.Traplocid, c.Zone, c.Zone2, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Rodentlocid, c.Version,
c.OrganizationID, c.Activity, c.Comments, c.Creationdate, c.Creator, c.Enddatetime, c.Equiptype, c.Externalid, c.Editdate, c.Editor, c.Fieldtech, c.Globalid, c.Lclocid, c.Linelocid, c.Locationname, c.Objectid, c.Pointlocid, c.Polygonlocid, c.Samplelocid, c.Srid, c.Startdatetime, c.Traplocid, c.Zone, c.Zone2, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Rodentlocid, c.Version,
}
}

View file

@ -18,9 +18,9 @@ var HistoryTrapdata = Table[
OrganizationID: column{
Name: "organization_id",
DBType: "integer",
Default: "NULL",
Default: "",
Comment: "",
Nullable: true,
Nullable: false,
Generated: false,
AutoIncr: false,
},
@ -339,6 +339,15 @@ var HistoryTrapdata = Table[
Generated: false,
AutoIncr: false,
},
Created: column{
Name: "created",
DBType: "timestamp without time zone",
Default: "NULL",
Comment: "",
Nullable: true,
Generated: false,
AutoIncr: false,
},
CreatedDate: column{
Name: "created_date",
DBType: "bigint",
@ -511,6 +520,7 @@ type historyTrapdatumColumns struct {
Windspeed column
Zone column
Zone2 column
Created column
CreatedDate column
CreatedUser column
GeometryX column
@ -525,7 +535,7 @@ type historyTrapdatumColumns struct {
func (c historyTrapdatumColumns) AsSlice() []column {
return []column{
c.OrganizationID, c.Avetemp, c.Comments, c.Creationdate, c.Creator, c.Enddatetime, c.Editdate, c.Editor, c.Fieldtech, c.Field, c.Gatewaysync, c.Globalid, c.Idbytech, c.Locationname, c.LocID, c.LR, c.Objectid, c.Processed, c.Raingauge, c.Recordstatus, c.Reviewed, c.Reviewedby, c.Revieweddate, c.Sitecond, c.Sortbytech, c.Srid, c.Startdatetime, c.Trapactivitytype, c.Trapcondition, c.Trapnights, c.Traptype, c.Voltage, c.Winddir, c.Windspeed, c.Zone, c.Zone2, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Lure, c.Vectorsurvtrapdataid, c.Vectorsurvtraplocationid, c.Version,
c.OrganizationID, c.Avetemp, c.Comments, c.Creationdate, c.Creator, c.Enddatetime, c.Editdate, c.Editor, c.Fieldtech, c.Field, c.Gatewaysync, c.Globalid, c.Idbytech, c.Locationname, c.LocID, c.LR, c.Objectid, c.Processed, c.Raingauge, c.Recordstatus, c.Reviewed, c.Reviewedby, c.Revieweddate, c.Sitecond, c.Sortbytech, c.Srid, c.Startdatetime, c.Trapactivitytype, c.Trapcondition, c.Trapnights, c.Traptype, c.Voltage, c.Winddir, c.Windspeed, c.Zone, c.Zone2, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Lure, c.Vectorsurvtrapdataid, c.Vectorsurvtraplocationid, c.Version,
}
}

View file

@ -18,9 +18,9 @@ var HistoryTraplocations = Table[
OrganizationID: column{
Name: "organization_id",
DBType: "integer",
Default: "NULL",
Default: "",
Comment: "",
Nullable: true,
Nullable: false,
Generated: false,
AutoIncr: false,
},
@ -204,6 +204,15 @@ var HistoryTraplocations = Table[
Generated: false,
AutoIncr: false,
},
Created: column{
Name: "created",
DBType: "timestamp without time zone",
Default: "NULL",
Comment: "",
Nullable: true,
Generated: false,
AutoIncr: false,
},
CreatedDate: column{
Name: "created_date",
DBType: "bigint",
@ -388,6 +397,7 @@ type historyTraplocationColumns struct {
Usetype column
Zone column
Zone2 column
Created column
CreatedDate column
CreatedUser column
GeometryX column
@ -405,7 +415,7 @@ type historyTraplocationColumns struct {
func (c historyTraplocationColumns) AsSlice() []column {
return []column{
c.OrganizationID, c.Accessdesc, c.Active, c.Comments, c.Creationdate, c.Creator, c.Description, c.Externalid, c.Editdate, c.Editor, c.Gatewaysync, c.Globalid, c.Habitat, c.Locationnumber, c.Name, c.Nextactiondatescheduled, c.Objectid, c.Priority, c.Usetype, c.Zone, c.Zone2, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Route, c.RouteOrder, c.SetDow, c.Vectorsurvsiteid, c.H3R7, c.H3R8, c.Version,
c.OrganizationID, c.Accessdesc, c.Active, c.Comments, c.Creationdate, c.Creator, c.Description, c.Externalid, c.Editdate, c.Editor, c.Gatewaysync, c.Globalid, c.Habitat, c.Locationnumber, c.Name, c.Nextactiondatescheduled, c.Objectid, c.Priority, c.Usetype, c.Zone, c.Zone2, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Route, c.RouteOrder, c.SetDow, c.Vectorsurvsiteid, c.H3R7, c.H3R8, c.Version,
}
}

View file

@ -18,9 +18,9 @@ var HistoryTreatments = Table[
OrganizationID: column{
Name: "organization_id",
DBType: "integer",
Default: "NULL",
Default: "",
Comment: "",
Nullable: true,
Nullable: false,
Generated: false,
AutoIncr: false,
},

View file

@ -18,9 +18,9 @@ var HistoryTreatmentareas = Table[
OrganizationID: column{
Name: "organization_id",
DBType: "integer",
Default: "NULL",
Default: "",
Comment: "",
Nullable: true,
Nullable: false,
Generated: false,
AutoIncr: false,
},
@ -150,6 +150,15 @@ var HistoryTreatmentareas = Table[
Generated: false,
AutoIncr: false,
},
Created: column{
Name: "created",
DBType: "timestamp without time zone",
Default: "NULL",
Comment: "",
Nullable: true,
Generated: false,
AutoIncr: false,
},
CreatedDate: column{
Name: "created_date",
DBType: "bigint",
@ -274,6 +283,7 @@ type historyTreatmentareaColumns struct {
Treatdate column
TreatID column
Type column
Created column
CreatedDate column
CreatedUser column
GeometryX column
@ -285,7 +295,7 @@ type historyTreatmentareaColumns struct {
func (c historyTreatmentareaColumns) AsSlice() []column {
return []column{
c.OrganizationID, c.Comments, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Globalid, c.Notified, c.Objectid, c.SessionID, c.ShapeArea, c.ShapeLength, c.Treatdate, c.TreatID, c.Type, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version,
c.OrganizationID, c.Comments, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Globalid, c.Notified, c.Objectid, c.SessionID, c.ShapeArea, c.ShapeLength, c.Treatdate, c.TreatID, c.Type, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version,
}
}

View file

@ -18,9 +18,9 @@ var HistoryZones = Table[
OrganizationID: column{
Name: "organization_id",
DBType: "integer",
Default: "NULL",
Default: "",
Comment: "",
Nullable: true,
Nullable: false,
Generated: false,
AutoIncr: false,
},
@ -114,6 +114,15 @@ var HistoryZones = Table[
Generated: false,
AutoIncr: false,
},
Created: column{
Name: "created",
DBType: "timestamp without time zone",
Default: "NULL",
Comment: "",
Nullable: true,
Generated: false,
AutoIncr: false,
},
CreatedDate: column{
Name: "created_date",
DBType: "bigint",
@ -234,6 +243,7 @@ type historyZoneColumns struct {
Objectid column
ShapeArea column
ShapeLength column
Created column
CreatedDate column
CreatedUser column
GeometryX column
@ -245,7 +255,7 @@ type historyZoneColumns struct {
func (c historyZoneColumns) AsSlice() []column {
return []column{
c.OrganizationID, c.Active, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Globalid, c.Name, c.Objectid, c.ShapeArea, c.ShapeLength, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version,
c.OrganizationID, c.Active, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Globalid, c.Name, c.Objectid, c.ShapeArea, c.ShapeLength, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version,
}
}

View file

@ -18,9 +18,9 @@ var HistoryZones2s = Table[
OrganizationID: column{
Name: "organization_id",
DBType: "integer",
Default: "NULL",
Default: "",
Comment: "",
Nullable: true,
Nullable: false,
Generated: false,
AutoIncr: false,
},
@ -105,6 +105,15 @@ var HistoryZones2s = Table[
Generated: false,
AutoIncr: false,
},
Created: column{
Name: "created",
DBType: "timestamp without time zone",
Default: "NULL",
Comment: "",
Nullable: true,
Generated: false,
AutoIncr: false,
},
CreatedDate: column{
Name: "created_date",
DBType: "bigint",
@ -224,6 +233,7 @@ type historyZones2Columns struct {
Objectid column
ShapeArea column
ShapeLength column
Created column
CreatedDate column
CreatedUser column
GeometryX column
@ -235,7 +245,7 @@ type historyZones2Columns struct {
func (c historyZones2Columns) AsSlice() []column {
return []column{
c.OrganizationID, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Globalid, c.Name, c.Objectid, c.ShapeArea, c.ShapeLength, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version,
c.OrganizationID, c.Creationdate, c.Creator, c.Editdate, c.Editor, c.Globalid, c.Name, c.Objectid, c.ShapeArea, c.ShapeLength, c.Created, c.CreatedDate, c.CreatedUser, c.GeometryX, c.GeometryY, c.LastEditedDate, c.LastEditedUser, c.Version,
}
}

View file

@ -8,6 +8,10 @@ import "context"
type contextKey string
var (
// Relationship Contexts for fieldseeker_sync
fieldseekerSyncWithParentsCascadingCtx = newContextual[bool]("fieldseekerSyncWithParentsCascading")
fieldseekerSyncRelOrganizationCtx = newContextual[bool]("fieldseeker_sync.organization.fieldseeker_sync.fieldseeker_sync_organization_id_fkey")
// Relationship Contexts for fs_containerrelate
fsContainerrelateWithParentsCascadingCtx = newContextual[bool]("fsContainerrelateWithParentsCascading")
fsContainerrelateRelOrganizationCtx = newContextual[bool]("fs_containerrelate.organization.fs_containerrelate.fs_containerrelate_organization_id_fkey")
@ -233,6 +237,7 @@ var (
// Relationship Contexts for organization
organizationWithParentsCascadingCtx = newContextual[bool]("organizationWithParentsCascading")
organizationRelFieldseekerSyncsCtx = newContextual[bool]("fieldseeker_sync.organization.fieldseeker_sync.fieldseeker_sync_organization_id_fkey")
organizationRelFSContainerrelatesCtx = newContextual[bool]("fs_containerrelate.organization.fs_containerrelate.fs_containerrelate_organization_id_fkey")
organizationRelFSFieldscoutinglogsCtx = newContextual[bool]("fs_fieldscoutinglog.organization.fs_fieldscoutinglog.fs_fieldscoutinglog_organization_id_fkey")
organizationRelFSHabitatrelatesCtx = newContextual[bool]("fs_habitatrelate.organization.fs_habitatrelate.fs_habitatrelate_organization_id_fkey")

View file

@ -13,6 +13,7 @@ import (
)
type Factory struct {
baseFieldseekerSyncMods FieldseekerSyncModSlice
baseFSContainerrelateMods FSContainerrelateModSlice
baseFSFieldscoutinglogMods FSFieldscoutinglogModSlice
baseFSHabitatrelateMods FSHabitatrelateModSlice
@ -78,6 +79,40 @@ func New() *Factory {
return &Factory{}
}
func (f *Factory) NewFieldseekerSync(mods ...FieldseekerSyncMod) *FieldseekerSyncTemplate {
return f.NewFieldseekerSyncWithContext(context.Background(), mods...)
}
func (f *Factory) NewFieldseekerSyncWithContext(ctx context.Context, mods ...FieldseekerSyncMod) *FieldseekerSyncTemplate {
o := &FieldseekerSyncTemplate{f: f}
if f != nil {
f.baseFieldseekerSyncMods.Apply(ctx, o)
}
FieldseekerSyncModSlice(mods).Apply(ctx, o)
return o
}
func (f *Factory) FromExistingFieldseekerSync(m *models.FieldseekerSync) *FieldseekerSyncTemplate {
o := &FieldseekerSyncTemplate{f: f, alreadyPersisted: true}
o.ID = func() int32 { return m.ID }
o.Created = func() time.Time { return m.Created }
o.RecordsCreated = func() int32 { return m.RecordsCreated }
o.RecordsUpdated = func() int32 { return m.RecordsUpdated }
o.RecordsUnchanged = func() int32 { return m.RecordsUnchanged }
o.OrganizationID = func() int32 { return m.OrganizationID }
ctx := context.Background()
if m.R.Organization != nil {
FieldseekerSyncMods.WithExistingOrganization(m.R.Organization).Apply(ctx, o)
}
return o
}
func (f *Factory) NewFSContainerrelate(mods ...FSContainerrelateMod) *FSContainerrelateTemplate {
return f.NewFSContainerrelateWithContext(context.Background(), mods...)
}
@ -97,7 +132,7 @@ func (f *Factory) NewFSContainerrelateWithContext(ctx context.Context, mods ...F
func (f *Factory) FromExistingFSContainerrelate(m *models.FSContainerrelate) *FSContainerrelateTemplate {
o := &FSContainerrelateTemplate{f: f, alreadyPersisted: true}
o.OrganizationID = func() null.Val[int32] { return m.OrganizationID }
o.OrganizationID = func() int32 { return m.OrganizationID }
o.Containertype = func() null.Val[string] { return m.Containertype }
o.Creationdate = func() null.Val[int64] { return m.Creationdate }
o.Creator = func() null.Val[string] { return m.Creator }
@ -143,7 +178,7 @@ func (f *Factory) NewFSFieldscoutinglogWithContext(ctx context.Context, mods ...
func (f *Factory) FromExistingFSFieldscoutinglog(m *models.FSFieldscoutinglog) *FSFieldscoutinglogTemplate {
o := &FSFieldscoutinglogTemplate{f: f, alreadyPersisted: true}
o.OrganizationID = func() null.Val[int32] { return m.OrganizationID }
o.OrganizationID = func() int32 { return m.OrganizationID }
o.Creationdate = func() null.Val[int64] { return m.Creationdate }
o.Creator = func() null.Val[string] { return m.Creator }
o.Editdate = func() null.Val[int64] { return m.Editdate }
@ -186,7 +221,7 @@ func (f *Factory) NewFSHabitatrelateWithContext(ctx context.Context, mods ...FSH
func (f *Factory) FromExistingFSHabitatrelate(m *models.FSHabitatrelate) *FSHabitatrelateTemplate {
o := &FSHabitatrelateTemplate{f: f, alreadyPersisted: true}
o.OrganizationID = func() null.Val[int32] { return m.OrganizationID }
o.OrganizationID = func() int32 { return m.OrganizationID }
o.Creationdate = func() null.Val[int64] { return m.Creationdate }
o.Creator = func() null.Val[string] { return m.Creator }
o.Editdate = func() null.Val[int64] { return m.Editdate }
@ -230,7 +265,7 @@ func (f *Factory) NewFSInspectionsampleWithContext(ctx context.Context, mods ...
func (f *Factory) FromExistingFSInspectionsample(m *models.FSInspectionsample) *FSInspectionsampleTemplate {
o := &FSInspectionsampleTemplate{f: f, alreadyPersisted: true}
o.OrganizationID = func() null.Val[int32] { return m.OrganizationID }
o.OrganizationID = func() int32 { return m.OrganizationID }
o.Creationdate = func() null.Val[int64] { return m.Creationdate }
o.Creator = func() null.Val[string] { return m.Creator }
o.Editdate = func() null.Val[int64] { return m.Editdate }
@ -276,7 +311,7 @@ func (f *Factory) NewFSInspectionsampledetailWithContext(ctx context.Context, mo
func (f *Factory) FromExistingFSInspectionsampledetail(m *models.FSInspectionsampledetail) *FSInspectionsampledetailTemplate {
o := &FSInspectionsampledetailTemplate{f: f, alreadyPersisted: true}
o.OrganizationID = func() null.Val[int32] { return m.OrganizationID }
o.OrganizationID = func() int32 { return m.OrganizationID }
o.Comments = func() null.Val[string] { return m.Comments }
o.Creationdate = func() null.Val[int64] { return m.Creationdate }
o.Creator = func() null.Val[string] { return m.Creator }
@ -333,7 +368,7 @@ func (f *Factory) NewFSLinelocationWithContext(ctx context.Context, mods ...FSLi
func (f *Factory) FromExistingFSLinelocation(m *models.FSLinelocation) *FSLinelocationTemplate {
o := &FSLinelocationTemplate{f: f, alreadyPersisted: true}
o.OrganizationID = func() null.Val[int32] { return m.OrganizationID }
o.OrganizationID = func() int32 { return m.OrganizationID }
o.Accessdesc = func() null.Val[string] { return m.Accessdesc }
o.Acres = func() null.Val[float64] { return m.Acres }
o.Active = func() null.Val[int16] { return m.Active }
@ -413,7 +448,7 @@ func (f *Factory) NewFSLocationtrackingWithContext(ctx context.Context, mods ...
func (f *Factory) FromExistingFSLocationtracking(m *models.FSLocationtracking) *FSLocationtrackingTemplate {
o := &FSLocationtrackingTemplate{f: f, alreadyPersisted: true}
o.OrganizationID = func() null.Val[int32] { return m.OrganizationID }
o.OrganizationID = func() int32 { return m.OrganizationID }
o.Accuracy = func() null.Val[float64] { return m.Accuracy }
o.Creationdate = func() null.Val[int64] { return m.Creationdate }
o.Creator = func() null.Val[string] { return m.Creator }
@ -457,7 +492,7 @@ func (f *Factory) NewFSMosquitoinspectionWithContext(ctx context.Context, mods .
func (f *Factory) FromExistingFSMosquitoinspection(m *models.FSMosquitoinspection) *FSMosquitoinspectionTemplate {
o := &FSMosquitoinspectionTemplate{f: f, alreadyPersisted: true}
o.OrganizationID = func() null.Val[int32] { return m.OrganizationID }
o.OrganizationID = func() int32 { return m.OrganizationID }
o.Actiontaken = func() null.Val[string] { return m.Actiontaken }
o.Activity = func() null.Val[string] { return m.Activity }
o.Adultact = func() null.Val[string] { return m.Adultact }
@ -546,7 +581,7 @@ func (f *Factory) NewFSPointlocationWithContext(ctx context.Context, mods ...FSP
func (f *Factory) FromExistingFSPointlocation(m *models.FSPointlocation) *FSPointlocationTemplate {
o := &FSPointlocationTemplate{f: f, alreadyPersisted: true}
o.OrganizationID = func() null.Val[int32] { return m.OrganizationID }
o.OrganizationID = func() int32 { return m.OrganizationID }
o.Accessdesc = func() null.Val[string] { return m.Accessdesc }
o.Active = func() null.Val[int16] { return m.Active }
o.Comments = func() null.Val[string] { return m.Comments }
@ -622,7 +657,7 @@ func (f *Factory) NewFSPolygonlocationWithContext(ctx context.Context, mods ...F
func (f *Factory) FromExistingFSPolygonlocation(m *models.FSPolygonlocation) *FSPolygonlocationTemplate {
o := &FSPolygonlocationTemplate{f: f, alreadyPersisted: true}
o.OrganizationID = func() null.Val[int32] { return m.OrganizationID }
o.OrganizationID = func() int32 { return m.OrganizationID }
o.Accessdesc = func() null.Val[string] { return m.Accessdesc }
o.Acres = func() null.Val[float64] { return m.Acres }
o.Active = func() null.Val[int16] { return m.Active }
@ -696,7 +731,7 @@ func (f *Factory) NewFSPoolWithContext(ctx context.Context, mods ...FSPoolMod) *
func (f *Factory) FromExistingFSPool(m *models.FSPool) *FSPoolTemplate {
o := &FSPoolTemplate{f: f, alreadyPersisted: true}
o.OrganizationID = func() null.Val[int32] { return m.OrganizationID }
o.OrganizationID = func() int32 { return m.OrganizationID }
o.Comments = func() null.Val[string] { return m.Comments }
o.Creationdate = func() null.Val[int64] { return m.Creationdate }
o.Creator = func() null.Val[string] { return m.Creator }
@ -756,7 +791,7 @@ func (f *Factory) NewFSPooldetailWithContext(ctx context.Context, mods ...FSPool
func (f *Factory) FromExistingFSPooldetail(m *models.FSPooldetail) *FSPooldetailTemplate {
o := &FSPooldetailTemplate{f: f, alreadyPersisted: true}
o.OrganizationID = func() null.Val[int32] { return m.OrganizationID }
o.OrganizationID = func() int32 { return m.OrganizationID }
o.Creationdate = func() null.Val[int64] { return m.Creationdate }
o.Creator = func() null.Val[string] { return m.Creator }
o.Editdate = func() null.Val[int64] { return m.Editdate }
@ -802,7 +837,7 @@ func (f *Factory) NewFSProposedtreatmentareaWithContext(ctx context.Context, mod
func (f *Factory) FromExistingFSProposedtreatmentarea(m *models.FSProposedtreatmentarea) *FSProposedtreatmentareaTemplate {
o := &FSProposedtreatmentareaTemplate{f: f, alreadyPersisted: true}
o.OrganizationID = func() null.Val[int32] { return m.OrganizationID }
o.OrganizationID = func() int32 { return m.OrganizationID }
o.Acres = func() null.Val[float64] { return m.Acres }
o.Comments = func() null.Val[string] { return m.Comments }
o.Completed = func() null.Val[int16] { return m.Completed }
@ -867,7 +902,7 @@ func (f *Factory) NewFSQamosquitoinspectionWithContext(ctx context.Context, mods
func (f *Factory) FromExistingFSQamosquitoinspection(m *models.FSQamosquitoinspection) *FSQamosquitoinspectionTemplate {
o := &FSQamosquitoinspectionTemplate{f: f, alreadyPersisted: true}
o.OrganizationID = func() null.Val[int32] { return m.OrganizationID }
o.OrganizationID = func() int32 { return m.OrganizationID }
o.Acresbreeding = func() null.Val[float64] { return m.Acresbreeding }
o.Actiontaken = func() null.Val[string] { return m.Actiontaken }
o.Adultactivity = func() null.Val[int16] { return m.Adultactivity }
@ -961,7 +996,7 @@ func (f *Factory) NewFSRodentlocationWithContext(ctx context.Context, mods ...FS
func (f *Factory) FromExistingFSRodentlocation(m *models.FSRodentlocation) *FSRodentlocationTemplate {
o := &FSRodentlocationTemplate{f: f, alreadyPersisted: true}
o.OrganizationID = func() null.Val[int32] { return m.OrganizationID }
o.OrganizationID = func() int32 { return m.OrganizationID }
o.Accessdesc = func() null.Val[string] { return m.Accessdesc }
o.Active = func() null.Val[int16] { return m.Active }
o.Comments = func() null.Val[string] { return m.Comments }
@ -1023,7 +1058,7 @@ func (f *Factory) NewFSSamplecollectionWithContext(ctx context.Context, mods ...
func (f *Factory) FromExistingFSSamplecollection(m *models.FSSamplecollection) *FSSamplecollectionTemplate {
o := &FSSamplecollectionTemplate{f: f, alreadyPersisted: true}
o.OrganizationID = func() null.Val[int32] { return m.OrganizationID }
o.OrganizationID = func() int32 { return m.OrganizationID }
o.Activity = func() null.Val[string] { return m.Activity }
o.Avetemp = func() null.Val[float64] { return m.Avetemp }
o.Chickenid = func() null.Val[string] { return m.Chickenid }
@ -1101,7 +1136,7 @@ func (f *Factory) NewFSSamplelocationWithContext(ctx context.Context, mods ...FS
func (f *Factory) FromExistingFSSamplelocation(m *models.FSSamplelocation) *FSSamplelocationTemplate {
o := &FSSamplelocationTemplate{f: f, alreadyPersisted: true}
o.OrganizationID = func() null.Val[int32] { return m.OrganizationID }
o.OrganizationID = func() int32 { return m.OrganizationID }
o.Accessdesc = func() null.Val[string] { return m.Accessdesc }
o.Active = func() null.Val[int16] { return m.Active }
o.Comments = func() null.Val[string] { return m.Comments }
@ -1157,7 +1192,7 @@ func (f *Factory) NewFSServicerequestWithContext(ctx context.Context, mods ...FS
func (f *Factory) FromExistingFSServicerequest(m *models.FSServicerequest) *FSServicerequestTemplate {
o := &FSServicerequestTemplate{f: f, alreadyPersisted: true}
o.OrganizationID = func() null.Val[int32] { return m.OrganizationID }
o.OrganizationID = func() int32 { return m.OrganizationID }
o.Accepted = func() null.Val[int16] { return m.Accepted }
o.Acceptedby = func() null.Val[string] { return m.Acceptedby }
o.Accepteddate = func() null.Val[int64] { return m.Accepteddate }
@ -1275,7 +1310,7 @@ func (f *Factory) NewFSSpeciesabundanceWithContext(ctx context.Context, mods ...
func (f *Factory) FromExistingFSSpeciesabundance(m *models.FSSpeciesabundance) *FSSpeciesabundanceTemplate {
o := &FSSpeciesabundanceTemplate{f: f, alreadyPersisted: true}
o.OrganizationID = func() null.Val[int32] { return m.OrganizationID }
o.OrganizationID = func() int32 { return m.OrganizationID }
o.Bloodedfem = func() null.Val[int16] { return m.Bloodedfem }
o.Creationdate = func() null.Val[int64] { return m.Creationdate }
o.Creator = func() null.Val[string] { return m.Creator }
@ -1336,7 +1371,7 @@ func (f *Factory) NewFSStormdrainWithContext(ctx context.Context, mods ...FSStor
func (f *Factory) FromExistingFSStormdrain(m *models.FSStormdrain) *FSStormdrainTemplate {
o := &FSStormdrainTemplate{f: f, alreadyPersisted: true}
o.OrganizationID = func() null.Val[int32] { return m.OrganizationID }
o.OrganizationID = func() int32 { return m.OrganizationID }
o.Creationdate = func() null.Val[int64] { return m.Creationdate }
o.Creator = func() null.Val[string] { return m.Creator }
o.Editdate = func() null.Val[int64] { return m.Editdate }
@ -1387,7 +1422,7 @@ func (f *Factory) NewFSTimecardWithContext(ctx context.Context, mods ...FSTimeca
func (f *Factory) FromExistingFSTimecard(m *models.FSTimecard) *FSTimecardTemplate {
o := &FSTimecardTemplate{f: f, alreadyPersisted: true}
o.OrganizationID = func() null.Val[int32] { return m.OrganizationID }
o.OrganizationID = func() int32 { return m.OrganizationID }
o.Activity = func() null.Val[string] { return m.Activity }
o.Comments = func() null.Val[string] { return m.Comments }
o.Creationdate = func() null.Val[int64] { return m.Creationdate }
@ -1447,7 +1482,7 @@ func (f *Factory) NewFSTrapdatumWithContext(ctx context.Context, mods ...FSTrapd
func (f *Factory) FromExistingFSTrapdatum(m *models.FSTrapdatum) *FSTrapdatumTemplate {
o := &FSTrapdatumTemplate{f: f, alreadyPersisted: true}
o.OrganizationID = func() null.Val[int32] { return m.OrganizationID }
o.OrganizationID = func() int32 { return m.OrganizationID }
o.Avetemp = func() null.Val[float64] { return m.Avetemp }
o.Comments = func() null.Val[string] { return m.Comments }
o.Creationdate = func() null.Val[int64] { return m.Creationdate }
@ -1521,7 +1556,7 @@ func (f *Factory) NewFSTraplocationWithContext(ctx context.Context, mods ...FSTr
func (f *Factory) FromExistingFSTraplocation(m *models.FSTraplocation) *FSTraplocationTemplate {
o := &FSTraplocationTemplate{f: f, alreadyPersisted: true}
o.OrganizationID = func() null.Val[int32] { return m.OrganizationID }
o.OrganizationID = func() int32 { return m.OrganizationID }
o.Accessdesc = func() null.Val[string] { return m.Accessdesc }
o.Active = func() null.Val[int16] { return m.Active }
o.Comments = func() null.Val[string] { return m.Comments }
@ -1583,7 +1618,7 @@ func (f *Factory) NewFSTreatmentWithContext(ctx context.Context, mods ...FSTreat
func (f *Factory) FromExistingFSTreatment(m *models.FSTreatment) *FSTreatmentTemplate {
o := &FSTreatmentTemplate{f: f, alreadyPersisted: true}
o.OrganizationID = func() null.Val[int32] { return m.OrganizationID }
o.OrganizationID = func() int32 { return m.OrganizationID }
o.Activity = func() null.Val[string] { return m.Activity }
o.Areaunit = func() null.Val[string] { return m.Areaunit }
o.Avetemp = func() null.Val[float64] { return m.Avetemp }
@ -1669,7 +1704,7 @@ func (f *Factory) NewFSTreatmentareaWithContext(ctx context.Context, mods ...FST
func (f *Factory) FromExistingFSTreatmentarea(m *models.FSTreatmentarea) *FSTreatmentareaTemplate {
o := &FSTreatmentareaTemplate{f: f, alreadyPersisted: true}
o.OrganizationID = func() null.Val[int32] { return m.OrganizationID }
o.OrganizationID = func() int32 { return m.OrganizationID }
o.Comments = func() null.Val[string] { return m.Comments }
o.Creationdate = func() null.Val[int64] { return m.Creationdate }
o.Creator = func() null.Val[string] { return m.Creator }
@ -1719,7 +1754,7 @@ func (f *Factory) NewFSZoneWithContext(ctx context.Context, mods ...FSZoneMod) *
func (f *Factory) FromExistingFSZone(m *models.FSZone) *FSZoneTemplate {
o := &FSZoneTemplate{f: f, alreadyPersisted: true}
o.OrganizationID = func() null.Val[int32] { return m.OrganizationID }
o.OrganizationID = func() int32 { return m.OrganizationID }
o.Active = func() null.Val[int64] { return m.Active }
o.Creationdate = func() null.Val[int64] { return m.Creationdate }
o.Creator = func() null.Val[string] { return m.Creator }
@ -1765,7 +1800,7 @@ func (f *Factory) NewFSZones2WithContext(ctx context.Context, mods ...FSZones2Mo
func (f *Factory) FromExistingFSZones2(m *models.FSZones2) *FSZones2Template {
o := &FSZones2Template{f: f, alreadyPersisted: true}
o.OrganizationID = func() null.Val[int32] { return m.OrganizationID }
o.OrganizationID = func() int32 { return m.OrganizationID }
o.Creationdate = func() null.Val[int64] { return m.Creationdate }
o.Creator = func() null.Val[string] { return m.Creator }
o.Editdate = func() null.Val[int64] { return m.Editdate }
@ -1837,7 +1872,7 @@ func (f *Factory) NewHistoryContainerrelateWithContext(ctx context.Context, mods
func (f *Factory) FromExistingHistoryContainerrelate(m *models.HistoryContainerrelate) *HistoryContainerrelateTemplate {
o := &HistoryContainerrelateTemplate{f: f, alreadyPersisted: true}
o.OrganizationID = func() null.Val[int32] { return m.OrganizationID }
o.OrganizationID = func() int32 { return m.OrganizationID }
o.Containertype = func() null.Val[string] { return m.Containertype }
o.Creationdate = func() null.Val[int64] { return m.Creationdate }
o.Creator = func() null.Val[string] { return m.Creator }
@ -1848,6 +1883,7 @@ func (f *Factory) FromExistingHistoryContainerrelate(m *models.HistoryContainerr
o.Mosquitoinspid = func() null.Val[string] { return m.Mosquitoinspid }
o.Objectid = func() int32 { return m.Objectid }
o.Treatmentid = func() null.Val[string] { return m.Treatmentid }
o.Created = func() null.Val[time.Time] { return m.Created }
o.CreatedDate = func() null.Val[int64] { return m.CreatedDate }
o.CreatedUser = func() null.Val[string] { return m.CreatedUser }
o.GeometryX = func() null.Val[float64] { return m.GeometryX }
@ -1883,7 +1919,7 @@ func (f *Factory) NewHistoryFieldscoutinglogWithContext(ctx context.Context, mod
func (f *Factory) FromExistingHistoryFieldscoutinglog(m *models.HistoryFieldscoutinglog) *HistoryFieldscoutinglogTemplate {
o := &HistoryFieldscoutinglogTemplate{f: f, alreadyPersisted: true}
o.OrganizationID = func() null.Val[int32] { return m.OrganizationID }
o.OrganizationID = func() int32 { return m.OrganizationID }
o.Creationdate = func() null.Val[int64] { return m.Creationdate }
o.Creator = func() null.Val[string] { return m.Creator }
o.Editdate = func() null.Val[int64] { return m.Editdate }
@ -1891,6 +1927,7 @@ func (f *Factory) FromExistingHistoryFieldscoutinglog(m *models.HistoryFieldscou
o.Globalid = func() null.Val[string] { return m.Globalid }
o.Objectid = func() int32 { return m.Objectid }
o.Status = func() null.Val[int16] { return m.Status }
o.Created = func() null.Val[time.Time] { return m.Created }
o.CreatedDate = func() null.Val[int64] { return m.CreatedDate }
o.CreatedUser = func() null.Val[string] { return m.CreatedUser }
o.GeometryX = func() null.Val[float64] { return m.GeometryX }
@ -1926,7 +1963,7 @@ func (f *Factory) NewHistoryHabitatrelateWithContext(ctx context.Context, mods .
func (f *Factory) FromExistingHistoryHabitatrelate(m *models.HistoryHabitatrelate) *HistoryHabitatrelateTemplate {
o := &HistoryHabitatrelateTemplate{f: f, alreadyPersisted: true}
o.OrganizationID = func() null.Val[int32] { return m.OrganizationID }
o.OrganizationID = func() int32 { return m.OrganizationID }
o.Creationdate = func() null.Val[int64] { return m.Creationdate }
o.Creator = func() null.Val[string] { return m.Creator }
o.Editdate = func() null.Val[int64] { return m.Editdate }
@ -1935,6 +1972,7 @@ func (f *Factory) FromExistingHistoryHabitatrelate(m *models.HistoryHabitatrelat
o.Globalid = func() null.Val[string] { return m.Globalid }
o.Habitattype = func() null.Val[string] { return m.Habitattype }
o.Objectid = func() int32 { return m.Objectid }
o.Created = func() null.Val[time.Time] { return m.Created }
o.CreatedDate = func() null.Val[int64] { return m.CreatedDate }
o.CreatedUser = func() null.Val[string] { return m.CreatedUser }
o.GeometryX = func() null.Val[float64] { return m.GeometryX }
@ -1970,7 +2008,7 @@ func (f *Factory) NewHistoryInspectionsampleWithContext(ctx context.Context, mod
func (f *Factory) FromExistingHistoryInspectionsample(m *models.HistoryInspectionsample) *HistoryInspectionsampleTemplate {
o := &HistoryInspectionsampleTemplate{f: f, alreadyPersisted: true}
o.OrganizationID = func() null.Val[int32] { return m.OrganizationID }
o.OrganizationID = func() int32 { return m.OrganizationID }
o.Creationdate = func() null.Val[int64] { return m.Creationdate }
o.Creator = func() null.Val[string] { return m.Creator }
o.Editdate = func() null.Val[int64] { return m.Editdate }
@ -1981,6 +2019,7 @@ func (f *Factory) FromExistingHistoryInspectionsample(m *models.HistoryInspectio
o.Objectid = func() int32 { return m.Objectid }
o.Processed = func() null.Val[int16] { return m.Processed }
o.Sampleid = func() null.Val[string] { return m.Sampleid }
o.Created = func() null.Val[time.Time] { return m.Created }
o.CreatedDate = func() null.Val[int64] { return m.CreatedDate }
o.CreatedUser = func() null.Val[string] { return m.CreatedUser }
o.GeometryX = func() null.Val[float64] { return m.GeometryX }
@ -2016,7 +2055,7 @@ func (f *Factory) NewHistoryInspectionsampledetailWithContext(ctx context.Contex
func (f *Factory) FromExistingHistoryInspectionsampledetail(m *models.HistoryInspectionsampledetail) *HistoryInspectionsampledetailTemplate {
o := &HistoryInspectionsampledetailTemplate{f: f, alreadyPersisted: true}
o.OrganizationID = func() null.Val[int32] { return m.OrganizationID }
o.OrganizationID = func() int32 { return m.OrganizationID }
o.Comments = func() null.Val[string] { return m.Comments }
o.Creationdate = func() null.Val[int64] { return m.Creationdate }
o.Creator = func() null.Val[string] { return m.Creator }
@ -2038,6 +2077,7 @@ func (f *Factory) FromExistingHistoryInspectionsampledetail(m *models.HistoryIns
o.Lpupcount = func() null.Val[int16] { return m.Lpupcount }
o.Objectid = func() int32 { return m.Objectid }
o.Processed = func() null.Val[int16] { return m.Processed }
o.Created = func() null.Val[time.Time] { return m.Created }
o.CreatedDate = func() null.Val[int64] { return m.CreatedDate }
o.CreatedUser = func() null.Val[string] { return m.CreatedUser }
o.GeometryX = func() null.Val[float64] { return m.GeometryX }
@ -2073,7 +2113,7 @@ func (f *Factory) NewHistoryLinelocationWithContext(ctx context.Context, mods ..
func (f *Factory) FromExistingHistoryLinelocation(m *models.HistoryLinelocation) *HistoryLinelocationTemplate {
o := &HistoryLinelocationTemplate{f: f, alreadyPersisted: true}
o.OrganizationID = func() null.Val[int32] { return m.OrganizationID }
o.OrganizationID = func() int32 { return m.OrganizationID }
o.Accessdesc = func() null.Val[string] { return m.Accessdesc }
o.Acres = func() null.Val[float64] { return m.Acres }
o.Active = func() null.Val[int16] { return m.Active }
@ -2118,6 +2158,7 @@ func (f *Factory) FromExistingHistoryLinelocation(m *models.HistoryLinelocation)
o.WidthMeters = func() null.Val[float64] { return m.WidthMeters }
o.Zone = func() null.Val[string] { return m.Zone }
o.Zone2 = func() null.Val[string] { return m.Zone2 }
o.Created = func() null.Val[time.Time] { return m.Created }
o.CreatedDate = func() null.Val[int64] { return m.CreatedDate }
o.CreatedUser = func() null.Val[string] { return m.CreatedUser }
o.GeometryX = func() null.Val[float64] { return m.GeometryX }
@ -2153,7 +2194,7 @@ func (f *Factory) NewHistoryLocationtrackingWithContext(ctx context.Context, mod
func (f *Factory) FromExistingHistoryLocationtracking(m *models.HistoryLocationtracking) *HistoryLocationtrackingTemplate {
o := &HistoryLocationtrackingTemplate{f: f, alreadyPersisted: true}
o.OrganizationID = func() null.Val[int32] { return m.OrganizationID }
o.OrganizationID = func() int32 { return m.OrganizationID }
o.Accuracy = func() null.Val[float64] { return m.Accuracy }
o.Creationdate = func() null.Val[int64] { return m.Creationdate }
o.Creator = func() null.Val[string] { return m.Creator }
@ -2162,6 +2203,7 @@ func (f *Factory) FromExistingHistoryLocationtracking(m *models.HistoryLocationt
o.Fieldtech = func() null.Val[string] { return m.Fieldtech }
o.Globalid = func() null.Val[string] { return m.Globalid }
o.Objectid = func() int32 { return m.Objectid }
o.Created = func() null.Val[time.Time] { return m.Created }
o.CreatedDate = func() null.Val[int64] { return m.CreatedDate }
o.CreatedUser = func() null.Val[string] { return m.CreatedUser }
o.GeometryX = func() null.Val[float64] { return m.GeometryX }
@ -2197,7 +2239,7 @@ func (f *Factory) NewHistoryMosquitoinspectionWithContext(ctx context.Context, m
func (f *Factory) FromExistingHistoryMosquitoinspection(m *models.HistoryMosquitoinspection) *HistoryMosquitoinspectionTemplate {
o := &HistoryMosquitoinspectionTemplate{f: f, alreadyPersisted: true}
o.OrganizationID = func() null.Val[int32] { return m.OrganizationID }
o.OrganizationID = func() int32 { return m.OrganizationID }
o.Actiontaken = func() null.Val[string] { return m.Actiontaken }
o.Activity = func() null.Val[string] { return m.Activity }
o.Adultact = func() null.Val[string] { return m.Adultact }
@ -2249,6 +2291,7 @@ func (f *Factory) FromExistingHistoryMosquitoinspection(m *models.HistoryMosquit
o.Windspeed = func() null.Val[float64] { return m.Windspeed }
o.Zone = func() null.Val[string] { return m.Zone }
o.Zone2 = func() null.Val[string] { return m.Zone2 }
o.Created = func() null.Val[time.Time] { return m.Created }
o.CreatedDate = func() null.Val[int64] { return m.CreatedDate }
o.CreatedUser = func() null.Val[string] { return m.CreatedUser }
o.GeometryX = func() null.Val[float64] { return m.GeometryX }
@ -2286,7 +2329,7 @@ func (f *Factory) NewHistoryPointlocationWithContext(ctx context.Context, mods .
func (f *Factory) FromExistingHistoryPointlocation(m *models.HistoryPointlocation) *HistoryPointlocationTemplate {
o := &HistoryPointlocationTemplate{f: f, alreadyPersisted: true}
o.OrganizationID = func() null.Val[int32] { return m.OrganizationID }
o.OrganizationID = func() int32 { return m.OrganizationID }
o.Accessdesc = func() null.Val[string] { return m.Accessdesc }
o.Active = func() null.Val[int16] { return m.Active }
o.Comments = func() null.Val[string] { return m.Comments }
@ -2362,7 +2405,7 @@ func (f *Factory) NewHistoryPolygonlocationWithContext(ctx context.Context, mods
func (f *Factory) FromExistingHistoryPolygonlocation(m *models.HistoryPolygonlocation) *HistoryPolygonlocationTemplate {
o := &HistoryPolygonlocationTemplate{f: f, alreadyPersisted: true}
o.OrganizationID = func() null.Val[int32] { return m.OrganizationID }
o.OrganizationID = func() int32 { return m.OrganizationID }
o.Accessdesc = func() null.Val[string] { return m.Accessdesc }
o.Acres = func() null.Val[float64] { return m.Acres }
o.Active = func() null.Val[int16] { return m.Active }
@ -2436,7 +2479,7 @@ func (f *Factory) NewHistoryPoolWithContext(ctx context.Context, mods ...History
func (f *Factory) FromExistingHistoryPool(m *models.HistoryPool) *HistoryPoolTemplate {
o := &HistoryPoolTemplate{f: f, alreadyPersisted: true}
o.OrganizationID = func() null.Val[int32] { return m.OrganizationID }
o.OrganizationID = func() int32 { return m.OrganizationID }
o.Comments = func() null.Val[string] { return m.Comments }
o.Creationdate = func() null.Val[int64] { return m.Creationdate }
o.Creator = func() null.Val[string] { return m.Creator }
@ -2458,6 +2501,7 @@ func (f *Factory) FromExistingHistoryPool(m *models.HistoryPool) *HistoryPoolTem
o.Testmethod = func() null.Val[string] { return m.Testmethod }
o.Testtech = func() null.Val[string] { return m.Testtech }
o.TrapdataID = func() null.Val[string] { return m.TrapdataID }
o.Created = func() null.Val[time.Time] { return m.Created }
o.CreatedDate = func() null.Val[int64] { return m.CreatedDate }
o.CreatedUser = func() null.Val[string] { return m.CreatedUser }
o.GeometryX = func() null.Val[float64] { return m.GeometryX }
@ -2496,7 +2540,7 @@ func (f *Factory) NewHistoryPooldetailWithContext(ctx context.Context, mods ...H
func (f *Factory) FromExistingHistoryPooldetail(m *models.HistoryPooldetail) *HistoryPooldetailTemplate {
o := &HistoryPooldetailTemplate{f: f, alreadyPersisted: true}
o.OrganizationID = func() null.Val[int32] { return m.OrganizationID }
o.OrganizationID = func() int32 { return m.OrganizationID }
o.Creationdate = func() null.Val[int64] { return m.Creationdate }
o.Creator = func() null.Val[string] { return m.Creator }
o.Editdate = func() null.Val[int64] { return m.Editdate }
@ -2507,6 +2551,7 @@ func (f *Factory) FromExistingHistoryPooldetail(m *models.HistoryPooldetail) *Hi
o.PoolID = func() null.Val[string] { return m.PoolID }
o.Species = func() null.Val[string] { return m.Species }
o.TrapdataID = func() null.Val[string] { return m.TrapdataID }
o.Created = func() null.Val[time.Time] { return m.Created }
o.CreatedDate = func() null.Val[int64] { return m.CreatedDate }
o.CreatedUser = func() null.Val[string] { return m.CreatedUser }
o.GeometryX = func() null.Val[float64] { return m.GeometryX }
@ -2542,7 +2587,7 @@ func (f *Factory) NewHistoryProposedtreatmentareaWithContext(ctx context.Context
func (f *Factory) FromExistingHistoryProposedtreatmentarea(m *models.HistoryProposedtreatmentarea) *HistoryProposedtreatmentareaTemplate {
o := &HistoryProposedtreatmentareaTemplate{f: f, alreadyPersisted: true}
o.OrganizationID = func() null.Val[int32] { return m.OrganizationID }
o.OrganizationID = func() int32 { return m.OrganizationID }
o.Acres = func() null.Val[float64] { return m.Acres }
o.Comments = func() null.Val[string] { return m.Comments }
o.Completed = func() null.Val[int16] { return m.Completed }
@ -2607,7 +2652,7 @@ func (f *Factory) NewHistoryQamosquitoinspectionWithContext(ctx context.Context,
func (f *Factory) FromExistingHistoryQamosquitoinspection(m *models.HistoryQamosquitoinspection) *HistoryQamosquitoinspectionTemplate {
o := &HistoryQamosquitoinspectionTemplate{f: f, alreadyPersisted: true}
o.OrganizationID = func() null.Val[int32] { return m.OrganizationID }
o.OrganizationID = func() int32 { return m.OrganizationID }
o.Acresbreeding = func() null.Val[float64] { return m.Acresbreeding }
o.Actiontaken = func() null.Val[string] { return m.Actiontaken }
o.Adultactivity = func() null.Val[int16] { return m.Adultactivity }
@ -2666,6 +2711,7 @@ func (f *Factory) FromExistingHistoryQamosquitoinspection(m *models.HistoryQamos
o.Windspeed = func() null.Val[float64] { return m.Windspeed }
o.Zone = func() null.Val[string] { return m.Zone }
o.Zone2 = func() null.Val[string] { return m.Zone2 }
o.Created = func() null.Val[time.Time] { return m.Created }
o.CreatedDate = func() null.Val[int64] { return m.CreatedDate }
o.CreatedUser = func() null.Val[string] { return m.CreatedUser }
o.GeometryX = func() null.Val[float64] { return m.GeometryX }
@ -2701,7 +2747,7 @@ func (f *Factory) NewHistoryRodentlocationWithContext(ctx context.Context, mods
func (f *Factory) FromExistingHistoryRodentlocation(m *models.HistoryRodentlocation) *HistoryRodentlocationTemplate {
o := &HistoryRodentlocationTemplate{f: f, alreadyPersisted: true}
o.OrganizationID = func() null.Val[int32] { return m.OrganizationID }
o.OrganizationID = func() int32 { return m.OrganizationID }
o.Accessdesc = func() null.Val[string] { return m.Accessdesc }
o.Active = func() null.Val[int16] { return m.Active }
o.Comments = func() null.Val[string] { return m.Comments }
@ -2727,6 +2773,7 @@ func (f *Factory) FromExistingHistoryRodentlocation(m *models.HistoryRodentlocat
o.Usetype = func() null.Val[string] { return m.Usetype }
o.Zone = func() null.Val[string] { return m.Zone }
o.Zone2 = func() null.Val[string] { return m.Zone2 }
o.Created = func() null.Val[time.Time] { return m.Created }
o.CreatedDate = func() null.Val[int64] { return m.CreatedDate }
o.CreatedUser = func() null.Val[string] { return m.CreatedUser }
o.GeometryX = func() null.Val[float64] { return m.GeometryX }
@ -2763,7 +2810,7 @@ func (f *Factory) NewHistorySamplecollectionWithContext(ctx context.Context, mod
func (f *Factory) FromExistingHistorySamplecollection(m *models.HistorySamplecollection) *HistorySamplecollectionTemplate {
o := &HistorySamplecollectionTemplate{f: f, alreadyPersisted: true}
o.OrganizationID = func() null.Val[int32] { return m.OrganizationID }
o.OrganizationID = func() int32 { return m.OrganizationID }
o.Activity = func() null.Val[string] { return m.Activity }
o.Avetemp = func() null.Val[float64] { return m.Avetemp }
o.Chickenid = func() null.Val[string] { return m.Chickenid }
@ -2806,6 +2853,7 @@ func (f *Factory) FromExistingHistorySamplecollection(m *models.HistorySamplecol
o.Windspeed = func() null.Val[float64] { return m.Windspeed }
o.Zone = func() null.Val[string] { return m.Zone }
o.Zone2 = func() null.Val[string] { return m.Zone2 }
o.Created = func() null.Val[time.Time] { return m.Created }
o.CreatedDate = func() null.Val[int64] { return m.CreatedDate }
o.CreatedUser = func() null.Val[string] { return m.CreatedUser }
o.GeometryX = func() null.Val[float64] { return m.GeometryX }
@ -2841,7 +2889,7 @@ func (f *Factory) NewHistorySamplelocationWithContext(ctx context.Context, mods
func (f *Factory) FromExistingHistorySamplelocation(m *models.HistorySamplelocation) *HistorySamplelocationTemplate {
o := &HistorySamplelocationTemplate{f: f, alreadyPersisted: true}
o.OrganizationID = func() null.Val[int32] { return m.OrganizationID }
o.OrganizationID = func() int32 { return m.OrganizationID }
o.Accessdesc = func() null.Val[string] { return m.Accessdesc }
o.Active = func() null.Val[int16] { return m.Active }
o.Comments = func() null.Val[string] { return m.Comments }
@ -2862,6 +2910,7 @@ func (f *Factory) FromExistingHistorySamplelocation(m *models.HistorySamplelocat
o.Usetype = func() null.Val[string] { return m.Usetype }
o.Zone = func() null.Val[string] { return m.Zone }
o.Zone2 = func() null.Val[string] { return m.Zone2 }
o.Created = func() null.Val[time.Time] { return m.Created }
o.CreatedDate = func() null.Val[int64] { return m.CreatedDate }
o.CreatedUser = func() null.Val[string] { return m.CreatedUser }
o.GeometryX = func() null.Val[float64] { return m.GeometryX }
@ -2897,7 +2946,7 @@ func (f *Factory) NewHistoryServicerequestWithContext(ctx context.Context, mods
func (f *Factory) FromExistingHistoryServicerequest(m *models.HistoryServicerequest) *HistoryServicerequestTemplate {
o := &HistoryServicerequestTemplate{f: f, alreadyPersisted: true}
o.OrganizationID = func() null.Val[int32] { return m.OrganizationID }
o.OrganizationID = func() int32 { return m.OrganizationID }
o.Accepted = func() null.Val[int16] { return m.Accepted }
o.Acceptedby = func() null.Val[string] { return m.Acceptedby }
o.Accepteddate = func() null.Val[int64] { return m.Accepteddate }
@ -2976,6 +3025,7 @@ func (f *Factory) FromExistingHistoryServicerequest(m *models.HistoryServicerequ
o.Yvalue = func() null.Val[string] { return m.Yvalue }
o.Zone = func() null.Val[string] { return m.Zone }
o.Zone2 = func() null.Val[string] { return m.Zone2 }
o.Created = func() null.Val[time.Time] { return m.Created }
o.CreatedDate = func() null.Val[int64] { return m.CreatedDate }
o.CreatedUser = func() null.Val[string] { return m.CreatedUser }
o.GeometryX = func() null.Val[float64] { return m.GeometryX }
@ -3015,7 +3065,7 @@ func (f *Factory) NewHistorySpeciesabundanceWithContext(ctx context.Context, mod
func (f *Factory) FromExistingHistorySpeciesabundance(m *models.HistorySpeciesabundance) *HistorySpeciesabundanceTemplate {
o := &HistorySpeciesabundanceTemplate{f: f, alreadyPersisted: true}
o.OrganizationID = func() null.Val[int32] { return m.OrganizationID }
o.OrganizationID = func() int32 { return m.OrganizationID }
o.Bloodedfem = func() null.Val[int16] { return m.Bloodedfem }
o.Creationdate = func() null.Val[int64] { return m.Creationdate }
o.Creator = func() null.Val[string] { return m.Creator }
@ -3035,6 +3085,7 @@ func (f *Factory) FromExistingHistorySpeciesabundance(m *models.HistorySpeciesab
o.Total = func() null.Val[int64] { return m.Total }
o.TrapdataID = func() null.Val[string] { return m.TrapdataID }
o.Unknown = func() null.Val[int16] { return m.Unknown }
o.Created = func() null.Val[time.Time] { return m.Created }
o.CreatedDate = func() null.Val[int64] { return m.CreatedDate }
o.CreatedUser = func() null.Val[string] { return m.CreatedUser }
o.GeometryX = func() null.Val[float64] { return m.GeometryX }
@ -3076,7 +3127,7 @@ func (f *Factory) NewHistoryStormdrainWithContext(ctx context.Context, mods ...H
func (f *Factory) FromExistingHistoryStormdrain(m *models.HistoryStormdrain) *HistoryStormdrainTemplate {
o := &HistoryStormdrainTemplate{f: f, alreadyPersisted: true}
o.OrganizationID = func() null.Val[int32] { return m.OrganizationID }
o.OrganizationID = func() int32 { return m.OrganizationID }
o.Creationdate = func() null.Val[int64] { return m.Creationdate }
o.Creator = func() null.Val[string] { return m.Creator }
o.Editdate = func() null.Val[int64] { return m.Editdate }
@ -3092,6 +3143,7 @@ func (f *Factory) FromExistingHistoryStormdrain(m *models.HistoryStormdrain) *Hi
o.Type = func() null.Val[string] { return m.Type }
o.Zone = func() null.Val[string] { return m.Zone }
o.Zone2 = func() null.Val[string] { return m.Zone2 }
o.Created = func() null.Val[time.Time] { return m.Created }
o.CreatedDate = func() null.Val[int64] { return m.CreatedDate }
o.CreatedUser = func() null.Val[string] { return m.CreatedUser }
o.GeometryX = func() null.Val[float64] { return m.GeometryX }
@ -3127,7 +3179,7 @@ func (f *Factory) NewHistoryTimecardWithContext(ctx context.Context, mods ...His
func (f *Factory) FromExistingHistoryTimecard(m *models.HistoryTimecard) *HistoryTimecardTemplate {
o := &HistoryTimecardTemplate{f: f, alreadyPersisted: true}
o.OrganizationID = func() null.Val[int32] { return m.OrganizationID }
o.OrganizationID = func() int32 { return m.OrganizationID }
o.Activity = func() null.Val[string] { return m.Activity }
o.Comments = func() null.Val[string] { return m.Comments }
o.Creationdate = func() null.Val[int64] { return m.Creationdate }
@ -3151,6 +3203,7 @@ func (f *Factory) FromExistingHistoryTimecard(m *models.HistoryTimecard) *Histor
o.Traplocid = func() null.Val[string] { return m.Traplocid }
o.Zone = func() null.Val[string] { return m.Zone }
o.Zone2 = func() null.Val[string] { return m.Zone2 }
o.Created = func() null.Val[time.Time] { return m.Created }
o.CreatedDate = func() null.Val[int64] { return m.CreatedDate }
o.CreatedUser = func() null.Val[string] { return m.CreatedUser }
o.GeometryX = func() null.Val[float64] { return m.GeometryX }
@ -3187,7 +3240,7 @@ func (f *Factory) NewHistoryTrapdatumWithContext(ctx context.Context, mods ...Hi
func (f *Factory) FromExistingHistoryTrapdatum(m *models.HistoryTrapdatum) *HistoryTrapdatumTemplate {
o := &HistoryTrapdatumTemplate{f: f, alreadyPersisted: true}
o.OrganizationID = func() null.Val[int32] { return m.OrganizationID }
o.OrganizationID = func() int32 { return m.OrganizationID }
o.Avetemp = func() null.Val[float64] { return m.Avetemp }
o.Comments = func() null.Val[string] { return m.Comments }
o.Creationdate = func() null.Val[int64] { return m.Creationdate }
@ -3223,6 +3276,7 @@ func (f *Factory) FromExistingHistoryTrapdatum(m *models.HistoryTrapdatum) *Hist
o.Windspeed = func() null.Val[float64] { return m.Windspeed }
o.Zone = func() null.Val[string] { return m.Zone }
o.Zone2 = func() null.Val[string] { return m.Zone2 }
o.Created = func() null.Val[time.Time] { return m.Created }
o.CreatedDate = func() null.Val[int64] { return m.CreatedDate }
o.CreatedUser = func() null.Val[string] { return m.CreatedUser }
o.GeometryX = func() null.Val[float64] { return m.GeometryX }
@ -3261,7 +3315,7 @@ func (f *Factory) NewHistoryTraplocationWithContext(ctx context.Context, mods ..
func (f *Factory) FromExistingHistoryTraplocation(m *models.HistoryTraplocation) *HistoryTraplocationTemplate {
o := &HistoryTraplocationTemplate{f: f, alreadyPersisted: true}
o.OrganizationID = func() null.Val[int32] { return m.OrganizationID }
o.OrganizationID = func() int32 { return m.OrganizationID }
o.Accessdesc = func() null.Val[string] { return m.Accessdesc }
o.Active = func() null.Val[int16] { return m.Active }
o.Comments = func() null.Val[string] { return m.Comments }
@ -3282,6 +3336,7 @@ func (f *Factory) FromExistingHistoryTraplocation(m *models.HistoryTraplocation)
o.Usetype = func() null.Val[string] { return m.Usetype }
o.Zone = func() null.Val[string] { return m.Zone }
o.Zone2 = func() null.Val[string] { return m.Zone2 }
o.Created = func() null.Val[time.Time] { return m.Created }
o.CreatedDate = func() null.Val[int64] { return m.CreatedDate }
o.CreatedUser = func() null.Val[string] { return m.CreatedUser }
o.GeometryX = func() null.Val[float64] { return m.GeometryX }
@ -3323,7 +3378,7 @@ func (f *Factory) NewHistoryTreatmentWithContext(ctx context.Context, mods ...Hi
func (f *Factory) FromExistingHistoryTreatment(m *models.HistoryTreatment) *HistoryTreatmentTemplate {
o := &HistoryTreatmentTemplate{f: f, alreadyPersisted: true}
o.OrganizationID = func() null.Val[int32] { return m.OrganizationID }
o.OrganizationID = func() int32 { return m.OrganizationID }
o.Activity = func() null.Val[string] { return m.Activity }
o.Areaunit = func() null.Val[string] { return m.Areaunit }
o.Avetemp = func() null.Val[float64] { return m.Avetemp }
@ -3409,7 +3464,7 @@ func (f *Factory) NewHistoryTreatmentareaWithContext(ctx context.Context, mods .
func (f *Factory) FromExistingHistoryTreatmentarea(m *models.HistoryTreatmentarea) *HistoryTreatmentareaTemplate {
o := &HistoryTreatmentareaTemplate{f: f, alreadyPersisted: true}
o.OrganizationID = func() null.Val[int32] { return m.OrganizationID }
o.OrganizationID = func() int32 { return m.OrganizationID }
o.Comments = func() null.Val[string] { return m.Comments }
o.Creationdate = func() null.Val[int64] { return m.Creationdate }
o.Creator = func() null.Val[string] { return m.Creator }
@ -3424,6 +3479,7 @@ func (f *Factory) FromExistingHistoryTreatmentarea(m *models.HistoryTreatmentare
o.Treatdate = func() null.Val[int64] { return m.Treatdate }
o.TreatID = func() null.Val[string] { return m.TreatID }
o.Type = func() null.Val[string] { return m.Type }
o.Created = func() null.Val[time.Time] { return m.Created }
o.CreatedDate = func() null.Val[int64] { return m.CreatedDate }
o.CreatedUser = func() null.Val[string] { return m.CreatedUser }
o.GeometryX = func() null.Val[float64] { return m.GeometryX }
@ -3459,7 +3515,7 @@ func (f *Factory) NewHistoryZoneWithContext(ctx context.Context, mods ...History
func (f *Factory) FromExistingHistoryZone(m *models.HistoryZone) *HistoryZoneTemplate {
o := &HistoryZoneTemplate{f: f, alreadyPersisted: true}
o.OrganizationID = func() null.Val[int32] { return m.OrganizationID }
o.OrganizationID = func() int32 { return m.OrganizationID }
o.Active = func() null.Val[int64] { return m.Active }
o.Creationdate = func() null.Val[int64] { return m.Creationdate }
o.Creator = func() null.Val[string] { return m.Creator }
@ -3470,6 +3526,7 @@ func (f *Factory) FromExistingHistoryZone(m *models.HistoryZone) *HistoryZoneTem
o.Objectid = func() int32 { return m.Objectid }
o.ShapeArea = func() null.Val[float64] { return m.ShapeArea }
o.ShapeLength = func() null.Val[float64] { return m.ShapeLength }
o.Created = func() null.Val[time.Time] { return m.Created }
o.CreatedDate = func() null.Val[int64] { return m.CreatedDate }
o.CreatedUser = func() null.Val[string] { return m.CreatedUser }
o.GeometryX = func() null.Val[float64] { return m.GeometryX }
@ -3505,7 +3562,7 @@ func (f *Factory) NewHistoryZones2WithContext(ctx context.Context, mods ...Histo
func (f *Factory) FromExistingHistoryZones2(m *models.HistoryZones2) *HistoryZones2Template {
o := &HistoryZones2Template{f: f, alreadyPersisted: true}
o.OrganizationID = func() null.Val[int32] { return m.OrganizationID }
o.OrganizationID = func() int32 { return m.OrganizationID }
o.Creationdate = func() null.Val[int64] { return m.Creationdate }
o.Creator = func() null.Val[string] { return m.Creator }
o.Editdate = func() null.Val[int64] { return m.Editdate }
@ -3515,6 +3572,7 @@ func (f *Factory) FromExistingHistoryZones2(m *models.HistoryZones2) *HistoryZon
o.Objectid = func() int32 { return m.Objectid }
o.ShapeArea = func() null.Val[float64] { return m.ShapeArea }
o.ShapeLength = func() null.Val[float64] { return m.ShapeLength }
o.Created = func() null.Val[time.Time] { return m.Created }
o.CreatedDate = func() null.Val[int64] { return m.CreatedDate }
o.CreatedUser = func() null.Val[string] { return m.CreatedUser }
o.GeometryX = func() null.Val[float64] { return m.GeometryX }
@ -3594,6 +3652,9 @@ func (f *Factory) FromExistingOrganization(m *models.Organization) *Organization
o.FieldseekerURL = func() null.Val[string] { return m.FieldseekerURL }
ctx := context.Background()
if len(m.R.FieldseekerSyncs) > 0 {
OrganizationMods.AddExistingFieldseekerSyncs(m.R.FieldseekerSyncs...).Apply(ctx, o)
}
if len(m.R.FSContainerrelates) > 0 {
OrganizationMods.AddExistingFSContainerrelates(m.R.FSContainerrelates...).Apply(ctx, o)
}
@ -3832,6 +3893,14 @@ func (f *Factory) FromExistingUser(m *models.User) *UserTemplate {
return o
}
func (f *Factory) ClearBaseFieldseekerSyncMods() {
f.baseFieldseekerSyncMods = nil
}
func (f *Factory) AddBaseFieldseekerSyncMod(mods ...FieldseekerSyncMod) {
f.baseFieldseekerSyncMods = append(f.baseFieldseekerSyncMods, mods...)
}
func (f *Factory) ClearBaseFSContainerrelateMods() {
f.baseFSContainerrelateMods = nil
}

View file

@ -8,6 +8,30 @@ import (
"testing"
)
func TestCreateFieldseekerSync(t *testing.T) {
if testDB == nil {
t.Skip("skipping test, no DSN provided")
}
ctx, cancel := context.WithCancel(t.Context())
t.Cleanup(cancel)
tx, err := testDB.Begin(ctx)
if err != nil {
t.Fatalf("Error starting transaction: %v", err)
}
defer func() {
if err := tx.Rollback(ctx); err != nil {
t.Fatalf("Error rolling back transaction: %v", err)
}
}()
if _, err := New().NewFieldseekerSyncWithContext(ctx).Create(ctx, tx); err != nil {
t.Fatalf("Error creating FieldseekerSync: %v", err)
}
}
func TestCreateFSContainerrelate(t *testing.T) {
if testDB == nil {
t.Skip("skipping test, no DSN provided")

View file

@ -0,0 +1,538 @@
// Code generated by BobGen psql v0.41.1. DO NOT EDIT.
// This file is meant to be re-generated in place and/or deleted at any time.
package factory
import (
"context"
"testing"
"time"
models "github.com/Gleipnir-Technology/nidus-sync/models"
"github.com/aarondl/opt/omit"
"github.com/jaswdr/faker/v2"
"github.com/stephenafamo/bob"
)
type FieldseekerSyncMod interface {
Apply(context.Context, *FieldseekerSyncTemplate)
}
type FieldseekerSyncModFunc func(context.Context, *FieldseekerSyncTemplate)
func (f FieldseekerSyncModFunc) Apply(ctx context.Context, n *FieldseekerSyncTemplate) {
f(ctx, n)
}
type FieldseekerSyncModSlice []FieldseekerSyncMod
func (mods FieldseekerSyncModSlice) Apply(ctx context.Context, n *FieldseekerSyncTemplate) {
for _, f := range mods {
f.Apply(ctx, n)
}
}
// FieldseekerSyncTemplate is an object representing the database table.
// all columns are optional and should be set by mods
type FieldseekerSyncTemplate struct {
ID func() int32
Created func() time.Time
RecordsCreated func() int32
RecordsUpdated func() int32
RecordsUnchanged func() int32
OrganizationID func() int32
r fieldseekerSyncR
f *Factory
alreadyPersisted bool
}
type fieldseekerSyncR struct {
Organization *fieldseekerSyncROrganizationR
}
type fieldseekerSyncROrganizationR struct {
o *OrganizationTemplate
}
// Apply mods to the FieldseekerSyncTemplate
func (o *FieldseekerSyncTemplate) Apply(ctx context.Context, mods ...FieldseekerSyncMod) {
for _, mod := range mods {
mod.Apply(ctx, o)
}
}
// setModelRels creates and sets the relationships on *models.FieldseekerSync
// according to the relationships in the template. Nothing is inserted into the db
func (t FieldseekerSyncTemplate) setModelRels(o *models.FieldseekerSync) {
if t.r.Organization != nil {
rel := t.r.Organization.o.Build()
rel.R.FieldseekerSyncs = append(rel.R.FieldseekerSyncs, o)
o.OrganizationID = rel.ID // h2
o.R.Organization = rel
}
}
// BuildSetter returns an *models.FieldseekerSyncSetter
// this does nothing with the relationship templates
func (o FieldseekerSyncTemplate) BuildSetter() *models.FieldseekerSyncSetter {
m := &models.FieldseekerSyncSetter{}
if o.ID != nil {
val := o.ID()
m.ID = omit.From(val)
}
if o.Created != nil {
val := o.Created()
m.Created = omit.From(val)
}
if o.RecordsCreated != nil {
val := o.RecordsCreated()
m.RecordsCreated = omit.From(val)
}
if o.RecordsUpdated != nil {
val := o.RecordsUpdated()
m.RecordsUpdated = omit.From(val)
}
if o.RecordsUnchanged != nil {
val := o.RecordsUnchanged()
m.RecordsUnchanged = omit.From(val)
}
if o.OrganizationID != nil {
val := o.OrganizationID()
m.OrganizationID = omit.From(val)
}
return m
}
// BuildManySetter returns an []*models.FieldseekerSyncSetter
// this does nothing with the relationship templates
func (o FieldseekerSyncTemplate) BuildManySetter(number int) []*models.FieldseekerSyncSetter {
m := make([]*models.FieldseekerSyncSetter, number)
for i := range m {
m[i] = o.BuildSetter()
}
return m
}
// Build returns an *models.FieldseekerSync
// Related objects are also created and placed in the .R field
// NOTE: Objects are not inserted into the database. Use FieldseekerSyncTemplate.Create
func (o FieldseekerSyncTemplate) Build() *models.FieldseekerSync {
m := &models.FieldseekerSync{}
if o.ID != nil {
m.ID = o.ID()
}
if o.Created != nil {
m.Created = o.Created()
}
if o.RecordsCreated != nil {
m.RecordsCreated = o.RecordsCreated()
}
if o.RecordsUpdated != nil {
m.RecordsUpdated = o.RecordsUpdated()
}
if o.RecordsUnchanged != nil {
m.RecordsUnchanged = o.RecordsUnchanged()
}
if o.OrganizationID != nil {
m.OrganizationID = o.OrganizationID()
}
o.setModelRels(m)
return m
}
// BuildMany returns an models.FieldseekerSyncSlice
// Related objects are also created and placed in the .R field
// NOTE: Objects are not inserted into the database. Use FieldseekerSyncTemplate.CreateMany
func (o FieldseekerSyncTemplate) BuildMany(number int) models.FieldseekerSyncSlice {
m := make(models.FieldseekerSyncSlice, number)
for i := range m {
m[i] = o.Build()
}
return m
}
func ensureCreatableFieldseekerSync(m *models.FieldseekerSyncSetter) {
if !(m.RecordsCreated.IsValue()) {
val := random_int32(nil)
m.RecordsCreated = omit.From(val)
}
if !(m.RecordsUpdated.IsValue()) {
val := random_int32(nil)
m.RecordsUpdated = omit.From(val)
}
if !(m.RecordsUnchanged.IsValue()) {
val := random_int32(nil)
m.RecordsUnchanged = omit.From(val)
}
if !(m.OrganizationID.IsValue()) {
val := random_int32(nil)
m.OrganizationID = omit.From(val)
}
}
// insertOptRels creates and inserts any optional the relationships on *models.FieldseekerSync
// according to the relationships in the template.
// any required relationship should have already exist on the model
func (o *FieldseekerSyncTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FieldseekerSync) error {
var err error
return err
}
// Create builds a fieldseekerSync and inserts it into the database
// Relations objects are also inserted and placed in the .R field
func (o *FieldseekerSyncTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FieldseekerSync, error) {
var err error
opt := o.BuildSetter()
ensureCreatableFieldseekerSync(opt)
if o.r.Organization == nil {
FieldseekerSyncMods.WithNewOrganization().Apply(ctx, o)
}
var rel0 *models.Organization
if o.r.Organization.o.alreadyPersisted {
rel0 = o.r.Organization.o.Build()
} else {
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return nil, err
}
}
opt.OrganizationID = omit.From(rel0.ID)
m, err := models.FieldseekerSyncs.Insert(opt).One(ctx, exec)
if err != nil {
return nil, err
}
m.R.Organization = rel0
if err := o.insertOptRels(ctx, exec, m); err != nil {
return nil, err
}
return m, err
}
// MustCreate builds a fieldseekerSync and inserts it into the database
// Relations objects are also inserted and placed in the .R field
// panics if an error occurs
func (o *FieldseekerSyncTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FieldseekerSync {
m, err := o.Create(ctx, exec)
if err != nil {
panic(err)
}
return m
}
// CreateOrFail builds a fieldseekerSync and inserts it into the database
// Relations objects are also inserted and placed in the .R field
// It calls `tb.Fatal(err)` on the test/benchmark if an error occurs
func (o *FieldseekerSyncTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FieldseekerSync {
tb.Helper()
m, err := o.Create(ctx, exec)
if err != nil {
tb.Fatal(err)
return nil
}
return m
}
// CreateMany builds multiple fieldseekerSyncs and inserts them into the database
// Relations objects are also inserted and placed in the .R field
func (o FieldseekerSyncTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FieldseekerSyncSlice, error) {
var err error
m := make(models.FieldseekerSyncSlice, number)
for i := range m {
m[i], err = o.Create(ctx, exec)
if err != nil {
return nil, err
}
}
return m, nil
}
// MustCreateMany builds multiple fieldseekerSyncs and inserts them into the database
// Relations objects are also inserted and placed in the .R field
// panics if an error occurs
func (o FieldseekerSyncTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FieldseekerSyncSlice {
m, err := o.CreateMany(ctx, exec, number)
if err != nil {
panic(err)
}
return m
}
// CreateManyOrFail builds multiple fieldseekerSyncs and inserts them into the database
// Relations objects are also inserted and placed in the .R field
// It calls `tb.Fatal(err)` on the test/benchmark if an error occurs
func (o FieldseekerSyncTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FieldseekerSyncSlice {
tb.Helper()
m, err := o.CreateMany(ctx, exec, number)
if err != nil {
tb.Fatal(err)
return nil
}
return m
}
// FieldseekerSync has methods that act as mods for the FieldseekerSyncTemplate
var FieldseekerSyncMods fieldseekerSyncMods
type fieldseekerSyncMods struct{}
func (m fieldseekerSyncMods) RandomizeAllColumns(f *faker.Faker) FieldseekerSyncMod {
return FieldseekerSyncModSlice{
FieldseekerSyncMods.RandomID(f),
FieldseekerSyncMods.RandomCreated(f),
FieldseekerSyncMods.RandomRecordsCreated(f),
FieldseekerSyncMods.RandomRecordsUpdated(f),
FieldseekerSyncMods.RandomRecordsUnchanged(f),
FieldseekerSyncMods.RandomOrganizationID(f),
}
}
// Set the model columns to this value
func (m fieldseekerSyncMods) ID(val int32) FieldseekerSyncMod {
return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) {
o.ID = func() int32 { return val }
})
}
// Set the Column from the function
func (m fieldseekerSyncMods) IDFunc(f func() int32) FieldseekerSyncMod {
return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) {
o.ID = f
})
}
// Clear any values for the column
func (m fieldseekerSyncMods) UnsetID() FieldseekerSyncMod {
return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) {
o.ID = nil
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
func (m fieldseekerSyncMods) RandomID(f *faker.Faker) FieldseekerSyncMod {
return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) {
o.ID = func() int32 {
return random_int32(f)
}
})
}
// Set the model columns to this value
func (m fieldseekerSyncMods) Created(val time.Time) FieldseekerSyncMod {
return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) {
o.Created = func() time.Time { return val }
})
}
// Set the Column from the function
func (m fieldseekerSyncMods) CreatedFunc(f func() time.Time) FieldseekerSyncMod {
return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) {
o.Created = f
})
}
// Clear any values for the column
func (m fieldseekerSyncMods) UnsetCreated() FieldseekerSyncMod {
return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) {
o.Created = nil
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
func (m fieldseekerSyncMods) RandomCreated(f *faker.Faker) FieldseekerSyncMod {
return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) {
o.Created = func() time.Time {
return random_time_Time(f)
}
})
}
// Set the model columns to this value
func (m fieldseekerSyncMods) RecordsCreated(val int32) FieldseekerSyncMod {
return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) {
o.RecordsCreated = func() int32 { return val }
})
}
// Set the Column from the function
func (m fieldseekerSyncMods) RecordsCreatedFunc(f func() int32) FieldseekerSyncMod {
return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) {
o.RecordsCreated = f
})
}
// Clear any values for the column
func (m fieldseekerSyncMods) UnsetRecordsCreated() FieldseekerSyncMod {
return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) {
o.RecordsCreated = nil
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
func (m fieldseekerSyncMods) RandomRecordsCreated(f *faker.Faker) FieldseekerSyncMod {
return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) {
o.RecordsCreated = func() int32 {
return random_int32(f)
}
})
}
// Set the model columns to this value
func (m fieldseekerSyncMods) RecordsUpdated(val int32) FieldseekerSyncMod {
return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) {
o.RecordsUpdated = func() int32 { return val }
})
}
// Set the Column from the function
func (m fieldseekerSyncMods) RecordsUpdatedFunc(f func() int32) FieldseekerSyncMod {
return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) {
o.RecordsUpdated = f
})
}
// Clear any values for the column
func (m fieldseekerSyncMods) UnsetRecordsUpdated() FieldseekerSyncMod {
return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) {
o.RecordsUpdated = nil
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
func (m fieldseekerSyncMods) RandomRecordsUpdated(f *faker.Faker) FieldseekerSyncMod {
return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) {
o.RecordsUpdated = func() int32 {
return random_int32(f)
}
})
}
// Set the model columns to this value
func (m fieldseekerSyncMods) RecordsUnchanged(val int32) FieldseekerSyncMod {
return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) {
o.RecordsUnchanged = func() int32 { return val }
})
}
// Set the Column from the function
func (m fieldseekerSyncMods) RecordsUnchangedFunc(f func() int32) FieldseekerSyncMod {
return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) {
o.RecordsUnchanged = f
})
}
// Clear any values for the column
func (m fieldseekerSyncMods) UnsetRecordsUnchanged() FieldseekerSyncMod {
return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) {
o.RecordsUnchanged = nil
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
func (m fieldseekerSyncMods) RandomRecordsUnchanged(f *faker.Faker) FieldseekerSyncMod {
return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) {
o.RecordsUnchanged = func() int32 {
return random_int32(f)
}
})
}
// Set the model columns to this value
func (m fieldseekerSyncMods) OrganizationID(val int32) FieldseekerSyncMod {
return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) {
o.OrganizationID = func() int32 { return val }
})
}
// Set the Column from the function
func (m fieldseekerSyncMods) OrganizationIDFunc(f func() int32) FieldseekerSyncMod {
return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) {
o.OrganizationID = f
})
}
// Clear any values for the column
func (m fieldseekerSyncMods) UnsetOrganizationID() FieldseekerSyncMod {
return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) {
o.OrganizationID = nil
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
func (m fieldseekerSyncMods) RandomOrganizationID(f *faker.Faker) FieldseekerSyncMod {
return FieldseekerSyncModFunc(func(_ context.Context, o *FieldseekerSyncTemplate) {
o.OrganizationID = func() int32 {
return random_int32(f)
}
})
}
func (m fieldseekerSyncMods) WithParentsCascading() FieldseekerSyncMod {
return FieldseekerSyncModFunc(func(ctx context.Context, o *FieldseekerSyncTemplate) {
if isDone, _ := fieldseekerSyncWithParentsCascadingCtx.Value(ctx); isDone {
return
}
ctx = fieldseekerSyncWithParentsCascadingCtx.WithValue(ctx, true)
{
related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading())
m.WithOrganization(related).Apply(ctx, o)
}
})
}
func (m fieldseekerSyncMods) WithOrganization(rel *OrganizationTemplate) FieldseekerSyncMod {
return FieldseekerSyncModFunc(func(ctx context.Context, o *FieldseekerSyncTemplate) {
o.r.Organization = &fieldseekerSyncROrganizationR{
o: rel,
}
})
}
func (m fieldseekerSyncMods) WithNewOrganization(mods ...OrganizationMod) FieldseekerSyncMod {
return FieldseekerSyncModFunc(func(ctx context.Context, o *FieldseekerSyncTemplate) {
related := o.f.NewOrganizationWithContext(ctx, mods...)
m.WithOrganization(related).Apply(ctx, o)
})
}
func (m fieldseekerSyncMods) WithExistingOrganization(em *models.Organization) FieldseekerSyncMod {
return FieldseekerSyncModFunc(func(ctx context.Context, o *FieldseekerSyncTemplate) {
o.r.Organization = &fieldseekerSyncROrganizationR{
o: o.f.FromExistingOrganization(em),
}
})
}
func (m fieldseekerSyncMods) WithoutOrganization() FieldseekerSyncMod {
return FieldseekerSyncModFunc(func(ctx context.Context, o *FieldseekerSyncTemplate) {
o.r.Organization = nil
})
}

View file

@ -37,7 +37,7 @@ func (mods FSContainerrelateModSlice) Apply(ctx context.Context, n *FSContainerr
// FSContainerrelateTemplate is an object representing the database table.
// all columns are optional and should be set by mods
type FSContainerrelateTemplate struct {
OrganizationID func() null.Val[int32]
OrganizationID func() int32
Containertype func() null.Val[string]
Creationdate func() null.Val[int64]
Creator func() null.Val[string]
@ -83,7 +83,7 @@ func (t FSContainerrelateTemplate) setModelRels(o *models.FSContainerrelate) {
if t.r.Organization != nil {
rel := t.r.Organization.o.Build()
rel.R.FSContainerrelates = append(rel.R.FSContainerrelates, o)
o.OrganizationID = null.From(rel.ID) // h2
o.OrganizationID = rel.ID // h2
o.R.Organization = rel
}
}
@ -95,7 +95,7 @@ func (o FSContainerrelateTemplate) BuildSetter() *models.FSContainerrelateSetter
if o.OrganizationID != nil {
val := o.OrganizationID()
m.OrganizationID = omitnull.FromNull(val)
m.OrganizationID = omit.From(val)
}
if o.Containertype != nil {
val := o.Containertype()
@ -261,6 +261,10 @@ func (o FSContainerrelateTemplate) BuildMany(number int) models.FSContainerrelat
}
func ensureCreatableFSContainerrelate(m *models.FSContainerrelateSetter) {
if !(m.OrganizationID.IsValue()) {
val := random_int32(nil)
m.OrganizationID = omit.From(val)
}
if !(m.Objectid.IsValue()) {
val := random_int32(nil)
m.Objectid = omit.From(val)
@ -273,25 +277,6 @@ func ensureCreatableFSContainerrelate(m *models.FSContainerrelateSetter) {
func (o *FSContainerrelateTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSContainerrelate) error {
var err error
isOrganizationDone, _ := fsContainerrelateRelOrganizationCtx.Value(ctx)
if !isOrganizationDone && o.r.Organization != nil {
ctx = fsContainerrelateRelOrganizationCtx.WithValue(ctx, true)
if o.r.Organization.o.alreadyPersisted {
m.R.Organization = o.r.Organization.o.Build()
} else {
var rel0 *models.Organization
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return err
}
err = m.AttachOrganization(ctx, exec, rel0)
if err != nil {
return err
}
}
}
return err
}
@ -302,11 +287,30 @@ func (o *FSContainerrelateTemplate) Create(ctx context.Context, exec bob.Executo
opt := o.BuildSetter()
ensureCreatableFSContainerrelate(opt)
if o.r.Organization == nil {
FSContainerrelateMods.WithNewOrganization().Apply(ctx, o)
}
var rel0 *models.Organization
if o.r.Organization.o.alreadyPersisted {
rel0 = o.r.Organization.o.Build()
} else {
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return nil, err
}
}
opt.OrganizationID = omit.From(rel0.ID)
m, err := models.FSContainerrelates.Insert(opt).One(ctx, exec)
if err != nil {
return nil, err
}
m.R.Organization = rel0
if err := o.insertOptRels(ctx, exec, m); err != nil {
return nil, err
}
@ -406,14 +410,14 @@ func (m fsContainerrelateMods) RandomizeAllColumns(f *faker.Faker) FSContainerre
}
// Set the model columns to this value
func (m fsContainerrelateMods) OrganizationID(val null.Val[int32]) FSContainerrelateMod {
func (m fsContainerrelateMods) OrganizationID(val int32) FSContainerrelateMod {
return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) {
o.OrganizationID = func() null.Val[int32] { return val }
o.OrganizationID = func() int32 { return val }
})
}
// Set the Column from the function
func (m fsContainerrelateMods) OrganizationIDFunc(f func() null.Val[int32]) FSContainerrelateMod {
func (m fsContainerrelateMods) OrganizationIDFunc(f func() int32) FSContainerrelateMod {
return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) {
o.OrganizationID = f
})
@ -428,32 +432,10 @@ func (m fsContainerrelateMods) UnsetOrganizationID() FSContainerrelateMod {
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m fsContainerrelateMods) RandomOrganizationID(f *faker.Faker) FSContainerrelateMod {
return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fsContainerrelateMods) RandomOrganizationIDNotNull(f *faker.Faker) FSContainerrelateMod {
return FSContainerrelateModFunc(func(_ context.Context, o *FSContainerrelateTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
o.OrganizationID = func() int32 {
return random_int32(f)
}
})
}

View file

@ -37,7 +37,7 @@ func (mods FSFieldscoutinglogModSlice) Apply(ctx context.Context, n *FSFieldscou
// FSFieldscoutinglogTemplate is an object representing the database table.
// all columns are optional and should be set by mods
type FSFieldscoutinglogTemplate struct {
OrganizationID func() null.Val[int32]
OrganizationID func() int32
Creationdate func() null.Val[int64]
Creator func() null.Val[string]
Editdate func() null.Val[int64]
@ -80,7 +80,7 @@ func (t FSFieldscoutinglogTemplate) setModelRels(o *models.FSFieldscoutinglog) {
if t.r.Organization != nil {
rel := t.r.Organization.o.Build()
rel.R.FSFieldscoutinglogs = append(rel.R.FSFieldscoutinglogs, o)
o.OrganizationID = null.From(rel.ID) // h2
o.OrganizationID = rel.ID // h2
o.R.Organization = rel
}
}
@ -92,7 +92,7 @@ func (o FSFieldscoutinglogTemplate) BuildSetter() *models.FSFieldscoutinglogSett
if o.OrganizationID != nil {
val := o.OrganizationID()
m.OrganizationID = omitnull.FromNull(val)
m.OrganizationID = omit.From(val)
}
if o.Creationdate != nil {
val := o.Creationdate()
@ -237,6 +237,10 @@ func (o FSFieldscoutinglogTemplate) BuildMany(number int) models.FSFieldscouting
}
func ensureCreatableFSFieldscoutinglog(m *models.FSFieldscoutinglogSetter) {
if !(m.OrganizationID.IsValue()) {
val := random_int32(nil)
m.OrganizationID = omit.From(val)
}
if !(m.Objectid.IsValue()) {
val := random_int32(nil)
m.Objectid = omit.From(val)
@ -249,25 +253,6 @@ func ensureCreatableFSFieldscoutinglog(m *models.FSFieldscoutinglogSetter) {
func (o *FSFieldscoutinglogTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSFieldscoutinglog) error {
var err error
isOrganizationDone, _ := fsFieldscoutinglogRelOrganizationCtx.Value(ctx)
if !isOrganizationDone && o.r.Organization != nil {
ctx = fsFieldscoutinglogRelOrganizationCtx.WithValue(ctx, true)
if o.r.Organization.o.alreadyPersisted {
m.R.Organization = o.r.Organization.o.Build()
} else {
var rel0 *models.Organization
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return err
}
err = m.AttachOrganization(ctx, exec, rel0)
if err != nil {
return err
}
}
}
return err
}
@ -278,11 +263,30 @@ func (o *FSFieldscoutinglogTemplate) Create(ctx context.Context, exec bob.Execut
opt := o.BuildSetter()
ensureCreatableFSFieldscoutinglog(opt)
if o.r.Organization == nil {
FSFieldscoutinglogMods.WithNewOrganization().Apply(ctx, o)
}
var rel0 *models.Organization
if o.r.Organization.o.alreadyPersisted {
rel0 = o.r.Organization.o.Build()
} else {
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return nil, err
}
}
opt.OrganizationID = omit.From(rel0.ID)
m, err := models.FSFieldscoutinglogs.Insert(opt).One(ctx, exec)
if err != nil {
return nil, err
}
m.R.Organization = rel0
if err := o.insertOptRels(ctx, exec, m); err != nil {
return nil, err
}
@ -379,14 +383,14 @@ func (m fsFieldscoutinglogMods) RandomizeAllColumns(f *faker.Faker) FSFieldscout
}
// Set the model columns to this value
func (m fsFieldscoutinglogMods) OrganizationID(val null.Val[int32]) FSFieldscoutinglogMod {
func (m fsFieldscoutinglogMods) OrganizationID(val int32) FSFieldscoutinglogMod {
return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) {
o.OrganizationID = func() null.Val[int32] { return val }
o.OrganizationID = func() int32 { return val }
})
}
// Set the Column from the function
func (m fsFieldscoutinglogMods) OrganizationIDFunc(f func() null.Val[int32]) FSFieldscoutinglogMod {
func (m fsFieldscoutinglogMods) OrganizationIDFunc(f func() int32) FSFieldscoutinglogMod {
return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) {
o.OrganizationID = f
})
@ -401,32 +405,10 @@ func (m fsFieldscoutinglogMods) UnsetOrganizationID() FSFieldscoutinglogMod {
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m fsFieldscoutinglogMods) RandomOrganizationID(f *faker.Faker) FSFieldscoutinglogMod {
return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fsFieldscoutinglogMods) RandomOrganizationIDNotNull(f *faker.Faker) FSFieldscoutinglogMod {
return FSFieldscoutinglogModFunc(func(_ context.Context, o *FSFieldscoutinglogTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
o.OrganizationID = func() int32 {
return random_int32(f)
}
})
}

View file

@ -37,7 +37,7 @@ func (mods FSHabitatrelateModSlice) Apply(ctx context.Context, n *FSHabitatrelat
// FSHabitatrelateTemplate is an object representing the database table.
// all columns are optional and should be set by mods
type FSHabitatrelateTemplate struct {
OrganizationID func() null.Val[int32]
OrganizationID func() int32
Creationdate func() null.Val[int64]
Creator func() null.Val[string]
Editdate func() null.Val[int64]
@ -81,7 +81,7 @@ func (t FSHabitatrelateTemplate) setModelRels(o *models.FSHabitatrelate) {
if t.r.Organization != nil {
rel := t.r.Organization.o.Build()
rel.R.FSHabitatrelates = append(rel.R.FSHabitatrelates, o)
o.OrganizationID = null.From(rel.ID) // h2
o.OrganizationID = rel.ID // h2
o.R.Organization = rel
}
}
@ -93,7 +93,7 @@ func (o FSHabitatrelateTemplate) BuildSetter() *models.FSHabitatrelateSetter {
if o.OrganizationID != nil {
val := o.OrganizationID()
m.OrganizationID = omitnull.FromNull(val)
m.OrganizationID = omit.From(val)
}
if o.Creationdate != nil {
val := o.Creationdate()
@ -245,6 +245,10 @@ func (o FSHabitatrelateTemplate) BuildMany(number int) models.FSHabitatrelateSli
}
func ensureCreatableFSHabitatrelate(m *models.FSHabitatrelateSetter) {
if !(m.OrganizationID.IsValue()) {
val := random_int32(nil)
m.OrganizationID = omit.From(val)
}
if !(m.Objectid.IsValue()) {
val := random_int32(nil)
m.Objectid = omit.From(val)
@ -257,25 +261,6 @@ func ensureCreatableFSHabitatrelate(m *models.FSHabitatrelateSetter) {
func (o *FSHabitatrelateTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSHabitatrelate) error {
var err error
isOrganizationDone, _ := fsHabitatrelateRelOrganizationCtx.Value(ctx)
if !isOrganizationDone && o.r.Organization != nil {
ctx = fsHabitatrelateRelOrganizationCtx.WithValue(ctx, true)
if o.r.Organization.o.alreadyPersisted {
m.R.Organization = o.r.Organization.o.Build()
} else {
var rel0 *models.Organization
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return err
}
err = m.AttachOrganization(ctx, exec, rel0)
if err != nil {
return err
}
}
}
return err
}
@ -286,11 +271,30 @@ func (o *FSHabitatrelateTemplate) Create(ctx context.Context, exec bob.Executor)
opt := o.BuildSetter()
ensureCreatableFSHabitatrelate(opt)
if o.r.Organization == nil {
FSHabitatrelateMods.WithNewOrganization().Apply(ctx, o)
}
var rel0 *models.Organization
if o.r.Organization.o.alreadyPersisted {
rel0 = o.r.Organization.o.Build()
} else {
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return nil, err
}
}
opt.OrganizationID = omit.From(rel0.ID)
m, err := models.FSHabitatrelates.Insert(opt).One(ctx, exec)
if err != nil {
return nil, err
}
m.R.Organization = rel0
if err := o.insertOptRels(ctx, exec, m); err != nil {
return nil, err
}
@ -388,14 +392,14 @@ func (m fsHabitatrelateMods) RandomizeAllColumns(f *faker.Faker) FSHabitatrelate
}
// Set the model columns to this value
func (m fsHabitatrelateMods) OrganizationID(val null.Val[int32]) FSHabitatrelateMod {
func (m fsHabitatrelateMods) OrganizationID(val int32) FSHabitatrelateMod {
return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) {
o.OrganizationID = func() null.Val[int32] { return val }
o.OrganizationID = func() int32 { return val }
})
}
// Set the Column from the function
func (m fsHabitatrelateMods) OrganizationIDFunc(f func() null.Val[int32]) FSHabitatrelateMod {
func (m fsHabitatrelateMods) OrganizationIDFunc(f func() int32) FSHabitatrelateMod {
return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) {
o.OrganizationID = f
})
@ -410,32 +414,10 @@ func (m fsHabitatrelateMods) UnsetOrganizationID() FSHabitatrelateMod {
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m fsHabitatrelateMods) RandomOrganizationID(f *faker.Faker) FSHabitatrelateMod {
return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fsHabitatrelateMods) RandomOrganizationIDNotNull(f *faker.Faker) FSHabitatrelateMod {
return FSHabitatrelateModFunc(func(_ context.Context, o *FSHabitatrelateTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
o.OrganizationID = func() int32 {
return random_int32(f)
}
})
}

View file

@ -37,7 +37,7 @@ func (mods FSInspectionsampleModSlice) Apply(ctx context.Context, n *FSInspectio
// FSInspectionsampleTemplate is an object representing the database table.
// all columns are optional and should be set by mods
type FSInspectionsampleTemplate struct {
OrganizationID func() null.Val[int32]
OrganizationID func() int32
Creationdate func() null.Val[int64]
Creator func() null.Val[string]
Editdate func() null.Val[int64]
@ -83,7 +83,7 @@ func (t FSInspectionsampleTemplate) setModelRels(o *models.FSInspectionsample) {
if t.r.Organization != nil {
rel := t.r.Organization.o.Build()
rel.R.FSInspectionsamples = append(rel.R.FSInspectionsamples, o)
o.OrganizationID = null.From(rel.ID) // h2
o.OrganizationID = rel.ID // h2
o.R.Organization = rel
}
}
@ -95,7 +95,7 @@ func (o FSInspectionsampleTemplate) BuildSetter() *models.FSInspectionsampleSett
if o.OrganizationID != nil {
val := o.OrganizationID()
m.OrganizationID = omitnull.FromNull(val)
m.OrganizationID = omit.From(val)
}
if o.Creationdate != nil {
val := o.Creationdate()
@ -261,6 +261,10 @@ func (o FSInspectionsampleTemplate) BuildMany(number int) models.FSInspectionsam
}
func ensureCreatableFSInspectionsample(m *models.FSInspectionsampleSetter) {
if !(m.OrganizationID.IsValue()) {
val := random_int32(nil)
m.OrganizationID = omit.From(val)
}
if !(m.Objectid.IsValue()) {
val := random_int32(nil)
m.Objectid = omit.From(val)
@ -273,25 +277,6 @@ func ensureCreatableFSInspectionsample(m *models.FSInspectionsampleSetter) {
func (o *FSInspectionsampleTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSInspectionsample) error {
var err error
isOrganizationDone, _ := fsInspectionsampleRelOrganizationCtx.Value(ctx)
if !isOrganizationDone && o.r.Organization != nil {
ctx = fsInspectionsampleRelOrganizationCtx.WithValue(ctx, true)
if o.r.Organization.o.alreadyPersisted {
m.R.Organization = o.r.Organization.o.Build()
} else {
var rel0 *models.Organization
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return err
}
err = m.AttachOrganization(ctx, exec, rel0)
if err != nil {
return err
}
}
}
return err
}
@ -302,11 +287,30 @@ func (o *FSInspectionsampleTemplate) Create(ctx context.Context, exec bob.Execut
opt := o.BuildSetter()
ensureCreatableFSInspectionsample(opt)
if o.r.Organization == nil {
FSInspectionsampleMods.WithNewOrganization().Apply(ctx, o)
}
var rel0 *models.Organization
if o.r.Organization.o.alreadyPersisted {
rel0 = o.r.Organization.o.Build()
} else {
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return nil, err
}
}
opt.OrganizationID = omit.From(rel0.ID)
m, err := models.FSInspectionsamples.Insert(opt).One(ctx, exec)
if err != nil {
return nil, err
}
m.R.Organization = rel0
if err := o.insertOptRels(ctx, exec, m); err != nil {
return nil, err
}
@ -406,14 +410,14 @@ func (m fsInspectionsampleMods) RandomizeAllColumns(f *faker.Faker) FSInspection
}
// Set the model columns to this value
func (m fsInspectionsampleMods) OrganizationID(val null.Val[int32]) FSInspectionsampleMod {
func (m fsInspectionsampleMods) OrganizationID(val int32) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
o.OrganizationID = func() null.Val[int32] { return val }
o.OrganizationID = func() int32 { return val }
})
}
// Set the Column from the function
func (m fsInspectionsampleMods) OrganizationIDFunc(f func() null.Val[int32]) FSInspectionsampleMod {
func (m fsInspectionsampleMods) OrganizationIDFunc(f func() int32) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
o.OrganizationID = f
})
@ -428,32 +432,10 @@ func (m fsInspectionsampleMods) UnsetOrganizationID() FSInspectionsampleMod {
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m fsInspectionsampleMods) RandomOrganizationID(f *faker.Faker) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fsInspectionsampleMods) RandomOrganizationIDNotNull(f *faker.Faker) FSInspectionsampleMod {
return FSInspectionsampleModFunc(func(_ context.Context, o *FSInspectionsampleTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
o.OrganizationID = func() int32 {
return random_int32(f)
}
})
}

View file

@ -37,7 +37,7 @@ func (mods FSInspectionsampledetailModSlice) Apply(ctx context.Context, n *FSIns
// FSInspectionsampledetailTemplate is an object representing the database table.
// all columns are optional and should be set by mods
type FSInspectionsampledetailTemplate struct {
OrganizationID func() null.Val[int32]
OrganizationID func() int32
Comments func() null.Val[string]
Creationdate func() null.Val[int64]
Creator func() null.Val[string]
@ -94,7 +94,7 @@ func (t FSInspectionsampledetailTemplate) setModelRels(o *models.FSInspectionsam
if t.r.Organization != nil {
rel := t.r.Organization.o.Build()
rel.R.FSInspectionsampledetails = append(rel.R.FSInspectionsampledetails, o)
o.OrganizationID = null.From(rel.ID) // h2
o.OrganizationID = rel.ID // h2
o.R.Organization = rel
}
}
@ -106,7 +106,7 @@ func (o FSInspectionsampledetailTemplate) BuildSetter() *models.FSInspectionsamp
if o.OrganizationID != nil {
val := o.OrganizationID()
m.OrganizationID = omitnull.FromNull(val)
m.OrganizationID = omit.From(val)
}
if o.Comments != nil {
val := o.Comments()
@ -349,6 +349,10 @@ func (o FSInspectionsampledetailTemplate) BuildMany(number int) models.FSInspect
}
func ensureCreatableFSInspectionsampledetail(m *models.FSInspectionsampledetailSetter) {
if !(m.OrganizationID.IsValue()) {
val := random_int32(nil)
m.OrganizationID = omit.From(val)
}
if !(m.Objectid.IsValue()) {
val := random_int32(nil)
m.Objectid = omit.From(val)
@ -361,25 +365,6 @@ func ensureCreatableFSInspectionsampledetail(m *models.FSInspectionsampledetailS
func (o *FSInspectionsampledetailTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSInspectionsampledetail) error {
var err error
isOrganizationDone, _ := fsInspectionsampledetailRelOrganizationCtx.Value(ctx)
if !isOrganizationDone && o.r.Organization != nil {
ctx = fsInspectionsampledetailRelOrganizationCtx.WithValue(ctx, true)
if o.r.Organization.o.alreadyPersisted {
m.R.Organization = o.r.Organization.o.Build()
} else {
var rel0 *models.Organization
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return err
}
err = m.AttachOrganization(ctx, exec, rel0)
if err != nil {
return err
}
}
}
return err
}
@ -390,11 +375,30 @@ func (o *FSInspectionsampledetailTemplate) Create(ctx context.Context, exec bob.
opt := o.BuildSetter()
ensureCreatableFSInspectionsampledetail(opt)
if o.r.Organization == nil {
FSInspectionsampledetailMods.WithNewOrganization().Apply(ctx, o)
}
var rel0 *models.Organization
if o.r.Organization.o.alreadyPersisted {
rel0 = o.r.Organization.o.Build()
} else {
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return nil, err
}
}
opt.OrganizationID = omit.From(rel0.ID)
m, err := models.FSInspectionsampledetails.Insert(opt).One(ctx, exec)
if err != nil {
return nil, err
}
m.R.Organization = rel0
if err := o.insertOptRels(ctx, exec, m); err != nil {
return nil, err
}
@ -505,14 +509,14 @@ func (m fsInspectionsampledetailMods) RandomizeAllColumns(f *faker.Faker) FSInsp
}
// Set the model columns to this value
func (m fsInspectionsampledetailMods) OrganizationID(val null.Val[int32]) FSInspectionsampledetailMod {
func (m fsInspectionsampledetailMods) OrganizationID(val int32) FSInspectionsampledetailMod {
return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) {
o.OrganizationID = func() null.Val[int32] { return val }
o.OrganizationID = func() int32 { return val }
})
}
// Set the Column from the function
func (m fsInspectionsampledetailMods) OrganizationIDFunc(f func() null.Val[int32]) FSInspectionsampledetailMod {
func (m fsInspectionsampledetailMods) OrganizationIDFunc(f func() int32) FSInspectionsampledetailMod {
return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) {
o.OrganizationID = f
})
@ -527,32 +531,10 @@ func (m fsInspectionsampledetailMods) UnsetOrganizationID() FSInspectionsamplede
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m fsInspectionsampledetailMods) RandomOrganizationID(f *faker.Faker) FSInspectionsampledetailMod {
return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fsInspectionsampledetailMods) RandomOrganizationIDNotNull(f *faker.Faker) FSInspectionsampledetailMod {
return FSInspectionsampledetailModFunc(func(_ context.Context, o *FSInspectionsampledetailTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
o.OrganizationID = func() int32 {
return random_int32(f)
}
})
}

View file

@ -37,7 +37,7 @@ func (mods FSLinelocationModSlice) Apply(ctx context.Context, n *FSLinelocationT
// FSLinelocationTemplate is an object representing the database table.
// all columns are optional and should be set by mods
type FSLinelocationTemplate struct {
OrganizationID func() null.Val[int32]
OrganizationID func() int32
Accessdesc func() null.Val[string]
Acres func() null.Val[float64]
Active func() null.Val[int16]
@ -117,7 +117,7 @@ func (t FSLinelocationTemplate) setModelRels(o *models.FSLinelocation) {
if t.r.Organization != nil {
rel := t.r.Organization.o.Build()
rel.R.FSLinelocations = append(rel.R.FSLinelocations, o)
o.OrganizationID = null.From(rel.ID) // h2
o.OrganizationID = rel.ID // h2
o.R.Organization = rel
}
}
@ -129,7 +129,7 @@ func (o FSLinelocationTemplate) BuildSetter() *models.FSLinelocationSetter {
if o.OrganizationID != nil {
val := o.OrganizationID()
m.OrganizationID = omitnull.FromNull(val)
m.OrganizationID = omit.From(val)
}
if o.Accessdesc != nil {
val := o.Accessdesc()
@ -533,6 +533,10 @@ func (o FSLinelocationTemplate) BuildMany(number int) models.FSLinelocationSlice
}
func ensureCreatableFSLinelocation(m *models.FSLinelocationSetter) {
if !(m.OrganizationID.IsValue()) {
val := random_int32(nil)
m.OrganizationID = omit.From(val)
}
if !(m.Objectid.IsValue()) {
val := random_int32(nil)
m.Objectid = omit.From(val)
@ -545,25 +549,6 @@ func ensureCreatableFSLinelocation(m *models.FSLinelocationSetter) {
func (o *FSLinelocationTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSLinelocation) error {
var err error
isOrganizationDone, _ := fsLinelocationRelOrganizationCtx.Value(ctx)
if !isOrganizationDone && o.r.Organization != nil {
ctx = fsLinelocationRelOrganizationCtx.WithValue(ctx, true)
if o.r.Organization.o.alreadyPersisted {
m.R.Organization = o.r.Organization.o.Build()
} else {
var rel0 *models.Organization
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return err
}
err = m.AttachOrganization(ctx, exec, rel0)
if err != nil {
return err
}
}
}
return err
}
@ -574,11 +559,30 @@ func (o *FSLinelocationTemplate) Create(ctx context.Context, exec bob.Executor)
opt := o.BuildSetter()
ensureCreatableFSLinelocation(opt)
if o.r.Organization == nil {
FSLinelocationMods.WithNewOrganization().Apply(ctx, o)
}
var rel0 *models.Organization
if o.r.Organization.o.alreadyPersisted {
rel0 = o.r.Organization.o.Build()
} else {
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return nil, err
}
}
opt.OrganizationID = omit.From(rel0.ID)
m, err := models.FSLinelocations.Insert(opt).One(ctx, exec)
if err != nil {
return nil, err
}
m.R.Organization = rel0
if err := o.insertOptRels(ctx, exec, m); err != nil {
return nil, err
}
@ -712,14 +716,14 @@ func (m fsLinelocationMods) RandomizeAllColumns(f *faker.Faker) FSLinelocationMo
}
// Set the model columns to this value
func (m fsLinelocationMods) OrganizationID(val null.Val[int32]) FSLinelocationMod {
func (m fsLinelocationMods) OrganizationID(val int32) FSLinelocationMod {
return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) {
o.OrganizationID = func() null.Val[int32] { return val }
o.OrganizationID = func() int32 { return val }
})
}
// Set the Column from the function
func (m fsLinelocationMods) OrganizationIDFunc(f func() null.Val[int32]) FSLinelocationMod {
func (m fsLinelocationMods) OrganizationIDFunc(f func() int32) FSLinelocationMod {
return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) {
o.OrganizationID = f
})
@ -734,32 +738,10 @@ func (m fsLinelocationMods) UnsetOrganizationID() FSLinelocationMod {
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m fsLinelocationMods) RandomOrganizationID(f *faker.Faker) FSLinelocationMod {
return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fsLinelocationMods) RandomOrganizationIDNotNull(f *faker.Faker) FSLinelocationMod {
return FSLinelocationModFunc(func(_ context.Context, o *FSLinelocationTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
o.OrganizationID = func() int32 {
return random_int32(f)
}
})
}

View file

@ -37,7 +37,7 @@ func (mods FSLocationtrackingModSlice) Apply(ctx context.Context, n *FSLocationt
// FSLocationtrackingTemplate is an object representing the database table.
// all columns are optional and should be set by mods
type FSLocationtrackingTemplate struct {
OrganizationID func() null.Val[int32]
OrganizationID func() int32
Accuracy func() null.Val[float64]
Creationdate func() null.Val[int64]
Creator func() null.Val[string]
@ -81,7 +81,7 @@ func (t FSLocationtrackingTemplate) setModelRels(o *models.FSLocationtracking) {
if t.r.Organization != nil {
rel := t.r.Organization.o.Build()
rel.R.FSLocationtrackings = append(rel.R.FSLocationtrackings, o)
o.OrganizationID = null.From(rel.ID) // h2
o.OrganizationID = rel.ID // h2
o.R.Organization = rel
}
}
@ -93,7 +93,7 @@ func (o FSLocationtrackingTemplate) BuildSetter() *models.FSLocationtrackingSett
if o.OrganizationID != nil {
val := o.OrganizationID()
m.OrganizationID = omitnull.FromNull(val)
m.OrganizationID = omit.From(val)
}
if o.Accuracy != nil {
val := o.Accuracy()
@ -245,6 +245,10 @@ func (o FSLocationtrackingTemplate) BuildMany(number int) models.FSLocationtrack
}
func ensureCreatableFSLocationtracking(m *models.FSLocationtrackingSetter) {
if !(m.OrganizationID.IsValue()) {
val := random_int32(nil)
m.OrganizationID = omit.From(val)
}
if !(m.Objectid.IsValue()) {
val := random_int32(nil)
m.Objectid = omit.From(val)
@ -257,25 +261,6 @@ func ensureCreatableFSLocationtracking(m *models.FSLocationtrackingSetter) {
func (o *FSLocationtrackingTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSLocationtracking) error {
var err error
isOrganizationDone, _ := fsLocationtrackingRelOrganizationCtx.Value(ctx)
if !isOrganizationDone && o.r.Organization != nil {
ctx = fsLocationtrackingRelOrganizationCtx.WithValue(ctx, true)
if o.r.Organization.o.alreadyPersisted {
m.R.Organization = o.r.Organization.o.Build()
} else {
var rel0 *models.Organization
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return err
}
err = m.AttachOrganization(ctx, exec, rel0)
if err != nil {
return err
}
}
}
return err
}
@ -286,11 +271,30 @@ func (o *FSLocationtrackingTemplate) Create(ctx context.Context, exec bob.Execut
opt := o.BuildSetter()
ensureCreatableFSLocationtracking(opt)
if o.r.Organization == nil {
FSLocationtrackingMods.WithNewOrganization().Apply(ctx, o)
}
var rel0 *models.Organization
if o.r.Organization.o.alreadyPersisted {
rel0 = o.r.Organization.o.Build()
} else {
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return nil, err
}
}
opt.OrganizationID = omit.From(rel0.ID)
m, err := models.FSLocationtrackings.Insert(opt).One(ctx, exec)
if err != nil {
return nil, err
}
m.R.Organization = rel0
if err := o.insertOptRels(ctx, exec, m); err != nil {
return nil, err
}
@ -388,14 +392,14 @@ func (m fsLocationtrackingMods) RandomizeAllColumns(f *faker.Faker) FSLocationtr
}
// Set the model columns to this value
func (m fsLocationtrackingMods) OrganizationID(val null.Val[int32]) FSLocationtrackingMod {
func (m fsLocationtrackingMods) OrganizationID(val int32) FSLocationtrackingMod {
return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) {
o.OrganizationID = func() null.Val[int32] { return val }
o.OrganizationID = func() int32 { return val }
})
}
// Set the Column from the function
func (m fsLocationtrackingMods) OrganizationIDFunc(f func() null.Val[int32]) FSLocationtrackingMod {
func (m fsLocationtrackingMods) OrganizationIDFunc(f func() int32) FSLocationtrackingMod {
return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) {
o.OrganizationID = f
})
@ -410,32 +414,10 @@ func (m fsLocationtrackingMods) UnsetOrganizationID() FSLocationtrackingMod {
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m fsLocationtrackingMods) RandomOrganizationID(f *faker.Faker) FSLocationtrackingMod {
return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fsLocationtrackingMods) RandomOrganizationIDNotNull(f *faker.Faker) FSLocationtrackingMod {
return FSLocationtrackingModFunc(func(_ context.Context, o *FSLocationtrackingTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
o.OrganizationID = func() int32 {
return random_int32(f)
}
})
}

View file

@ -37,7 +37,7 @@ func (mods FSMosquitoinspectionModSlice) Apply(ctx context.Context, n *FSMosquit
// FSMosquitoinspectionTemplate is an object representing the database table.
// all columns are optional and should be set by mods
type FSMosquitoinspectionTemplate struct {
OrganizationID func() null.Val[int32]
OrganizationID func() int32
Actiontaken func() null.Val[string]
Activity func() null.Val[string]
Adultact func() null.Val[string]
@ -126,7 +126,7 @@ func (t FSMosquitoinspectionTemplate) setModelRels(o *models.FSMosquitoinspectio
if t.r.Organization != nil {
rel := t.r.Organization.o.Build()
rel.R.FSMosquitoinspections = append(rel.R.FSMosquitoinspections, o)
o.OrganizationID = null.From(rel.ID) // h2
o.OrganizationID = rel.ID // h2
o.R.Organization = rel
}
}
@ -138,7 +138,7 @@ func (o FSMosquitoinspectionTemplate) BuildSetter() *models.FSMosquitoinspection
if o.OrganizationID != nil {
val := o.OrganizationID()
m.OrganizationID = omitnull.FromNull(val)
m.OrganizationID = omit.From(val)
}
if o.Actiontaken != nil {
val := o.Actiontaken()
@ -605,6 +605,10 @@ func (o FSMosquitoinspectionTemplate) BuildMany(number int) models.FSMosquitoins
}
func ensureCreatableFSMosquitoinspection(m *models.FSMosquitoinspectionSetter) {
if !(m.OrganizationID.IsValue()) {
val := random_int32(nil)
m.OrganizationID = omit.From(val)
}
if !(m.Objectid.IsValue()) {
val := random_int32(nil)
m.Objectid = omit.From(val)
@ -617,25 +621,6 @@ func ensureCreatableFSMosquitoinspection(m *models.FSMosquitoinspectionSetter) {
func (o *FSMosquitoinspectionTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSMosquitoinspection) error {
var err error
isOrganizationDone, _ := fsMosquitoinspectionRelOrganizationCtx.Value(ctx)
if !isOrganizationDone && o.r.Organization != nil {
ctx = fsMosquitoinspectionRelOrganizationCtx.WithValue(ctx, true)
if o.r.Organization.o.alreadyPersisted {
m.R.Organization = o.r.Organization.o.Build()
} else {
var rel0 *models.Organization
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return err
}
err = m.AttachOrganization(ctx, exec, rel0)
if err != nil {
return err
}
}
}
return err
}
@ -646,11 +631,30 @@ func (o *FSMosquitoinspectionTemplate) Create(ctx context.Context, exec bob.Exec
opt := o.BuildSetter()
ensureCreatableFSMosquitoinspection(opt)
if o.r.Organization == nil {
FSMosquitoinspectionMods.WithNewOrganization().Apply(ctx, o)
}
var rel0 *models.Organization
if o.r.Organization.o.alreadyPersisted {
rel0 = o.r.Organization.o.Build()
} else {
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return nil, err
}
}
opt.OrganizationID = omit.From(rel0.ID)
m, err := models.FSMosquitoinspections.Insert(opt).One(ctx, exec)
if err != nil {
return nil, err
}
m.R.Organization = rel0
if err := o.insertOptRels(ctx, exec, m); err != nil {
return nil, err
}
@ -793,14 +797,14 @@ func (m fsMosquitoinspectionMods) RandomizeAllColumns(f *faker.Faker) FSMosquito
}
// Set the model columns to this value
func (m fsMosquitoinspectionMods) OrganizationID(val null.Val[int32]) FSMosquitoinspectionMod {
func (m fsMosquitoinspectionMods) OrganizationID(val int32) FSMosquitoinspectionMod {
return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) {
o.OrganizationID = func() null.Val[int32] { return val }
o.OrganizationID = func() int32 { return val }
})
}
// Set the Column from the function
func (m fsMosquitoinspectionMods) OrganizationIDFunc(f func() null.Val[int32]) FSMosquitoinspectionMod {
func (m fsMosquitoinspectionMods) OrganizationIDFunc(f func() int32) FSMosquitoinspectionMod {
return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) {
o.OrganizationID = f
})
@ -815,32 +819,10 @@ func (m fsMosquitoinspectionMods) UnsetOrganizationID() FSMosquitoinspectionMod
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m fsMosquitoinspectionMods) RandomOrganizationID(f *faker.Faker) FSMosquitoinspectionMod {
return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fsMosquitoinspectionMods) RandomOrganizationIDNotNull(f *faker.Faker) FSMosquitoinspectionMod {
return FSMosquitoinspectionModFunc(func(_ context.Context, o *FSMosquitoinspectionTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
o.OrganizationID = func() int32 {
return random_int32(f)
}
})
}

View file

@ -37,7 +37,7 @@ func (mods FSPointlocationModSlice) Apply(ctx context.Context, n *FSPointlocatio
// FSPointlocationTemplate is an object representing the database table.
// all columns are optional and should be set by mods
type FSPointlocationTemplate struct {
OrganizationID func() null.Val[int32]
OrganizationID func() int32
Accessdesc func() null.Val[string]
Active func() null.Val[int16]
Comments func() null.Val[string]
@ -113,7 +113,7 @@ func (t FSPointlocationTemplate) setModelRels(o *models.FSPointlocation) {
if t.r.Organization != nil {
rel := t.r.Organization.o.Build()
rel.R.FSPointlocations = append(rel.R.FSPointlocations, o)
o.OrganizationID = null.From(rel.ID) // h2
o.OrganizationID = rel.ID // h2
o.R.Organization = rel
}
}
@ -125,7 +125,7 @@ func (o FSPointlocationTemplate) BuildSetter() *models.FSPointlocationSetter {
if o.OrganizationID != nil {
val := o.OrganizationID()
m.OrganizationID = omitnull.FromNull(val)
m.OrganizationID = omit.From(val)
}
if o.Accessdesc != nil {
val := o.Accessdesc()
@ -501,6 +501,10 @@ func (o FSPointlocationTemplate) BuildMany(number int) models.FSPointlocationSli
}
func ensureCreatableFSPointlocation(m *models.FSPointlocationSetter) {
if !(m.OrganizationID.IsValue()) {
val := random_int32(nil)
m.OrganizationID = omit.From(val)
}
if !(m.Objectid.IsValue()) {
val := random_int32(nil)
m.Objectid = omit.From(val)
@ -513,25 +517,6 @@ func ensureCreatableFSPointlocation(m *models.FSPointlocationSetter) {
func (o *FSPointlocationTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSPointlocation) error {
var err error
isOrganizationDone, _ := fsPointlocationRelOrganizationCtx.Value(ctx)
if !isOrganizationDone && o.r.Organization != nil {
ctx = fsPointlocationRelOrganizationCtx.WithValue(ctx, true)
if o.r.Organization.o.alreadyPersisted {
m.R.Organization = o.r.Organization.o.Build()
} else {
var rel0 *models.Organization
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return err
}
err = m.AttachOrganization(ctx, exec, rel0)
if err != nil {
return err
}
}
}
return err
}
@ -542,11 +527,30 @@ func (o *FSPointlocationTemplate) Create(ctx context.Context, exec bob.Executor)
opt := o.BuildSetter()
ensureCreatableFSPointlocation(opt)
if o.r.Organization == nil {
FSPointlocationMods.WithNewOrganization().Apply(ctx, o)
}
var rel0 *models.Organization
if o.r.Organization.o.alreadyPersisted {
rel0 = o.r.Organization.o.Build()
} else {
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return nil, err
}
}
opt.OrganizationID = omit.From(rel0.ID)
m, err := models.FSPointlocations.Insert(opt).One(ctx, exec)
if err != nil {
return nil, err
}
m.R.Organization = rel0
if err := o.insertOptRels(ctx, exec, m); err != nil {
return nil, err
}
@ -676,14 +680,14 @@ func (m fsPointlocationMods) RandomizeAllColumns(f *faker.Faker) FSPointlocation
}
// Set the model columns to this value
func (m fsPointlocationMods) OrganizationID(val null.Val[int32]) FSPointlocationMod {
func (m fsPointlocationMods) OrganizationID(val int32) FSPointlocationMod {
return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) {
o.OrganizationID = func() null.Val[int32] { return val }
o.OrganizationID = func() int32 { return val }
})
}
// Set the Column from the function
func (m fsPointlocationMods) OrganizationIDFunc(f func() null.Val[int32]) FSPointlocationMod {
func (m fsPointlocationMods) OrganizationIDFunc(f func() int32) FSPointlocationMod {
return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) {
o.OrganizationID = f
})
@ -698,32 +702,10 @@ func (m fsPointlocationMods) UnsetOrganizationID() FSPointlocationMod {
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m fsPointlocationMods) RandomOrganizationID(f *faker.Faker) FSPointlocationMod {
return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fsPointlocationMods) RandomOrganizationIDNotNull(f *faker.Faker) FSPointlocationMod {
return FSPointlocationModFunc(func(_ context.Context, o *FSPointlocationTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
o.OrganizationID = func() int32 {
return random_int32(f)
}
})
}

View file

@ -37,7 +37,7 @@ func (mods FSPolygonlocationModSlice) Apply(ctx context.Context, n *FSPolygonloc
// FSPolygonlocationTemplate is an object representing the database table.
// all columns are optional and should be set by mods
type FSPolygonlocationTemplate struct {
OrganizationID func() null.Val[int32]
OrganizationID func() int32
Accessdesc func() null.Val[string]
Acres func() null.Val[float64]
Active func() null.Val[int16]
@ -111,7 +111,7 @@ func (t FSPolygonlocationTemplate) setModelRels(o *models.FSPolygonlocation) {
if t.r.Organization != nil {
rel := t.r.Organization.o.Build()
rel.R.FSPolygonlocations = append(rel.R.FSPolygonlocations, o)
o.OrganizationID = null.From(rel.ID) // h2
o.OrganizationID = rel.ID // h2
o.R.Organization = rel
}
}
@ -123,7 +123,7 @@ func (o FSPolygonlocationTemplate) BuildSetter() *models.FSPolygonlocationSetter
if o.OrganizationID != nil {
val := o.OrganizationID()
m.OrganizationID = omitnull.FromNull(val)
m.OrganizationID = omit.From(val)
}
if o.Accessdesc != nil {
val := o.Accessdesc()
@ -485,6 +485,10 @@ func (o FSPolygonlocationTemplate) BuildMany(number int) models.FSPolygonlocatio
}
func ensureCreatableFSPolygonlocation(m *models.FSPolygonlocationSetter) {
if !(m.OrganizationID.IsValue()) {
val := random_int32(nil)
m.OrganizationID = omit.From(val)
}
if !(m.Objectid.IsValue()) {
val := random_int32(nil)
m.Objectid = omit.From(val)
@ -497,25 +501,6 @@ func ensureCreatableFSPolygonlocation(m *models.FSPolygonlocationSetter) {
func (o *FSPolygonlocationTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSPolygonlocation) error {
var err error
isOrganizationDone, _ := fsPolygonlocationRelOrganizationCtx.Value(ctx)
if !isOrganizationDone && o.r.Organization != nil {
ctx = fsPolygonlocationRelOrganizationCtx.WithValue(ctx, true)
if o.r.Organization.o.alreadyPersisted {
m.R.Organization = o.r.Organization.o.Build()
} else {
var rel0 *models.Organization
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return err
}
err = m.AttachOrganization(ctx, exec, rel0)
if err != nil {
return err
}
}
}
return err
}
@ -526,11 +511,30 @@ func (o *FSPolygonlocationTemplate) Create(ctx context.Context, exec bob.Executo
opt := o.BuildSetter()
ensureCreatableFSPolygonlocation(opt)
if o.r.Organization == nil {
FSPolygonlocationMods.WithNewOrganization().Apply(ctx, o)
}
var rel0 *models.Organization
if o.r.Organization.o.alreadyPersisted {
rel0 = o.r.Organization.o.Build()
} else {
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return nil, err
}
}
opt.OrganizationID = omit.From(rel0.ID)
m, err := models.FSPolygonlocations.Insert(opt).One(ctx, exec)
if err != nil {
return nil, err
}
m.R.Organization = rel0
if err := o.insertOptRels(ctx, exec, m); err != nil {
return nil, err
}
@ -658,14 +662,14 @@ func (m fsPolygonlocationMods) RandomizeAllColumns(f *faker.Faker) FSPolygonloca
}
// Set the model columns to this value
func (m fsPolygonlocationMods) OrganizationID(val null.Val[int32]) FSPolygonlocationMod {
func (m fsPolygonlocationMods) OrganizationID(val int32) FSPolygonlocationMod {
return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) {
o.OrganizationID = func() null.Val[int32] { return val }
o.OrganizationID = func() int32 { return val }
})
}
// Set the Column from the function
func (m fsPolygonlocationMods) OrganizationIDFunc(f func() null.Val[int32]) FSPolygonlocationMod {
func (m fsPolygonlocationMods) OrganizationIDFunc(f func() int32) FSPolygonlocationMod {
return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) {
o.OrganizationID = f
})
@ -680,32 +684,10 @@ func (m fsPolygonlocationMods) UnsetOrganizationID() FSPolygonlocationMod {
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m fsPolygonlocationMods) RandomOrganizationID(f *faker.Faker) FSPolygonlocationMod {
return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fsPolygonlocationMods) RandomOrganizationIDNotNull(f *faker.Faker) FSPolygonlocationMod {
return FSPolygonlocationModFunc(func(_ context.Context, o *FSPolygonlocationTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
o.OrganizationID = func() int32 {
return random_int32(f)
}
})
}

View file

@ -37,7 +37,7 @@ func (mods FSPoolModSlice) Apply(ctx context.Context, n *FSPoolTemplate) {
// FSPoolTemplate is an object representing the database table.
// all columns are optional and should be set by mods
type FSPoolTemplate struct {
OrganizationID func() null.Val[int32]
OrganizationID func() int32
Comments func() null.Val[string]
Creationdate func() null.Val[int64]
Creator func() null.Val[string]
@ -97,7 +97,7 @@ func (t FSPoolTemplate) setModelRels(o *models.FSPool) {
if t.r.Organization != nil {
rel := t.r.Organization.o.Build()
rel.R.FSPools = append(rel.R.FSPools, o)
o.OrganizationID = null.From(rel.ID) // h2
o.OrganizationID = rel.ID // h2
o.R.Organization = rel
}
}
@ -109,7 +109,7 @@ func (o FSPoolTemplate) BuildSetter() *models.FSPoolSetter {
if o.OrganizationID != nil {
val := o.OrganizationID()
m.OrganizationID = omitnull.FromNull(val)
m.OrganizationID = omit.From(val)
}
if o.Comments != nil {
val := o.Comments()
@ -373,6 +373,10 @@ func (o FSPoolTemplate) BuildMany(number int) models.FSPoolSlice {
}
func ensureCreatableFSPool(m *models.FSPoolSetter) {
if !(m.OrganizationID.IsValue()) {
val := random_int32(nil)
m.OrganizationID = omit.From(val)
}
if !(m.Objectid.IsValue()) {
val := random_int32(nil)
m.Objectid = omit.From(val)
@ -385,25 +389,6 @@ func ensureCreatableFSPool(m *models.FSPoolSetter) {
func (o *FSPoolTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSPool) error {
var err error
isOrganizationDone, _ := fsPoolRelOrganizationCtx.Value(ctx)
if !isOrganizationDone && o.r.Organization != nil {
ctx = fsPoolRelOrganizationCtx.WithValue(ctx, true)
if o.r.Organization.o.alreadyPersisted {
m.R.Organization = o.r.Organization.o.Build()
} else {
var rel0 *models.Organization
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return err
}
err = m.AttachOrganization(ctx, exec, rel0)
if err != nil {
return err
}
}
}
return err
}
@ -414,11 +399,30 @@ func (o *FSPoolTemplate) Create(ctx context.Context, exec bob.Executor) (*models
opt := o.BuildSetter()
ensureCreatableFSPool(opt)
if o.r.Organization == nil {
FSPoolMods.WithNewOrganization().Apply(ctx, o)
}
var rel0 *models.Organization
if o.r.Organization.o.alreadyPersisted {
rel0 = o.r.Organization.o.Build()
} else {
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return nil, err
}
}
opt.OrganizationID = omit.From(rel0.ID)
m, err := models.FSPools.Insert(opt).One(ctx, exec)
if err != nil {
return nil, err
}
m.R.Organization = rel0
if err := o.insertOptRels(ctx, exec, m); err != nil {
return nil, err
}
@ -532,14 +536,14 @@ func (m fsPoolMods) RandomizeAllColumns(f *faker.Faker) FSPoolMod {
}
// Set the model columns to this value
func (m fsPoolMods) OrganizationID(val null.Val[int32]) FSPoolMod {
func (m fsPoolMods) OrganizationID(val int32) FSPoolMod {
return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) {
o.OrganizationID = func() null.Val[int32] { return val }
o.OrganizationID = func() int32 { return val }
})
}
// Set the Column from the function
func (m fsPoolMods) OrganizationIDFunc(f func() null.Val[int32]) FSPoolMod {
func (m fsPoolMods) OrganizationIDFunc(f func() int32) FSPoolMod {
return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) {
o.OrganizationID = f
})
@ -554,32 +558,10 @@ func (m fsPoolMods) UnsetOrganizationID() FSPoolMod {
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m fsPoolMods) RandomOrganizationID(f *faker.Faker) FSPoolMod {
return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fsPoolMods) RandomOrganizationIDNotNull(f *faker.Faker) FSPoolMod {
return FSPoolModFunc(func(_ context.Context, o *FSPoolTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
o.OrganizationID = func() int32 {
return random_int32(f)
}
})
}

View file

@ -37,7 +37,7 @@ func (mods FSPooldetailModSlice) Apply(ctx context.Context, n *FSPooldetailTempl
// FSPooldetailTemplate is an object representing the database table.
// all columns are optional and should be set by mods
type FSPooldetailTemplate struct {
OrganizationID func() null.Val[int32]
OrganizationID func() int32
Creationdate func() null.Val[int64]
Creator func() null.Val[string]
Editdate func() null.Val[int64]
@ -83,7 +83,7 @@ func (t FSPooldetailTemplate) setModelRels(o *models.FSPooldetail) {
if t.r.Organization != nil {
rel := t.r.Organization.o.Build()
rel.R.FSPooldetails = append(rel.R.FSPooldetails, o)
o.OrganizationID = null.From(rel.ID) // h2
o.OrganizationID = rel.ID // h2
o.R.Organization = rel
}
}
@ -95,7 +95,7 @@ func (o FSPooldetailTemplate) BuildSetter() *models.FSPooldetailSetter {
if o.OrganizationID != nil {
val := o.OrganizationID()
m.OrganizationID = omitnull.FromNull(val)
m.OrganizationID = omit.From(val)
}
if o.Creationdate != nil {
val := o.Creationdate()
@ -261,6 +261,10 @@ func (o FSPooldetailTemplate) BuildMany(number int) models.FSPooldetailSlice {
}
func ensureCreatableFSPooldetail(m *models.FSPooldetailSetter) {
if !(m.OrganizationID.IsValue()) {
val := random_int32(nil)
m.OrganizationID = omit.From(val)
}
if !(m.Objectid.IsValue()) {
val := random_int32(nil)
m.Objectid = omit.From(val)
@ -273,25 +277,6 @@ func ensureCreatableFSPooldetail(m *models.FSPooldetailSetter) {
func (o *FSPooldetailTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSPooldetail) error {
var err error
isOrganizationDone, _ := fsPooldetailRelOrganizationCtx.Value(ctx)
if !isOrganizationDone && o.r.Organization != nil {
ctx = fsPooldetailRelOrganizationCtx.WithValue(ctx, true)
if o.r.Organization.o.alreadyPersisted {
m.R.Organization = o.r.Organization.o.Build()
} else {
var rel0 *models.Organization
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return err
}
err = m.AttachOrganization(ctx, exec, rel0)
if err != nil {
return err
}
}
}
return err
}
@ -302,11 +287,30 @@ func (o *FSPooldetailTemplate) Create(ctx context.Context, exec bob.Executor) (*
opt := o.BuildSetter()
ensureCreatableFSPooldetail(opt)
if o.r.Organization == nil {
FSPooldetailMods.WithNewOrganization().Apply(ctx, o)
}
var rel0 *models.Organization
if o.r.Organization.o.alreadyPersisted {
rel0 = o.r.Organization.o.Build()
} else {
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return nil, err
}
}
opt.OrganizationID = omit.From(rel0.ID)
m, err := models.FSPooldetails.Insert(opt).One(ctx, exec)
if err != nil {
return nil, err
}
m.R.Organization = rel0
if err := o.insertOptRels(ctx, exec, m); err != nil {
return nil, err
}
@ -406,14 +410,14 @@ func (m fsPooldetailMods) RandomizeAllColumns(f *faker.Faker) FSPooldetailMod {
}
// Set the model columns to this value
func (m fsPooldetailMods) OrganizationID(val null.Val[int32]) FSPooldetailMod {
func (m fsPooldetailMods) OrganizationID(val int32) FSPooldetailMod {
return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) {
o.OrganizationID = func() null.Val[int32] { return val }
o.OrganizationID = func() int32 { return val }
})
}
// Set the Column from the function
func (m fsPooldetailMods) OrganizationIDFunc(f func() null.Val[int32]) FSPooldetailMod {
func (m fsPooldetailMods) OrganizationIDFunc(f func() int32) FSPooldetailMod {
return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) {
o.OrganizationID = f
})
@ -428,32 +432,10 @@ func (m fsPooldetailMods) UnsetOrganizationID() FSPooldetailMod {
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m fsPooldetailMods) RandomOrganizationID(f *faker.Faker) FSPooldetailMod {
return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fsPooldetailMods) RandomOrganizationIDNotNull(f *faker.Faker) FSPooldetailMod {
return FSPooldetailModFunc(func(_ context.Context, o *FSPooldetailTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
o.OrganizationID = func() int32 {
return random_int32(f)
}
})
}

View file

@ -37,7 +37,7 @@ func (mods FSProposedtreatmentareaModSlice) Apply(ctx context.Context, n *FSProp
// FSProposedtreatmentareaTemplate is an object representing the database table.
// all columns are optional and should be set by mods
type FSProposedtreatmentareaTemplate struct {
OrganizationID func() null.Val[int32]
OrganizationID func() int32
Acres func() null.Val[float64]
Comments func() null.Val[string]
Completed func() null.Val[int16]
@ -102,7 +102,7 @@ func (t FSProposedtreatmentareaTemplate) setModelRels(o *models.FSProposedtreatm
if t.r.Organization != nil {
rel := t.r.Organization.o.Build()
rel.R.FSProposedtreatmentareas = append(rel.R.FSProposedtreatmentareas, o)
o.OrganizationID = null.From(rel.ID) // h2
o.OrganizationID = rel.ID // h2
o.R.Organization = rel
}
}
@ -114,7 +114,7 @@ func (o FSProposedtreatmentareaTemplate) BuildSetter() *models.FSProposedtreatme
if o.OrganizationID != nil {
val := o.OrganizationID()
m.OrganizationID = omitnull.FromNull(val)
m.OrganizationID = omit.From(val)
}
if o.Acres != nil {
val := o.Acres()
@ -413,6 +413,10 @@ func (o FSProposedtreatmentareaTemplate) BuildMany(number int) models.FSProposed
}
func ensureCreatableFSProposedtreatmentarea(m *models.FSProposedtreatmentareaSetter) {
if !(m.OrganizationID.IsValue()) {
val := random_int32(nil)
m.OrganizationID = omit.From(val)
}
if !(m.Objectid.IsValue()) {
val := random_int32(nil)
m.Objectid = omit.From(val)
@ -425,25 +429,6 @@ func ensureCreatableFSProposedtreatmentarea(m *models.FSProposedtreatmentareaSet
func (o *FSProposedtreatmentareaTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSProposedtreatmentarea) error {
var err error
isOrganizationDone, _ := fsProposedtreatmentareaRelOrganizationCtx.Value(ctx)
if !isOrganizationDone && o.r.Organization != nil {
ctx = fsProposedtreatmentareaRelOrganizationCtx.WithValue(ctx, true)
if o.r.Organization.o.alreadyPersisted {
m.R.Organization = o.r.Organization.o.Build()
} else {
var rel0 *models.Organization
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return err
}
err = m.AttachOrganization(ctx, exec, rel0)
if err != nil {
return err
}
}
}
return err
}
@ -454,11 +439,30 @@ func (o *FSProposedtreatmentareaTemplate) Create(ctx context.Context, exec bob.E
opt := o.BuildSetter()
ensureCreatableFSProposedtreatmentarea(opt)
if o.r.Organization == nil {
FSProposedtreatmentareaMods.WithNewOrganization().Apply(ctx, o)
}
var rel0 *models.Organization
if o.r.Organization.o.alreadyPersisted {
rel0 = o.r.Organization.o.Build()
} else {
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return nil, err
}
}
opt.OrganizationID = omit.From(rel0.ID)
m, err := models.FSProposedtreatmentareas.Insert(opt).One(ctx, exec)
if err != nil {
return nil, err
}
m.R.Organization = rel0
if err := o.insertOptRels(ctx, exec, m); err != nil {
return nil, err
}
@ -577,14 +581,14 @@ func (m fsProposedtreatmentareaMods) RandomizeAllColumns(f *faker.Faker) FSPropo
}
// Set the model columns to this value
func (m fsProposedtreatmentareaMods) OrganizationID(val null.Val[int32]) FSProposedtreatmentareaMod {
func (m fsProposedtreatmentareaMods) OrganizationID(val int32) FSProposedtreatmentareaMod {
return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) {
o.OrganizationID = func() null.Val[int32] { return val }
o.OrganizationID = func() int32 { return val }
})
}
// Set the Column from the function
func (m fsProposedtreatmentareaMods) OrganizationIDFunc(f func() null.Val[int32]) FSProposedtreatmentareaMod {
func (m fsProposedtreatmentareaMods) OrganizationIDFunc(f func() int32) FSProposedtreatmentareaMod {
return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) {
o.OrganizationID = f
})
@ -599,32 +603,10 @@ func (m fsProposedtreatmentareaMods) UnsetOrganizationID() FSProposedtreatmentar
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m fsProposedtreatmentareaMods) RandomOrganizationID(f *faker.Faker) FSProposedtreatmentareaMod {
return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fsProposedtreatmentareaMods) RandomOrganizationIDNotNull(f *faker.Faker) FSProposedtreatmentareaMod {
return FSProposedtreatmentareaModFunc(func(_ context.Context, o *FSProposedtreatmentareaTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
o.OrganizationID = func() int32 {
return random_int32(f)
}
})
}

View file

@ -37,7 +37,7 @@ func (mods FSQamosquitoinspectionModSlice) Apply(ctx context.Context, n *FSQamos
// FSQamosquitoinspectionTemplate is an object representing the database table.
// all columns are optional and should be set by mods
type FSQamosquitoinspectionTemplate struct {
OrganizationID func() null.Val[int32]
OrganizationID func() int32
Acresbreeding func() null.Val[float64]
Actiontaken func() null.Val[string]
Adultactivity func() null.Val[int16]
@ -131,7 +131,7 @@ func (t FSQamosquitoinspectionTemplate) setModelRels(o *models.FSQamosquitoinspe
if t.r.Organization != nil {
rel := t.r.Organization.o.Build()
rel.R.FSQamosquitoinspections = append(rel.R.FSQamosquitoinspections, o)
o.OrganizationID = null.From(rel.ID) // h2
o.OrganizationID = rel.ID // h2
o.R.Organization = rel
}
}
@ -143,7 +143,7 @@ func (o FSQamosquitoinspectionTemplate) BuildSetter() *models.FSQamosquitoinspec
if o.OrganizationID != nil {
val := o.OrganizationID()
m.OrganizationID = omitnull.FromNull(val)
m.OrganizationID = omit.From(val)
}
if o.Acresbreeding != nil {
val := o.Acresbreeding()
@ -645,6 +645,10 @@ func (o FSQamosquitoinspectionTemplate) BuildMany(number int) models.FSQamosquit
}
func ensureCreatableFSQamosquitoinspection(m *models.FSQamosquitoinspectionSetter) {
if !(m.OrganizationID.IsValue()) {
val := random_int32(nil)
m.OrganizationID = omit.From(val)
}
if !(m.Objectid.IsValue()) {
val := random_int32(nil)
m.Objectid = omit.From(val)
@ -657,25 +661,6 @@ func ensureCreatableFSQamosquitoinspection(m *models.FSQamosquitoinspectionSette
func (o *FSQamosquitoinspectionTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSQamosquitoinspection) error {
var err error
isOrganizationDone, _ := fsQamosquitoinspectionRelOrganizationCtx.Value(ctx)
if !isOrganizationDone && o.r.Organization != nil {
ctx = fsQamosquitoinspectionRelOrganizationCtx.WithValue(ctx, true)
if o.r.Organization.o.alreadyPersisted {
m.R.Organization = o.r.Organization.o.Build()
} else {
var rel0 *models.Organization
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return err
}
err = m.AttachOrganization(ctx, exec, rel0)
if err != nil {
return err
}
}
}
return err
}
@ -686,11 +671,30 @@ func (o *FSQamosquitoinspectionTemplate) Create(ctx context.Context, exec bob.Ex
opt := o.BuildSetter()
ensureCreatableFSQamosquitoinspection(opt)
if o.r.Organization == nil {
FSQamosquitoinspectionMods.WithNewOrganization().Apply(ctx, o)
}
var rel0 *models.Organization
if o.r.Organization.o.alreadyPersisted {
rel0 = o.r.Organization.o.Build()
} else {
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return nil, err
}
}
opt.OrganizationID = omit.From(rel0.ID)
m, err := models.FSQamosquitoinspections.Insert(opt).One(ctx, exec)
if err != nil {
return nil, err
}
m.R.Organization = rel0
if err := o.insertOptRels(ctx, exec, m); err != nil {
return nil, err
}
@ -838,14 +842,14 @@ func (m fsQamosquitoinspectionMods) RandomizeAllColumns(f *faker.Faker) FSQamosq
}
// Set the model columns to this value
func (m fsQamosquitoinspectionMods) OrganizationID(val null.Val[int32]) FSQamosquitoinspectionMod {
func (m fsQamosquitoinspectionMods) OrganizationID(val int32) FSQamosquitoinspectionMod {
return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) {
o.OrganizationID = func() null.Val[int32] { return val }
o.OrganizationID = func() int32 { return val }
})
}
// Set the Column from the function
func (m fsQamosquitoinspectionMods) OrganizationIDFunc(f func() null.Val[int32]) FSQamosquitoinspectionMod {
func (m fsQamosquitoinspectionMods) OrganizationIDFunc(f func() int32) FSQamosquitoinspectionMod {
return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) {
o.OrganizationID = f
})
@ -860,32 +864,10 @@ func (m fsQamosquitoinspectionMods) UnsetOrganizationID() FSQamosquitoinspection
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m fsQamosquitoinspectionMods) RandomOrganizationID(f *faker.Faker) FSQamosquitoinspectionMod {
return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fsQamosquitoinspectionMods) RandomOrganizationIDNotNull(f *faker.Faker) FSQamosquitoinspectionMod {
return FSQamosquitoinspectionModFunc(func(_ context.Context, o *FSQamosquitoinspectionTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
o.OrganizationID = func() int32 {
return random_int32(f)
}
})
}

View file

@ -37,7 +37,7 @@ func (mods FSRodentlocationModSlice) Apply(ctx context.Context, n *FSRodentlocat
// FSRodentlocationTemplate is an object representing the database table.
// all columns are optional and should be set by mods
type FSRodentlocationTemplate struct {
OrganizationID func() null.Val[int32]
OrganizationID func() int32
Accessdesc func() null.Val[string]
Active func() null.Val[int16]
Comments func() null.Val[string]
@ -99,7 +99,7 @@ func (t FSRodentlocationTemplate) setModelRels(o *models.FSRodentlocation) {
if t.r.Organization != nil {
rel := t.r.Organization.o.Build()
rel.R.FSRodentlocations = append(rel.R.FSRodentlocations, o)
o.OrganizationID = null.From(rel.ID) // h2
o.OrganizationID = rel.ID // h2
o.R.Organization = rel
}
}
@ -111,7 +111,7 @@ func (o FSRodentlocationTemplate) BuildSetter() *models.FSRodentlocationSetter {
if o.OrganizationID != nil {
val := o.OrganizationID()
m.OrganizationID = omitnull.FromNull(val)
m.OrganizationID = omit.From(val)
}
if o.Accessdesc != nil {
val := o.Accessdesc()
@ -389,6 +389,10 @@ func (o FSRodentlocationTemplate) BuildMany(number int) models.FSRodentlocationS
}
func ensureCreatableFSRodentlocation(m *models.FSRodentlocationSetter) {
if !(m.OrganizationID.IsValue()) {
val := random_int32(nil)
m.OrganizationID = omit.From(val)
}
if !(m.Objectid.IsValue()) {
val := random_int32(nil)
m.Objectid = omit.From(val)
@ -401,25 +405,6 @@ func ensureCreatableFSRodentlocation(m *models.FSRodentlocationSetter) {
func (o *FSRodentlocationTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSRodentlocation) error {
var err error
isOrganizationDone, _ := fsRodentlocationRelOrganizationCtx.Value(ctx)
if !isOrganizationDone && o.r.Organization != nil {
ctx = fsRodentlocationRelOrganizationCtx.WithValue(ctx, true)
if o.r.Organization.o.alreadyPersisted {
m.R.Organization = o.r.Organization.o.Build()
} else {
var rel0 *models.Organization
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return err
}
err = m.AttachOrganization(ctx, exec, rel0)
if err != nil {
return err
}
}
}
return err
}
@ -430,11 +415,30 @@ func (o *FSRodentlocationTemplate) Create(ctx context.Context, exec bob.Executor
opt := o.BuildSetter()
ensureCreatableFSRodentlocation(opt)
if o.r.Organization == nil {
FSRodentlocationMods.WithNewOrganization().Apply(ctx, o)
}
var rel0 *models.Organization
if o.r.Organization.o.alreadyPersisted {
rel0 = o.r.Organization.o.Build()
} else {
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return nil, err
}
}
opt.OrganizationID = omit.From(rel0.ID)
m, err := models.FSRodentlocations.Insert(opt).One(ctx, exec)
if err != nil {
return nil, err
}
m.R.Organization = rel0
if err := o.insertOptRels(ctx, exec, m); err != nil {
return nil, err
}
@ -550,14 +554,14 @@ func (m fsRodentlocationMods) RandomizeAllColumns(f *faker.Faker) FSRodentlocati
}
// Set the model columns to this value
func (m fsRodentlocationMods) OrganizationID(val null.Val[int32]) FSRodentlocationMod {
func (m fsRodentlocationMods) OrganizationID(val int32) FSRodentlocationMod {
return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) {
o.OrganizationID = func() null.Val[int32] { return val }
o.OrganizationID = func() int32 { return val }
})
}
// Set the Column from the function
func (m fsRodentlocationMods) OrganizationIDFunc(f func() null.Val[int32]) FSRodentlocationMod {
func (m fsRodentlocationMods) OrganizationIDFunc(f func() int32) FSRodentlocationMod {
return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) {
o.OrganizationID = f
})
@ -572,32 +576,10 @@ func (m fsRodentlocationMods) UnsetOrganizationID() FSRodentlocationMod {
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m fsRodentlocationMods) RandomOrganizationID(f *faker.Faker) FSRodentlocationMod {
return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fsRodentlocationMods) RandomOrganizationIDNotNull(f *faker.Faker) FSRodentlocationMod {
return FSRodentlocationModFunc(func(_ context.Context, o *FSRodentlocationTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
o.OrganizationID = func() int32 {
return random_int32(f)
}
})
}

View file

@ -37,7 +37,7 @@ func (mods FSSamplecollectionModSlice) Apply(ctx context.Context, n *FSSamplecol
// FSSamplecollectionTemplate is an object representing the database table.
// all columns are optional and should be set by mods
type FSSamplecollectionTemplate struct {
OrganizationID func() null.Val[int32]
OrganizationID func() int32
Activity func() null.Val[string]
Avetemp func() null.Val[float64]
Chickenid func() null.Val[string]
@ -115,7 +115,7 @@ func (t FSSamplecollectionTemplate) setModelRels(o *models.FSSamplecollection) {
if t.r.Organization != nil {
rel := t.r.Organization.o.Build()
rel.R.FSSamplecollections = append(rel.R.FSSamplecollections, o)
o.OrganizationID = null.From(rel.ID) // h2
o.OrganizationID = rel.ID // h2
o.R.Organization = rel
}
}
@ -127,7 +127,7 @@ func (o FSSamplecollectionTemplate) BuildSetter() *models.FSSamplecollectionSett
if o.OrganizationID != nil {
val := o.OrganizationID()
m.OrganizationID = omitnull.FromNull(val)
m.OrganizationID = omit.From(val)
}
if o.Activity != nil {
val := o.Activity()
@ -517,6 +517,10 @@ func (o FSSamplecollectionTemplate) BuildMany(number int) models.FSSamplecollect
}
func ensureCreatableFSSamplecollection(m *models.FSSamplecollectionSetter) {
if !(m.OrganizationID.IsValue()) {
val := random_int32(nil)
m.OrganizationID = omit.From(val)
}
if !(m.Objectid.IsValue()) {
val := random_int32(nil)
m.Objectid = omit.From(val)
@ -529,25 +533,6 @@ func ensureCreatableFSSamplecollection(m *models.FSSamplecollectionSetter) {
func (o *FSSamplecollectionTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSSamplecollection) error {
var err error
isOrganizationDone, _ := fsSamplecollectionRelOrganizationCtx.Value(ctx)
if !isOrganizationDone && o.r.Organization != nil {
ctx = fsSamplecollectionRelOrganizationCtx.WithValue(ctx, true)
if o.r.Organization.o.alreadyPersisted {
m.R.Organization = o.r.Organization.o.Build()
} else {
var rel0 *models.Organization
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return err
}
err = m.AttachOrganization(ctx, exec, rel0)
if err != nil {
return err
}
}
}
return err
}
@ -558,11 +543,30 @@ func (o *FSSamplecollectionTemplate) Create(ctx context.Context, exec bob.Execut
opt := o.BuildSetter()
ensureCreatableFSSamplecollection(opt)
if o.r.Organization == nil {
FSSamplecollectionMods.WithNewOrganization().Apply(ctx, o)
}
var rel0 *models.Organization
if o.r.Organization.o.alreadyPersisted {
rel0 = o.r.Organization.o.Build()
} else {
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return nil, err
}
}
opt.OrganizationID = omit.From(rel0.ID)
m, err := models.FSSamplecollections.Insert(opt).One(ctx, exec)
if err != nil {
return nil, err
}
m.R.Organization = rel0
if err := o.insertOptRels(ctx, exec, m); err != nil {
return nil, err
}
@ -694,14 +698,14 @@ func (m fsSamplecollectionMods) RandomizeAllColumns(f *faker.Faker) FSSamplecoll
}
// Set the model columns to this value
func (m fsSamplecollectionMods) OrganizationID(val null.Val[int32]) FSSamplecollectionMod {
func (m fsSamplecollectionMods) OrganizationID(val int32) FSSamplecollectionMod {
return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) {
o.OrganizationID = func() null.Val[int32] { return val }
o.OrganizationID = func() int32 { return val }
})
}
// Set the Column from the function
func (m fsSamplecollectionMods) OrganizationIDFunc(f func() null.Val[int32]) FSSamplecollectionMod {
func (m fsSamplecollectionMods) OrganizationIDFunc(f func() int32) FSSamplecollectionMod {
return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) {
o.OrganizationID = f
})
@ -716,32 +720,10 @@ func (m fsSamplecollectionMods) UnsetOrganizationID() FSSamplecollectionMod {
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m fsSamplecollectionMods) RandomOrganizationID(f *faker.Faker) FSSamplecollectionMod {
return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fsSamplecollectionMods) RandomOrganizationIDNotNull(f *faker.Faker) FSSamplecollectionMod {
return FSSamplecollectionModFunc(func(_ context.Context, o *FSSamplecollectionTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
o.OrganizationID = func() int32 {
return random_int32(f)
}
})
}

View file

@ -37,7 +37,7 @@ func (mods FSSamplelocationModSlice) Apply(ctx context.Context, n *FSSamplelocat
// FSSamplelocationTemplate is an object representing the database table.
// all columns are optional and should be set by mods
type FSSamplelocationTemplate struct {
OrganizationID func() null.Val[int32]
OrganizationID func() int32
Accessdesc func() null.Val[string]
Active func() null.Val[int16]
Comments func() null.Val[string]
@ -93,7 +93,7 @@ func (t FSSamplelocationTemplate) setModelRels(o *models.FSSamplelocation) {
if t.r.Organization != nil {
rel := t.r.Organization.o.Build()
rel.R.FSSamplelocations = append(rel.R.FSSamplelocations, o)
o.OrganizationID = null.From(rel.ID) // h2
o.OrganizationID = rel.ID // h2
o.R.Organization = rel
}
}
@ -105,7 +105,7 @@ func (o FSSamplelocationTemplate) BuildSetter() *models.FSSamplelocationSetter {
if o.OrganizationID != nil {
val := o.OrganizationID()
m.OrganizationID = omitnull.FromNull(val)
m.OrganizationID = omit.From(val)
}
if o.Accessdesc != nil {
val := o.Accessdesc()
@ -341,6 +341,10 @@ func (o FSSamplelocationTemplate) BuildMany(number int) models.FSSamplelocationS
}
func ensureCreatableFSSamplelocation(m *models.FSSamplelocationSetter) {
if !(m.OrganizationID.IsValue()) {
val := random_int32(nil)
m.OrganizationID = omit.From(val)
}
if !(m.Objectid.IsValue()) {
val := random_int32(nil)
m.Objectid = omit.From(val)
@ -353,25 +357,6 @@ func ensureCreatableFSSamplelocation(m *models.FSSamplelocationSetter) {
func (o *FSSamplelocationTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSSamplelocation) error {
var err error
isOrganizationDone, _ := fsSamplelocationRelOrganizationCtx.Value(ctx)
if !isOrganizationDone && o.r.Organization != nil {
ctx = fsSamplelocationRelOrganizationCtx.WithValue(ctx, true)
if o.r.Organization.o.alreadyPersisted {
m.R.Organization = o.r.Organization.o.Build()
} else {
var rel0 *models.Organization
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return err
}
err = m.AttachOrganization(ctx, exec, rel0)
if err != nil {
return err
}
}
}
return err
}
@ -382,11 +367,30 @@ func (o *FSSamplelocationTemplate) Create(ctx context.Context, exec bob.Executor
opt := o.BuildSetter()
ensureCreatableFSSamplelocation(opt)
if o.r.Organization == nil {
FSSamplelocationMods.WithNewOrganization().Apply(ctx, o)
}
var rel0 *models.Organization
if o.r.Organization.o.alreadyPersisted {
rel0 = o.r.Organization.o.Build()
} else {
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return nil, err
}
}
opt.OrganizationID = omit.From(rel0.ID)
m, err := models.FSSamplelocations.Insert(opt).One(ctx, exec)
if err != nil {
return nil, err
}
m.R.Organization = rel0
if err := o.insertOptRels(ctx, exec, m); err != nil {
return nil, err
}
@ -496,14 +500,14 @@ func (m fsSamplelocationMods) RandomizeAllColumns(f *faker.Faker) FSSamplelocati
}
// Set the model columns to this value
func (m fsSamplelocationMods) OrganizationID(val null.Val[int32]) FSSamplelocationMod {
func (m fsSamplelocationMods) OrganizationID(val int32) FSSamplelocationMod {
return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) {
o.OrganizationID = func() null.Val[int32] { return val }
o.OrganizationID = func() int32 { return val }
})
}
// Set the Column from the function
func (m fsSamplelocationMods) OrganizationIDFunc(f func() null.Val[int32]) FSSamplelocationMod {
func (m fsSamplelocationMods) OrganizationIDFunc(f func() int32) FSSamplelocationMod {
return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) {
o.OrganizationID = f
})
@ -518,32 +522,10 @@ func (m fsSamplelocationMods) UnsetOrganizationID() FSSamplelocationMod {
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m fsSamplelocationMods) RandomOrganizationID(f *faker.Faker) FSSamplelocationMod {
return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fsSamplelocationMods) RandomOrganizationIDNotNull(f *faker.Faker) FSSamplelocationMod {
return FSSamplelocationModFunc(func(_ context.Context, o *FSSamplelocationTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
o.OrganizationID = func() int32 {
return random_int32(f)
}
})
}

View file

@ -37,7 +37,7 @@ func (mods FSServicerequestModSlice) Apply(ctx context.Context, n *FSServicerequ
// FSServicerequestTemplate is an object representing the database table.
// all columns are optional and should be set by mods
type FSServicerequestTemplate struct {
OrganizationID func() null.Val[int32]
OrganizationID func() int32
Accepted func() null.Val[int16]
Acceptedby func() null.Val[string]
Accepteddate func() null.Val[int64]
@ -155,7 +155,7 @@ func (t FSServicerequestTemplate) setModelRels(o *models.FSServicerequest) {
if t.r.Organization != nil {
rel := t.r.Organization.o.Build()
rel.R.FSServicerequests = append(rel.R.FSServicerequests, o)
o.OrganizationID = null.From(rel.ID) // h2
o.OrganizationID = rel.ID // h2
o.R.Organization = rel
}
}
@ -167,7 +167,7 @@ func (o FSServicerequestTemplate) BuildSetter() *models.FSServicerequestSetter {
if o.OrganizationID != nil {
val := o.OrganizationID()
m.OrganizationID = omitnull.FromNull(val)
m.OrganizationID = omit.From(val)
}
if o.Accepted != nil {
val := o.Accepted()
@ -837,6 +837,10 @@ func (o FSServicerequestTemplate) BuildMany(number int) models.FSServicerequestS
}
func ensureCreatableFSServicerequest(m *models.FSServicerequestSetter) {
if !(m.OrganizationID.IsValue()) {
val := random_int32(nil)
m.OrganizationID = omit.From(val)
}
if !(m.Objectid.IsValue()) {
val := random_int32(nil)
m.Objectid = omit.From(val)
@ -849,25 +853,6 @@ func ensureCreatableFSServicerequest(m *models.FSServicerequestSetter) {
func (o *FSServicerequestTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSServicerequest) error {
var err error
isOrganizationDone, _ := fsServicerequestRelOrganizationCtx.Value(ctx)
if !isOrganizationDone && o.r.Organization != nil {
ctx = fsServicerequestRelOrganizationCtx.WithValue(ctx, true)
if o.r.Organization.o.alreadyPersisted {
m.R.Organization = o.r.Organization.o.Build()
} else {
var rel0 *models.Organization
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return err
}
err = m.AttachOrganization(ctx, exec, rel0)
if err != nil {
return err
}
}
}
return err
}
@ -878,11 +863,30 @@ func (o *FSServicerequestTemplate) Create(ctx context.Context, exec bob.Executor
opt := o.BuildSetter()
ensureCreatableFSServicerequest(opt)
if o.r.Organization == nil {
FSServicerequestMods.WithNewOrganization().Apply(ctx, o)
}
var rel0 *models.Organization
if o.r.Organization.o.alreadyPersisted {
rel0 = o.r.Organization.o.Build()
} else {
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return nil, err
}
}
opt.OrganizationID = omit.From(rel0.ID)
m, err := models.FSServicerequests.Insert(opt).One(ctx, exec)
if err != nil {
return nil, err
}
m.R.Organization = rel0
if err := o.insertOptRels(ctx, exec, m); err != nil {
return nil, err
}
@ -1054,14 +1058,14 @@ func (m fsServicerequestMods) RandomizeAllColumns(f *faker.Faker) FSServicereque
}
// Set the model columns to this value
func (m fsServicerequestMods) OrganizationID(val null.Val[int32]) FSServicerequestMod {
func (m fsServicerequestMods) OrganizationID(val int32) FSServicerequestMod {
return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) {
o.OrganizationID = func() null.Val[int32] { return val }
o.OrganizationID = func() int32 { return val }
})
}
// Set the Column from the function
func (m fsServicerequestMods) OrganizationIDFunc(f func() null.Val[int32]) FSServicerequestMod {
func (m fsServicerequestMods) OrganizationIDFunc(f func() int32) FSServicerequestMod {
return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) {
o.OrganizationID = f
})
@ -1076,32 +1080,10 @@ func (m fsServicerequestMods) UnsetOrganizationID() FSServicerequestMod {
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m fsServicerequestMods) RandomOrganizationID(f *faker.Faker) FSServicerequestMod {
return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fsServicerequestMods) RandomOrganizationIDNotNull(f *faker.Faker) FSServicerequestMod {
return FSServicerequestModFunc(func(_ context.Context, o *FSServicerequestTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
o.OrganizationID = func() int32 {
return random_int32(f)
}
})
}

View file

@ -37,7 +37,7 @@ func (mods FSSpeciesabundanceModSlice) Apply(ctx context.Context, n *FSSpeciesab
// FSSpeciesabundanceTemplate is an object representing the database table.
// all columns are optional and should be set by mods
type FSSpeciesabundanceTemplate struct {
OrganizationID func() null.Val[int32]
OrganizationID func() int32
Bloodedfem func() null.Val[int16]
Creationdate func() null.Val[int64]
Creator func() null.Val[string]
@ -98,7 +98,7 @@ func (t FSSpeciesabundanceTemplate) setModelRels(o *models.FSSpeciesabundance) {
if t.r.Organization != nil {
rel := t.r.Organization.o.Build()
rel.R.FSSpeciesabundances = append(rel.R.FSSpeciesabundances, o)
o.OrganizationID = null.From(rel.ID) // h2
o.OrganizationID = rel.ID // h2
o.R.Organization = rel
}
}
@ -110,7 +110,7 @@ func (o FSSpeciesabundanceTemplate) BuildSetter() *models.FSSpeciesabundanceSett
if o.OrganizationID != nil {
val := o.OrganizationID()
m.OrganizationID = omitnull.FromNull(val)
m.OrganizationID = omit.From(val)
}
if o.Bloodedfem != nil {
val := o.Bloodedfem()
@ -381,6 +381,10 @@ func (o FSSpeciesabundanceTemplate) BuildMany(number int) models.FSSpeciesabunda
}
func ensureCreatableFSSpeciesabundance(m *models.FSSpeciesabundanceSetter) {
if !(m.OrganizationID.IsValue()) {
val := random_int32(nil)
m.OrganizationID = omit.From(val)
}
if !(m.Objectid.IsValue()) {
val := random_int32(nil)
m.Objectid = omit.From(val)
@ -393,25 +397,6 @@ func ensureCreatableFSSpeciesabundance(m *models.FSSpeciesabundanceSetter) {
func (o *FSSpeciesabundanceTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSSpeciesabundance) error {
var err error
isOrganizationDone, _ := fsSpeciesabundanceRelOrganizationCtx.Value(ctx)
if !isOrganizationDone && o.r.Organization != nil {
ctx = fsSpeciesabundanceRelOrganizationCtx.WithValue(ctx, true)
if o.r.Organization.o.alreadyPersisted {
m.R.Organization = o.r.Organization.o.Build()
} else {
var rel0 *models.Organization
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return err
}
err = m.AttachOrganization(ctx, exec, rel0)
if err != nil {
return err
}
}
}
return err
}
@ -422,11 +407,30 @@ func (o *FSSpeciesabundanceTemplate) Create(ctx context.Context, exec bob.Execut
opt := o.BuildSetter()
ensureCreatableFSSpeciesabundance(opt)
if o.r.Organization == nil {
FSSpeciesabundanceMods.WithNewOrganization().Apply(ctx, o)
}
var rel0 *models.Organization
if o.r.Organization.o.alreadyPersisted {
rel0 = o.r.Organization.o.Build()
} else {
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return nil, err
}
}
opt.OrganizationID = omit.From(rel0.ID)
m, err := models.FSSpeciesabundances.Insert(opt).One(ctx, exec)
if err != nil {
return nil, err
}
m.R.Organization = rel0
if err := o.insertOptRels(ctx, exec, m); err != nil {
return nil, err
}
@ -541,14 +545,14 @@ func (m fsSpeciesabundanceMods) RandomizeAllColumns(f *faker.Faker) FSSpeciesabu
}
// Set the model columns to this value
func (m fsSpeciesabundanceMods) OrganizationID(val null.Val[int32]) FSSpeciesabundanceMod {
func (m fsSpeciesabundanceMods) OrganizationID(val int32) FSSpeciesabundanceMod {
return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) {
o.OrganizationID = func() null.Val[int32] { return val }
o.OrganizationID = func() int32 { return val }
})
}
// Set the Column from the function
func (m fsSpeciesabundanceMods) OrganizationIDFunc(f func() null.Val[int32]) FSSpeciesabundanceMod {
func (m fsSpeciesabundanceMods) OrganizationIDFunc(f func() int32) FSSpeciesabundanceMod {
return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) {
o.OrganizationID = f
})
@ -563,32 +567,10 @@ func (m fsSpeciesabundanceMods) UnsetOrganizationID() FSSpeciesabundanceMod {
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m fsSpeciesabundanceMods) RandomOrganizationID(f *faker.Faker) FSSpeciesabundanceMod {
return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fsSpeciesabundanceMods) RandomOrganizationIDNotNull(f *faker.Faker) FSSpeciesabundanceMod {
return FSSpeciesabundanceModFunc(func(_ context.Context, o *FSSpeciesabundanceTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
o.OrganizationID = func() int32 {
return random_int32(f)
}
})
}

View file

@ -37,7 +37,7 @@ func (mods FSStormdrainModSlice) Apply(ctx context.Context, n *FSStormdrainTempl
// FSStormdrainTemplate is an object representing the database table.
// all columns are optional and should be set by mods
type FSStormdrainTemplate struct {
OrganizationID func() null.Val[int32]
OrganizationID func() int32
Creationdate func() null.Val[int64]
Creator func() null.Val[string]
Editdate func() null.Val[int64]
@ -88,7 +88,7 @@ func (t FSStormdrainTemplate) setModelRels(o *models.FSStormdrain) {
if t.r.Organization != nil {
rel := t.r.Organization.o.Build()
rel.R.FSStormdrains = append(rel.R.FSStormdrains, o)
o.OrganizationID = null.From(rel.ID) // h2
o.OrganizationID = rel.ID // h2
o.R.Organization = rel
}
}
@ -100,7 +100,7 @@ func (o FSStormdrainTemplate) BuildSetter() *models.FSStormdrainSetter {
if o.OrganizationID != nil {
val := o.OrganizationID()
m.OrganizationID = omitnull.FromNull(val)
m.OrganizationID = omit.From(val)
}
if o.Creationdate != nil {
val := o.Creationdate()
@ -301,6 +301,10 @@ func (o FSStormdrainTemplate) BuildMany(number int) models.FSStormdrainSlice {
}
func ensureCreatableFSStormdrain(m *models.FSStormdrainSetter) {
if !(m.OrganizationID.IsValue()) {
val := random_int32(nil)
m.OrganizationID = omit.From(val)
}
if !(m.Objectid.IsValue()) {
val := random_int32(nil)
m.Objectid = omit.From(val)
@ -313,25 +317,6 @@ func ensureCreatableFSStormdrain(m *models.FSStormdrainSetter) {
func (o *FSStormdrainTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSStormdrain) error {
var err error
isOrganizationDone, _ := fsStormdrainRelOrganizationCtx.Value(ctx)
if !isOrganizationDone && o.r.Organization != nil {
ctx = fsStormdrainRelOrganizationCtx.WithValue(ctx, true)
if o.r.Organization.o.alreadyPersisted {
m.R.Organization = o.r.Organization.o.Build()
} else {
var rel0 *models.Organization
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return err
}
err = m.AttachOrganization(ctx, exec, rel0)
if err != nil {
return err
}
}
}
return err
}
@ -342,11 +327,30 @@ func (o *FSStormdrainTemplate) Create(ctx context.Context, exec bob.Executor) (*
opt := o.BuildSetter()
ensureCreatableFSStormdrain(opt)
if o.r.Organization == nil {
FSStormdrainMods.WithNewOrganization().Apply(ctx, o)
}
var rel0 *models.Organization
if o.r.Organization.o.alreadyPersisted {
rel0 = o.r.Organization.o.Build()
} else {
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return nil, err
}
}
opt.OrganizationID = omit.From(rel0.ID)
m, err := models.FSStormdrains.Insert(opt).One(ctx, exec)
if err != nil {
return nil, err
}
m.R.Organization = rel0
if err := o.insertOptRels(ctx, exec, m); err != nil {
return nil, err
}
@ -451,14 +455,14 @@ func (m fsStormdrainMods) RandomizeAllColumns(f *faker.Faker) FSStormdrainMod {
}
// Set the model columns to this value
func (m fsStormdrainMods) OrganizationID(val null.Val[int32]) FSStormdrainMod {
func (m fsStormdrainMods) OrganizationID(val int32) FSStormdrainMod {
return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) {
o.OrganizationID = func() null.Val[int32] { return val }
o.OrganizationID = func() int32 { return val }
})
}
// Set the Column from the function
func (m fsStormdrainMods) OrganizationIDFunc(f func() null.Val[int32]) FSStormdrainMod {
func (m fsStormdrainMods) OrganizationIDFunc(f func() int32) FSStormdrainMod {
return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) {
o.OrganizationID = f
})
@ -473,32 +477,10 @@ func (m fsStormdrainMods) UnsetOrganizationID() FSStormdrainMod {
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m fsStormdrainMods) RandomOrganizationID(f *faker.Faker) FSStormdrainMod {
return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fsStormdrainMods) RandomOrganizationIDNotNull(f *faker.Faker) FSStormdrainMod {
return FSStormdrainModFunc(func(_ context.Context, o *FSStormdrainTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
o.OrganizationID = func() int32 {
return random_int32(f)
}
})
}

View file

@ -37,7 +37,7 @@ func (mods FSTimecardModSlice) Apply(ctx context.Context, n *FSTimecardTemplate)
// FSTimecardTemplate is an object representing the database table.
// all columns are optional and should be set by mods
type FSTimecardTemplate struct {
OrganizationID func() null.Val[int32]
OrganizationID func() int32
Activity func() null.Val[string]
Comments func() null.Val[string]
Creationdate func() null.Val[int64]
@ -97,7 +97,7 @@ func (t FSTimecardTemplate) setModelRels(o *models.FSTimecard) {
if t.r.Organization != nil {
rel := t.r.Organization.o.Build()
rel.R.FSTimecards = append(rel.R.FSTimecards, o)
o.OrganizationID = null.From(rel.ID) // h2
o.OrganizationID = rel.ID // h2
o.R.Organization = rel
}
}
@ -109,7 +109,7 @@ func (o FSTimecardTemplate) BuildSetter() *models.FSTimecardSetter {
if o.OrganizationID != nil {
val := o.OrganizationID()
m.OrganizationID = omitnull.FromNull(val)
m.OrganizationID = omit.From(val)
}
if o.Activity != nil {
val := o.Activity()
@ -373,6 +373,10 @@ func (o FSTimecardTemplate) BuildMany(number int) models.FSTimecardSlice {
}
func ensureCreatableFSTimecard(m *models.FSTimecardSetter) {
if !(m.OrganizationID.IsValue()) {
val := random_int32(nil)
m.OrganizationID = omit.From(val)
}
if !(m.Objectid.IsValue()) {
val := random_int32(nil)
m.Objectid = omit.From(val)
@ -385,25 +389,6 @@ func ensureCreatableFSTimecard(m *models.FSTimecardSetter) {
func (o *FSTimecardTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSTimecard) error {
var err error
isOrganizationDone, _ := fsTimecardRelOrganizationCtx.Value(ctx)
if !isOrganizationDone && o.r.Organization != nil {
ctx = fsTimecardRelOrganizationCtx.WithValue(ctx, true)
if o.r.Organization.o.alreadyPersisted {
m.R.Organization = o.r.Organization.o.Build()
} else {
var rel0 *models.Organization
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return err
}
err = m.AttachOrganization(ctx, exec, rel0)
if err != nil {
return err
}
}
}
return err
}
@ -414,11 +399,30 @@ func (o *FSTimecardTemplate) Create(ctx context.Context, exec bob.Executor) (*mo
opt := o.BuildSetter()
ensureCreatableFSTimecard(opt)
if o.r.Organization == nil {
FSTimecardMods.WithNewOrganization().Apply(ctx, o)
}
var rel0 *models.Organization
if o.r.Organization.o.alreadyPersisted {
rel0 = o.r.Organization.o.Build()
} else {
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return nil, err
}
}
opt.OrganizationID = omit.From(rel0.ID)
m, err := models.FSTimecards.Insert(opt).One(ctx, exec)
if err != nil {
return nil, err
}
m.R.Organization = rel0
if err := o.insertOptRels(ctx, exec, m); err != nil {
return nil, err
}
@ -532,14 +536,14 @@ func (m fsTimecardMods) RandomizeAllColumns(f *faker.Faker) FSTimecardMod {
}
// Set the model columns to this value
func (m fsTimecardMods) OrganizationID(val null.Val[int32]) FSTimecardMod {
func (m fsTimecardMods) OrganizationID(val int32) FSTimecardMod {
return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) {
o.OrganizationID = func() null.Val[int32] { return val }
o.OrganizationID = func() int32 { return val }
})
}
// Set the Column from the function
func (m fsTimecardMods) OrganizationIDFunc(f func() null.Val[int32]) FSTimecardMod {
func (m fsTimecardMods) OrganizationIDFunc(f func() int32) FSTimecardMod {
return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) {
o.OrganizationID = f
})
@ -554,32 +558,10 @@ func (m fsTimecardMods) UnsetOrganizationID() FSTimecardMod {
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m fsTimecardMods) RandomOrganizationID(f *faker.Faker) FSTimecardMod {
return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fsTimecardMods) RandomOrganizationIDNotNull(f *faker.Faker) FSTimecardMod {
return FSTimecardModFunc(func(_ context.Context, o *FSTimecardTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
o.OrganizationID = func() int32 {
return random_int32(f)
}
})
}

View file

@ -37,7 +37,7 @@ func (mods FSTrapdatumModSlice) Apply(ctx context.Context, n *FSTrapdatumTemplat
// FSTrapdatumTemplate is an object representing the database table.
// all columns are optional and should be set by mods
type FSTrapdatumTemplate struct {
OrganizationID func() null.Val[int32]
OrganizationID func() int32
Avetemp func() null.Val[float64]
Comments func() null.Val[string]
Creationdate func() null.Val[int64]
@ -111,7 +111,7 @@ func (t FSTrapdatumTemplate) setModelRels(o *models.FSTrapdatum) {
if t.r.Organization != nil {
rel := t.r.Organization.o.Build()
rel.R.FSTrapdata = append(rel.R.FSTrapdata, o)
o.OrganizationID = null.From(rel.ID) // h2
o.OrganizationID = rel.ID // h2
o.R.Organization = rel
}
}
@ -123,7 +123,7 @@ func (o FSTrapdatumTemplate) BuildSetter() *models.FSTrapdatumSetter {
if o.OrganizationID != nil {
val := o.OrganizationID()
m.OrganizationID = omitnull.FromNull(val)
m.OrganizationID = omit.From(val)
}
if o.Avetemp != nil {
val := o.Avetemp()
@ -485,6 +485,10 @@ func (o FSTrapdatumTemplate) BuildMany(number int) models.FSTrapdatumSlice {
}
func ensureCreatableFSTrapdatum(m *models.FSTrapdatumSetter) {
if !(m.OrganizationID.IsValue()) {
val := random_int32(nil)
m.OrganizationID = omit.From(val)
}
if !(m.Objectid.IsValue()) {
val := random_int32(nil)
m.Objectid = omit.From(val)
@ -497,25 +501,6 @@ func ensureCreatableFSTrapdatum(m *models.FSTrapdatumSetter) {
func (o *FSTrapdatumTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSTrapdatum) error {
var err error
isOrganizationDone, _ := fsTrapdatumRelOrganizationCtx.Value(ctx)
if !isOrganizationDone && o.r.Organization != nil {
ctx = fsTrapdatumRelOrganizationCtx.WithValue(ctx, true)
if o.r.Organization.o.alreadyPersisted {
m.R.Organization = o.r.Organization.o.Build()
} else {
var rel0 *models.Organization
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return err
}
err = m.AttachOrganization(ctx, exec, rel0)
if err != nil {
return err
}
}
}
return err
}
@ -526,11 +511,30 @@ func (o *FSTrapdatumTemplate) Create(ctx context.Context, exec bob.Executor) (*m
opt := o.BuildSetter()
ensureCreatableFSTrapdatum(opt)
if o.r.Organization == nil {
FSTrapdatumMods.WithNewOrganization().Apply(ctx, o)
}
var rel0 *models.Organization
if o.r.Organization.o.alreadyPersisted {
rel0 = o.r.Organization.o.Build()
} else {
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return nil, err
}
}
opt.OrganizationID = omit.From(rel0.ID)
m, err := models.FSTrapdata.Insert(opt).One(ctx, exec)
if err != nil {
return nil, err
}
m.R.Organization = rel0
if err := o.insertOptRels(ctx, exec, m); err != nil {
return nil, err
}
@ -658,14 +662,14 @@ func (m fsTrapdatumMods) RandomizeAllColumns(f *faker.Faker) FSTrapdatumMod {
}
// Set the model columns to this value
func (m fsTrapdatumMods) OrganizationID(val null.Val[int32]) FSTrapdatumMod {
func (m fsTrapdatumMods) OrganizationID(val int32) FSTrapdatumMod {
return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) {
o.OrganizationID = func() null.Val[int32] { return val }
o.OrganizationID = func() int32 { return val }
})
}
// Set the Column from the function
func (m fsTrapdatumMods) OrganizationIDFunc(f func() null.Val[int32]) FSTrapdatumMod {
func (m fsTrapdatumMods) OrganizationIDFunc(f func() int32) FSTrapdatumMod {
return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) {
o.OrganizationID = f
})
@ -680,32 +684,10 @@ func (m fsTrapdatumMods) UnsetOrganizationID() FSTrapdatumMod {
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m fsTrapdatumMods) RandomOrganizationID(f *faker.Faker) FSTrapdatumMod {
return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fsTrapdatumMods) RandomOrganizationIDNotNull(f *faker.Faker) FSTrapdatumMod {
return FSTrapdatumModFunc(func(_ context.Context, o *FSTrapdatumTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
o.OrganizationID = func() int32 {
return random_int32(f)
}
})
}

View file

@ -37,7 +37,7 @@ func (mods FSTraplocationModSlice) Apply(ctx context.Context, n *FSTraplocationT
// FSTraplocationTemplate is an object representing the database table.
// all columns are optional and should be set by mods
type FSTraplocationTemplate struct {
OrganizationID func() null.Val[int32]
OrganizationID func() int32
Accessdesc func() null.Val[string]
Active func() null.Val[int16]
Comments func() null.Val[string]
@ -99,7 +99,7 @@ func (t FSTraplocationTemplate) setModelRels(o *models.FSTraplocation) {
if t.r.Organization != nil {
rel := t.r.Organization.o.Build()
rel.R.FSTraplocations = append(rel.R.FSTraplocations, o)
o.OrganizationID = null.From(rel.ID) // h2
o.OrganizationID = rel.ID // h2
o.R.Organization = rel
}
}
@ -111,7 +111,7 @@ func (o FSTraplocationTemplate) BuildSetter() *models.FSTraplocationSetter {
if o.OrganizationID != nil {
val := o.OrganizationID()
m.OrganizationID = omitnull.FromNull(val)
m.OrganizationID = omit.From(val)
}
if o.Accessdesc != nil {
val := o.Accessdesc()
@ -389,6 +389,10 @@ func (o FSTraplocationTemplate) BuildMany(number int) models.FSTraplocationSlice
}
func ensureCreatableFSTraplocation(m *models.FSTraplocationSetter) {
if !(m.OrganizationID.IsValue()) {
val := random_int32(nil)
m.OrganizationID = omit.From(val)
}
if !(m.Objectid.IsValue()) {
val := random_int32(nil)
m.Objectid = omit.From(val)
@ -401,25 +405,6 @@ func ensureCreatableFSTraplocation(m *models.FSTraplocationSetter) {
func (o *FSTraplocationTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSTraplocation) error {
var err error
isOrganizationDone, _ := fsTraplocationRelOrganizationCtx.Value(ctx)
if !isOrganizationDone && o.r.Organization != nil {
ctx = fsTraplocationRelOrganizationCtx.WithValue(ctx, true)
if o.r.Organization.o.alreadyPersisted {
m.R.Organization = o.r.Organization.o.Build()
} else {
var rel0 *models.Organization
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return err
}
err = m.AttachOrganization(ctx, exec, rel0)
if err != nil {
return err
}
}
}
return err
}
@ -430,11 +415,30 @@ func (o *FSTraplocationTemplate) Create(ctx context.Context, exec bob.Executor)
opt := o.BuildSetter()
ensureCreatableFSTraplocation(opt)
if o.r.Organization == nil {
FSTraplocationMods.WithNewOrganization().Apply(ctx, o)
}
var rel0 *models.Organization
if o.r.Organization.o.alreadyPersisted {
rel0 = o.r.Organization.o.Build()
} else {
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return nil, err
}
}
opt.OrganizationID = omit.From(rel0.ID)
m, err := models.FSTraplocations.Insert(opt).One(ctx, exec)
if err != nil {
return nil, err
}
m.R.Organization = rel0
if err := o.insertOptRels(ctx, exec, m); err != nil {
return nil, err
}
@ -550,14 +554,14 @@ func (m fsTraplocationMods) RandomizeAllColumns(f *faker.Faker) FSTraplocationMo
}
// Set the model columns to this value
func (m fsTraplocationMods) OrganizationID(val null.Val[int32]) FSTraplocationMod {
func (m fsTraplocationMods) OrganizationID(val int32) FSTraplocationMod {
return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) {
o.OrganizationID = func() null.Val[int32] { return val }
o.OrganizationID = func() int32 { return val }
})
}
// Set the Column from the function
func (m fsTraplocationMods) OrganizationIDFunc(f func() null.Val[int32]) FSTraplocationMod {
func (m fsTraplocationMods) OrganizationIDFunc(f func() int32) FSTraplocationMod {
return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) {
o.OrganizationID = f
})
@ -572,32 +576,10 @@ func (m fsTraplocationMods) UnsetOrganizationID() FSTraplocationMod {
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m fsTraplocationMods) RandomOrganizationID(f *faker.Faker) FSTraplocationMod {
return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fsTraplocationMods) RandomOrganizationIDNotNull(f *faker.Faker) FSTraplocationMod {
return FSTraplocationModFunc(func(_ context.Context, o *FSTraplocationTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
o.OrganizationID = func() int32 {
return random_int32(f)
}
})
}

View file

@ -37,7 +37,7 @@ func (mods FSTreatmentModSlice) Apply(ctx context.Context, n *FSTreatmentTemplat
// FSTreatmentTemplate is an object representing the database table.
// all columns are optional and should be set by mods
type FSTreatmentTemplate struct {
OrganizationID func() null.Val[int32]
OrganizationID func() int32
Activity func() null.Val[string]
Areaunit func() null.Val[string]
Avetemp func() null.Val[float64]
@ -123,7 +123,7 @@ func (t FSTreatmentTemplate) setModelRels(o *models.FSTreatment) {
if t.r.Organization != nil {
rel := t.r.Organization.o.Build()
rel.R.FSTreatments = append(rel.R.FSTreatments, o)
o.OrganizationID = null.From(rel.ID) // h2
o.OrganizationID = rel.ID // h2
o.R.Organization = rel
}
}
@ -135,7 +135,7 @@ func (o FSTreatmentTemplate) BuildSetter() *models.FSTreatmentSetter {
if o.OrganizationID != nil {
val := o.OrganizationID()
m.OrganizationID = omitnull.FromNull(val)
m.OrganizationID = omit.From(val)
}
if o.Activity != nil {
val := o.Activity()
@ -581,6 +581,10 @@ func (o FSTreatmentTemplate) BuildMany(number int) models.FSTreatmentSlice {
}
func ensureCreatableFSTreatment(m *models.FSTreatmentSetter) {
if !(m.OrganizationID.IsValue()) {
val := random_int32(nil)
m.OrganizationID = omit.From(val)
}
if !(m.Objectid.IsValue()) {
val := random_int32(nil)
m.Objectid = omit.From(val)
@ -593,25 +597,6 @@ func ensureCreatableFSTreatment(m *models.FSTreatmentSetter) {
func (o *FSTreatmentTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSTreatment) error {
var err error
isOrganizationDone, _ := fsTreatmentRelOrganizationCtx.Value(ctx)
if !isOrganizationDone && o.r.Organization != nil {
ctx = fsTreatmentRelOrganizationCtx.WithValue(ctx, true)
if o.r.Organization.o.alreadyPersisted {
m.R.Organization = o.r.Organization.o.Build()
} else {
var rel0 *models.Organization
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return err
}
err = m.AttachOrganization(ctx, exec, rel0)
if err != nil {
return err
}
}
}
return err
}
@ -622,11 +607,30 @@ func (o *FSTreatmentTemplate) Create(ctx context.Context, exec bob.Executor) (*m
opt := o.BuildSetter()
ensureCreatableFSTreatment(opt)
if o.r.Organization == nil {
FSTreatmentMods.WithNewOrganization().Apply(ctx, o)
}
var rel0 *models.Organization
if o.r.Organization.o.alreadyPersisted {
rel0 = o.r.Organization.o.Build()
} else {
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return nil, err
}
}
opt.OrganizationID = omit.From(rel0.ID)
m, err := models.FSTreatments.Insert(opt).One(ctx, exec)
if err != nil {
return nil, err
}
m.R.Organization = rel0
if err := o.insertOptRels(ctx, exec, m); err != nil {
return nil, err
}
@ -766,14 +770,14 @@ func (m fsTreatmentMods) RandomizeAllColumns(f *faker.Faker) FSTreatmentMod {
}
// Set the model columns to this value
func (m fsTreatmentMods) OrganizationID(val null.Val[int32]) FSTreatmentMod {
func (m fsTreatmentMods) OrganizationID(val int32) FSTreatmentMod {
return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) {
o.OrganizationID = func() null.Val[int32] { return val }
o.OrganizationID = func() int32 { return val }
})
}
// Set the Column from the function
func (m fsTreatmentMods) OrganizationIDFunc(f func() null.Val[int32]) FSTreatmentMod {
func (m fsTreatmentMods) OrganizationIDFunc(f func() int32) FSTreatmentMod {
return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) {
o.OrganizationID = f
})
@ -788,32 +792,10 @@ func (m fsTreatmentMods) UnsetOrganizationID() FSTreatmentMod {
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m fsTreatmentMods) RandomOrganizationID(f *faker.Faker) FSTreatmentMod {
return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fsTreatmentMods) RandomOrganizationIDNotNull(f *faker.Faker) FSTreatmentMod {
return FSTreatmentModFunc(func(_ context.Context, o *FSTreatmentTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
o.OrganizationID = func() int32 {
return random_int32(f)
}
})
}

View file

@ -37,7 +37,7 @@ func (mods FSTreatmentareaModSlice) Apply(ctx context.Context, n *FSTreatmentare
// FSTreatmentareaTemplate is an object representing the database table.
// all columns are optional and should be set by mods
type FSTreatmentareaTemplate struct {
OrganizationID func() null.Val[int32]
OrganizationID func() int32
Comments func() null.Val[string]
Creationdate func() null.Val[int64]
Creator func() null.Val[string]
@ -87,7 +87,7 @@ func (t FSTreatmentareaTemplate) setModelRels(o *models.FSTreatmentarea) {
if t.r.Organization != nil {
rel := t.r.Organization.o.Build()
rel.R.FSTreatmentareas = append(rel.R.FSTreatmentareas, o)
o.OrganizationID = null.From(rel.ID) // h2
o.OrganizationID = rel.ID // h2
o.R.Organization = rel
}
}
@ -99,7 +99,7 @@ func (o FSTreatmentareaTemplate) BuildSetter() *models.FSTreatmentareaSetter {
if o.OrganizationID != nil {
val := o.OrganizationID()
m.OrganizationID = omitnull.FromNull(val)
m.OrganizationID = omit.From(val)
}
if o.Comments != nil {
val := o.Comments()
@ -293,6 +293,10 @@ func (o FSTreatmentareaTemplate) BuildMany(number int) models.FSTreatmentareaSli
}
func ensureCreatableFSTreatmentarea(m *models.FSTreatmentareaSetter) {
if !(m.OrganizationID.IsValue()) {
val := random_int32(nil)
m.OrganizationID = omit.From(val)
}
if !(m.Objectid.IsValue()) {
val := random_int32(nil)
m.Objectid = omit.From(val)
@ -305,25 +309,6 @@ func ensureCreatableFSTreatmentarea(m *models.FSTreatmentareaSetter) {
func (o *FSTreatmentareaTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSTreatmentarea) error {
var err error
isOrganizationDone, _ := fsTreatmentareaRelOrganizationCtx.Value(ctx)
if !isOrganizationDone && o.r.Organization != nil {
ctx = fsTreatmentareaRelOrganizationCtx.WithValue(ctx, true)
if o.r.Organization.o.alreadyPersisted {
m.R.Organization = o.r.Organization.o.Build()
} else {
var rel0 *models.Organization
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return err
}
err = m.AttachOrganization(ctx, exec, rel0)
if err != nil {
return err
}
}
}
return err
}
@ -334,11 +319,30 @@ func (o *FSTreatmentareaTemplate) Create(ctx context.Context, exec bob.Executor)
opt := o.BuildSetter()
ensureCreatableFSTreatmentarea(opt)
if o.r.Organization == nil {
FSTreatmentareaMods.WithNewOrganization().Apply(ctx, o)
}
var rel0 *models.Organization
if o.r.Organization.o.alreadyPersisted {
rel0 = o.r.Organization.o.Build()
} else {
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return nil, err
}
}
opt.OrganizationID = omit.From(rel0.ID)
m, err := models.FSTreatmentareas.Insert(opt).One(ctx, exec)
if err != nil {
return nil, err
}
m.R.Organization = rel0
if err := o.insertOptRels(ctx, exec, m); err != nil {
return nil, err
}
@ -442,14 +446,14 @@ func (m fsTreatmentareaMods) RandomizeAllColumns(f *faker.Faker) FSTreatmentarea
}
// Set the model columns to this value
func (m fsTreatmentareaMods) OrganizationID(val null.Val[int32]) FSTreatmentareaMod {
func (m fsTreatmentareaMods) OrganizationID(val int32) FSTreatmentareaMod {
return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) {
o.OrganizationID = func() null.Val[int32] { return val }
o.OrganizationID = func() int32 { return val }
})
}
// Set the Column from the function
func (m fsTreatmentareaMods) OrganizationIDFunc(f func() null.Val[int32]) FSTreatmentareaMod {
func (m fsTreatmentareaMods) OrganizationIDFunc(f func() int32) FSTreatmentareaMod {
return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) {
o.OrganizationID = f
})
@ -464,32 +468,10 @@ func (m fsTreatmentareaMods) UnsetOrganizationID() FSTreatmentareaMod {
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m fsTreatmentareaMods) RandomOrganizationID(f *faker.Faker) FSTreatmentareaMod {
return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fsTreatmentareaMods) RandomOrganizationIDNotNull(f *faker.Faker) FSTreatmentareaMod {
return FSTreatmentareaModFunc(func(_ context.Context, o *FSTreatmentareaTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
o.OrganizationID = func() int32 {
return random_int32(f)
}
})
}

View file

@ -37,7 +37,7 @@ func (mods FSZoneModSlice) Apply(ctx context.Context, n *FSZoneTemplate) {
// FSZoneTemplate is an object representing the database table.
// all columns are optional and should be set by mods
type FSZoneTemplate struct {
OrganizationID func() null.Val[int32]
OrganizationID func() int32
Active func() null.Val[int64]
Creationdate func() null.Val[int64]
Creator func() null.Val[string]
@ -83,7 +83,7 @@ func (t FSZoneTemplate) setModelRels(o *models.FSZone) {
if t.r.Organization != nil {
rel := t.r.Organization.o.Build()
rel.R.FSZones = append(rel.R.FSZones, o)
o.OrganizationID = null.From(rel.ID) // h2
o.OrganizationID = rel.ID // h2
o.R.Organization = rel
}
}
@ -95,7 +95,7 @@ func (o FSZoneTemplate) BuildSetter() *models.FSZoneSetter {
if o.OrganizationID != nil {
val := o.OrganizationID()
m.OrganizationID = omitnull.FromNull(val)
m.OrganizationID = omit.From(val)
}
if o.Active != nil {
val := o.Active()
@ -261,6 +261,10 @@ func (o FSZoneTemplate) BuildMany(number int) models.FSZoneSlice {
}
func ensureCreatableFSZone(m *models.FSZoneSetter) {
if !(m.OrganizationID.IsValue()) {
val := random_int32(nil)
m.OrganizationID = omit.From(val)
}
if !(m.Objectid.IsValue()) {
val := random_int32(nil)
m.Objectid = omit.From(val)
@ -273,25 +277,6 @@ func ensureCreatableFSZone(m *models.FSZoneSetter) {
func (o *FSZoneTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSZone) error {
var err error
isOrganizationDone, _ := fsZoneRelOrganizationCtx.Value(ctx)
if !isOrganizationDone && o.r.Organization != nil {
ctx = fsZoneRelOrganizationCtx.WithValue(ctx, true)
if o.r.Organization.o.alreadyPersisted {
m.R.Organization = o.r.Organization.o.Build()
} else {
var rel0 *models.Organization
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return err
}
err = m.AttachOrganization(ctx, exec, rel0)
if err != nil {
return err
}
}
}
return err
}
@ -302,11 +287,30 @@ func (o *FSZoneTemplate) Create(ctx context.Context, exec bob.Executor) (*models
opt := o.BuildSetter()
ensureCreatableFSZone(opt)
if o.r.Organization == nil {
FSZoneMods.WithNewOrganization().Apply(ctx, o)
}
var rel0 *models.Organization
if o.r.Organization.o.alreadyPersisted {
rel0 = o.r.Organization.o.Build()
} else {
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return nil, err
}
}
opt.OrganizationID = omit.From(rel0.ID)
m, err := models.FSZones.Insert(opt).One(ctx, exec)
if err != nil {
return nil, err
}
m.R.Organization = rel0
if err := o.insertOptRels(ctx, exec, m); err != nil {
return nil, err
}
@ -406,14 +410,14 @@ func (m fsZoneMods) RandomizeAllColumns(f *faker.Faker) FSZoneMod {
}
// Set the model columns to this value
func (m fsZoneMods) OrganizationID(val null.Val[int32]) FSZoneMod {
func (m fsZoneMods) OrganizationID(val int32) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
o.OrganizationID = func() null.Val[int32] { return val }
o.OrganizationID = func() int32 { return val }
})
}
// Set the Column from the function
func (m fsZoneMods) OrganizationIDFunc(f func() null.Val[int32]) FSZoneMod {
func (m fsZoneMods) OrganizationIDFunc(f func() int32) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
o.OrganizationID = f
})
@ -428,32 +432,10 @@ func (m fsZoneMods) UnsetOrganizationID() FSZoneMod {
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m fsZoneMods) RandomOrganizationID(f *faker.Faker) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fsZoneMods) RandomOrganizationIDNotNull(f *faker.Faker) FSZoneMod {
return FSZoneModFunc(func(_ context.Context, o *FSZoneTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
o.OrganizationID = func() int32 {
return random_int32(f)
}
})
}

View file

@ -37,7 +37,7 @@ func (mods FSZones2ModSlice) Apply(ctx context.Context, n *FSZones2Template) {
// FSZones2Template is an object representing the database table.
// all columns are optional and should be set by mods
type FSZones2Template struct {
OrganizationID func() null.Val[int32]
OrganizationID func() int32
Creationdate func() null.Val[int64]
Creator func() null.Val[string]
Editdate func() null.Val[int64]
@ -82,7 +82,7 @@ func (t FSZones2Template) setModelRels(o *models.FSZones2) {
if t.r.Organization != nil {
rel := t.r.Organization.o.Build()
rel.R.FSZones2s = append(rel.R.FSZones2s, o)
o.OrganizationID = null.From(rel.ID) // h2
o.OrganizationID = rel.ID // h2
o.R.Organization = rel
}
}
@ -94,7 +94,7 @@ func (o FSZones2Template) BuildSetter() *models.FSZones2Setter {
if o.OrganizationID != nil {
val := o.OrganizationID()
m.OrganizationID = omitnull.FromNull(val)
m.OrganizationID = omit.From(val)
}
if o.Creationdate != nil {
val := o.Creationdate()
@ -253,6 +253,10 @@ func (o FSZones2Template) BuildMany(number int) models.FSZones2Slice {
}
func ensureCreatableFSZones2(m *models.FSZones2Setter) {
if !(m.OrganizationID.IsValue()) {
val := random_int32(nil)
m.OrganizationID = omit.From(val)
}
if !(m.Objectid.IsValue()) {
val := random_int32(nil)
m.Objectid = omit.From(val)
@ -265,25 +269,6 @@ func ensureCreatableFSZones2(m *models.FSZones2Setter) {
func (o *FSZones2Template) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FSZones2) error {
var err error
isOrganizationDone, _ := fsZones2RelOrganizationCtx.Value(ctx)
if !isOrganizationDone && o.r.Organization != nil {
ctx = fsZones2RelOrganizationCtx.WithValue(ctx, true)
if o.r.Organization.o.alreadyPersisted {
m.R.Organization = o.r.Organization.o.Build()
} else {
var rel0 *models.Organization
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return err
}
err = m.AttachOrganization(ctx, exec, rel0)
if err != nil {
return err
}
}
}
return err
}
@ -294,11 +279,30 @@ func (o *FSZones2Template) Create(ctx context.Context, exec bob.Executor) (*mode
opt := o.BuildSetter()
ensureCreatableFSZones2(opt)
if o.r.Organization == nil {
FSZones2Mods.WithNewOrganization().Apply(ctx, o)
}
var rel0 *models.Organization
if o.r.Organization.o.alreadyPersisted {
rel0 = o.r.Organization.o.Build()
} else {
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return nil, err
}
}
opt.OrganizationID = omit.From(rel0.ID)
m, err := models.FSZones2s.Insert(opt).One(ctx, exec)
if err != nil {
return nil, err
}
m.R.Organization = rel0
if err := o.insertOptRels(ctx, exec, m); err != nil {
return nil, err
}
@ -397,14 +401,14 @@ func (m fsZones2Mods) RandomizeAllColumns(f *faker.Faker) FSZones2Mod {
}
// Set the model columns to this value
func (m fsZones2Mods) OrganizationID(val null.Val[int32]) FSZones2Mod {
func (m fsZones2Mods) OrganizationID(val int32) FSZones2Mod {
return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) {
o.OrganizationID = func() null.Val[int32] { return val }
o.OrganizationID = func() int32 { return val }
})
}
// Set the Column from the function
func (m fsZones2Mods) OrganizationIDFunc(f func() null.Val[int32]) FSZones2Mod {
func (m fsZones2Mods) OrganizationIDFunc(f func() int32) FSZones2Mod {
return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) {
o.OrganizationID = f
})
@ -419,32 +423,10 @@ func (m fsZones2Mods) UnsetOrganizationID() FSZones2Mod {
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m fsZones2Mods) RandomOrganizationID(f *faker.Faker) FSZones2Mod {
return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fsZones2Mods) RandomOrganizationIDNotNull(f *faker.Faker) FSZones2Mod {
return FSZones2ModFunc(func(_ context.Context, o *FSZones2Template) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
o.OrganizationID = func() int32 {
return random_int32(f)
}
})
}

View file

@ -6,6 +6,7 @@ package factory
import (
"context"
"testing"
"time"
models "github.com/Gleipnir-Technology/nidus-sync/models"
"github.com/aarondl/opt/null"
@ -36,7 +37,7 @@ func (mods HistoryContainerrelateModSlice) Apply(ctx context.Context, n *History
// HistoryContainerrelateTemplate is an object representing the database table.
// all columns are optional and should be set by mods
type HistoryContainerrelateTemplate struct {
OrganizationID func() null.Val[int32]
OrganizationID func() int32
Containertype func() null.Val[string]
Creationdate func() null.Val[int64]
Creator func() null.Val[string]
@ -47,6 +48,7 @@ type HistoryContainerrelateTemplate struct {
Mosquitoinspid func() null.Val[string]
Objectid func() int32
Treatmentid func() null.Val[string]
Created func() null.Val[time.Time]
CreatedDate func() null.Val[int64]
CreatedUser func() null.Val[string]
GeometryX func() null.Val[float64]
@ -82,7 +84,7 @@ func (t HistoryContainerrelateTemplate) setModelRels(o *models.HistoryContainerr
if t.r.Organization != nil {
rel := t.r.Organization.o.Build()
rel.R.HistoryContainerrelates = append(rel.R.HistoryContainerrelates, o)
o.OrganizationID = null.From(rel.ID) // h2
o.OrganizationID = rel.ID // h2
o.R.Organization = rel
}
}
@ -94,7 +96,7 @@ func (o HistoryContainerrelateTemplate) BuildSetter() *models.HistoryContainerre
if o.OrganizationID != nil {
val := o.OrganizationID()
m.OrganizationID = omitnull.FromNull(val)
m.OrganizationID = omit.From(val)
}
if o.Containertype != nil {
val := o.Containertype()
@ -136,6 +138,10 @@ func (o HistoryContainerrelateTemplate) BuildSetter() *models.HistoryContainerre
val := o.Treatmentid()
m.Treatmentid = omitnull.FromNull(val)
}
if o.Created != nil {
val := o.Created()
m.Created = omitnull.FromNull(val)
}
if o.CreatedDate != nil {
val := o.CreatedDate()
m.CreatedDate = omitnull.FromNull(val)
@ -219,6 +225,9 @@ func (o HistoryContainerrelateTemplate) Build() *models.HistoryContainerrelate {
if o.Treatmentid != nil {
m.Treatmentid = o.Treatmentid()
}
if o.Created != nil {
m.Created = o.Created()
}
if o.CreatedDate != nil {
m.CreatedDate = o.CreatedDate()
}
@ -260,6 +269,10 @@ func (o HistoryContainerrelateTemplate) BuildMany(number int) models.HistoryCont
}
func ensureCreatableHistoryContainerrelate(m *models.HistoryContainerrelateSetter) {
if !(m.OrganizationID.IsValue()) {
val := random_int32(nil)
m.OrganizationID = omit.From(val)
}
if !(m.Objectid.IsValue()) {
val := random_int32(nil)
m.Objectid = omit.From(val)
@ -276,25 +289,6 @@ func ensureCreatableHistoryContainerrelate(m *models.HistoryContainerrelateSette
func (o *HistoryContainerrelateTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryContainerrelate) error {
var err error
isOrganizationDone, _ := historyContainerrelateRelOrganizationCtx.Value(ctx)
if !isOrganizationDone && o.r.Organization != nil {
ctx = historyContainerrelateRelOrganizationCtx.WithValue(ctx, true)
if o.r.Organization.o.alreadyPersisted {
m.R.Organization = o.r.Organization.o.Build()
} else {
var rel0 *models.Organization
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return err
}
err = m.AttachOrganization(ctx, exec, rel0)
if err != nil {
return err
}
}
}
return err
}
@ -305,11 +299,30 @@ func (o *HistoryContainerrelateTemplate) Create(ctx context.Context, exec bob.Ex
opt := o.BuildSetter()
ensureCreatableHistoryContainerrelate(opt)
if o.r.Organization == nil {
HistoryContainerrelateMods.WithNewOrganization().Apply(ctx, o)
}
var rel0 *models.Organization
if o.r.Organization.o.alreadyPersisted {
rel0 = o.r.Organization.o.Build()
} else {
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return nil, err
}
}
opt.OrganizationID = omit.From(rel0.ID)
m, err := models.HistoryContainerrelates.Insert(opt).One(ctx, exec)
if err != nil {
return nil, err
}
m.R.Organization = rel0
if err := o.insertOptRels(ctx, exec, m); err != nil {
return nil, err
}
@ -398,6 +411,7 @@ func (m historyContainerrelateMods) RandomizeAllColumns(f *faker.Faker) HistoryC
HistoryContainerrelateMods.RandomMosquitoinspid(f),
HistoryContainerrelateMods.RandomObjectid(f),
HistoryContainerrelateMods.RandomTreatmentid(f),
HistoryContainerrelateMods.RandomCreated(f),
HistoryContainerrelateMods.RandomCreatedDate(f),
HistoryContainerrelateMods.RandomCreatedUser(f),
HistoryContainerrelateMods.RandomGeometryX(f),
@ -409,14 +423,14 @@ func (m historyContainerrelateMods) RandomizeAllColumns(f *faker.Faker) HistoryC
}
// Set the model columns to this value
func (m historyContainerrelateMods) OrganizationID(val null.Val[int32]) HistoryContainerrelateMod {
func (m historyContainerrelateMods) OrganizationID(val int32) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
o.OrganizationID = func() null.Val[int32] { return val }
o.OrganizationID = func() int32 { return val }
})
}
// Set the Column from the function
func (m historyContainerrelateMods) OrganizationIDFunc(f func() null.Val[int32]) HistoryContainerrelateMod {
func (m historyContainerrelateMods) OrganizationIDFunc(f func() int32) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
o.OrganizationID = f
})
@ -431,32 +445,10 @@ func (m historyContainerrelateMods) UnsetOrganizationID() HistoryContainerrelate
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m historyContainerrelateMods) RandomOrganizationID(f *faker.Faker) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m historyContainerrelateMods) RandomOrganizationIDNotNull(f *faker.Faker) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
o.OrganizationID = func() int32 {
return random_int32(f)
}
})
}
@ -969,6 +961,59 @@ func (m historyContainerrelateMods) RandomTreatmentidNotNull(f *faker.Faker) His
})
}
// Set the model columns to this value
func (m historyContainerrelateMods) Created(val null.Val[time.Time]) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
o.Created = func() null.Val[time.Time] { return val }
})
}
// Set the Column from the function
func (m historyContainerrelateMods) CreatedFunc(f func() null.Val[time.Time]) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
o.Created = f
})
}
// Clear any values for the column
func (m historyContainerrelateMods) UnsetCreated() HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
o.Created = nil
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m historyContainerrelateMods) RandomCreated(f *faker.Faker) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
o.Created = func() null.Val[time.Time] {
if f == nil {
f = &defaultFaker
}
val := random_time_Time(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m historyContainerrelateMods) RandomCreatedNotNull(f *faker.Faker) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {
o.Created = func() null.Val[time.Time] {
if f == nil {
f = &defaultFaker
}
val := random_time_Time(f)
return null.From(val)
}
})
}
// Set the model columns to this value
func (m historyContainerrelateMods) CreatedDate(val null.Val[int64]) HistoryContainerrelateMod {
return HistoryContainerrelateModFunc(func(_ context.Context, o *HistoryContainerrelateTemplate) {

View file

@ -6,6 +6,7 @@ package factory
import (
"context"
"testing"
"time"
models "github.com/Gleipnir-Technology/nidus-sync/models"
"github.com/aarondl/opt/null"
@ -36,7 +37,7 @@ func (mods HistoryFieldscoutinglogModSlice) Apply(ctx context.Context, n *Histor
// HistoryFieldscoutinglogTemplate is an object representing the database table.
// all columns are optional and should be set by mods
type HistoryFieldscoutinglogTemplate struct {
OrganizationID func() null.Val[int32]
OrganizationID func() int32
Creationdate func() null.Val[int64]
Creator func() null.Val[string]
Editdate func() null.Val[int64]
@ -44,6 +45,7 @@ type HistoryFieldscoutinglogTemplate struct {
Globalid func() null.Val[string]
Objectid func() int32
Status func() null.Val[int16]
Created func() null.Val[time.Time]
CreatedDate func() null.Val[int64]
CreatedUser func() null.Val[string]
GeometryX func() null.Val[float64]
@ -79,7 +81,7 @@ func (t HistoryFieldscoutinglogTemplate) setModelRels(o *models.HistoryFieldscou
if t.r.Organization != nil {
rel := t.r.Organization.o.Build()
rel.R.HistoryFieldscoutinglogs = append(rel.R.HistoryFieldscoutinglogs, o)
o.OrganizationID = null.From(rel.ID) // h2
o.OrganizationID = rel.ID // h2
o.R.Organization = rel
}
}
@ -91,7 +93,7 @@ func (o HistoryFieldscoutinglogTemplate) BuildSetter() *models.HistoryFieldscout
if o.OrganizationID != nil {
val := o.OrganizationID()
m.OrganizationID = omitnull.FromNull(val)
m.OrganizationID = omit.From(val)
}
if o.Creationdate != nil {
val := o.Creationdate()
@ -121,6 +123,10 @@ func (o HistoryFieldscoutinglogTemplate) BuildSetter() *models.HistoryFieldscout
val := o.Status()
m.Status = omitnull.FromNull(val)
}
if o.Created != nil {
val := o.Created()
m.Created = omitnull.FromNull(val)
}
if o.CreatedDate != nil {
val := o.CreatedDate()
m.CreatedDate = omitnull.FromNull(val)
@ -195,6 +201,9 @@ func (o HistoryFieldscoutinglogTemplate) Build() *models.HistoryFieldscoutinglog
if o.Status != nil {
m.Status = o.Status()
}
if o.Created != nil {
m.Created = o.Created()
}
if o.CreatedDate != nil {
m.CreatedDate = o.CreatedDate()
}
@ -236,6 +245,10 @@ func (o HistoryFieldscoutinglogTemplate) BuildMany(number int) models.HistoryFie
}
func ensureCreatableHistoryFieldscoutinglog(m *models.HistoryFieldscoutinglogSetter) {
if !(m.OrganizationID.IsValue()) {
val := random_int32(nil)
m.OrganizationID = omit.From(val)
}
if !(m.Objectid.IsValue()) {
val := random_int32(nil)
m.Objectid = omit.From(val)
@ -252,25 +265,6 @@ func ensureCreatableHistoryFieldscoutinglog(m *models.HistoryFieldscoutinglogSet
func (o *HistoryFieldscoutinglogTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryFieldscoutinglog) error {
var err error
isOrganizationDone, _ := historyFieldscoutinglogRelOrganizationCtx.Value(ctx)
if !isOrganizationDone && o.r.Organization != nil {
ctx = historyFieldscoutinglogRelOrganizationCtx.WithValue(ctx, true)
if o.r.Organization.o.alreadyPersisted {
m.R.Organization = o.r.Organization.o.Build()
} else {
var rel0 *models.Organization
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return err
}
err = m.AttachOrganization(ctx, exec, rel0)
if err != nil {
return err
}
}
}
return err
}
@ -281,11 +275,30 @@ func (o *HistoryFieldscoutinglogTemplate) Create(ctx context.Context, exec bob.E
opt := o.BuildSetter()
ensureCreatableHistoryFieldscoutinglog(opt)
if o.r.Organization == nil {
HistoryFieldscoutinglogMods.WithNewOrganization().Apply(ctx, o)
}
var rel0 *models.Organization
if o.r.Organization.o.alreadyPersisted {
rel0 = o.r.Organization.o.Build()
} else {
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return nil, err
}
}
opt.OrganizationID = omit.From(rel0.ID)
m, err := models.HistoryFieldscoutinglogs.Insert(opt).One(ctx, exec)
if err != nil {
return nil, err
}
m.R.Organization = rel0
if err := o.insertOptRels(ctx, exec, m); err != nil {
return nil, err
}
@ -371,6 +384,7 @@ func (m historyFieldscoutinglogMods) RandomizeAllColumns(f *faker.Faker) History
HistoryFieldscoutinglogMods.RandomGlobalid(f),
HistoryFieldscoutinglogMods.RandomObjectid(f),
HistoryFieldscoutinglogMods.RandomStatus(f),
HistoryFieldscoutinglogMods.RandomCreated(f),
HistoryFieldscoutinglogMods.RandomCreatedDate(f),
HistoryFieldscoutinglogMods.RandomCreatedUser(f),
HistoryFieldscoutinglogMods.RandomGeometryX(f),
@ -382,14 +396,14 @@ func (m historyFieldscoutinglogMods) RandomizeAllColumns(f *faker.Faker) History
}
// Set the model columns to this value
func (m historyFieldscoutinglogMods) OrganizationID(val null.Val[int32]) HistoryFieldscoutinglogMod {
func (m historyFieldscoutinglogMods) OrganizationID(val int32) HistoryFieldscoutinglogMod {
return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) {
o.OrganizationID = func() null.Val[int32] { return val }
o.OrganizationID = func() int32 { return val }
})
}
// Set the Column from the function
func (m historyFieldscoutinglogMods) OrganizationIDFunc(f func() null.Val[int32]) HistoryFieldscoutinglogMod {
func (m historyFieldscoutinglogMods) OrganizationIDFunc(f func() int32) HistoryFieldscoutinglogMod {
return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) {
o.OrganizationID = f
})
@ -404,32 +418,10 @@ func (m historyFieldscoutinglogMods) UnsetOrganizationID() HistoryFieldscoutingl
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m historyFieldscoutinglogMods) RandomOrganizationID(f *faker.Faker) HistoryFieldscoutinglogMod {
return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m historyFieldscoutinglogMods) RandomOrganizationIDNotNull(f *faker.Faker) HistoryFieldscoutinglogMod {
return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
o.OrganizationID = func() int32 {
return random_int32(f)
}
})
}
@ -783,6 +775,59 @@ func (m historyFieldscoutinglogMods) RandomStatusNotNull(f *faker.Faker) History
})
}
// Set the model columns to this value
func (m historyFieldscoutinglogMods) Created(val null.Val[time.Time]) HistoryFieldscoutinglogMod {
return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) {
o.Created = func() null.Val[time.Time] { return val }
})
}
// Set the Column from the function
func (m historyFieldscoutinglogMods) CreatedFunc(f func() null.Val[time.Time]) HistoryFieldscoutinglogMod {
return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) {
o.Created = f
})
}
// Clear any values for the column
func (m historyFieldscoutinglogMods) UnsetCreated() HistoryFieldscoutinglogMod {
return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) {
o.Created = nil
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m historyFieldscoutinglogMods) RandomCreated(f *faker.Faker) HistoryFieldscoutinglogMod {
return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) {
o.Created = func() null.Val[time.Time] {
if f == nil {
f = &defaultFaker
}
val := random_time_Time(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m historyFieldscoutinglogMods) RandomCreatedNotNull(f *faker.Faker) HistoryFieldscoutinglogMod {
return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) {
o.Created = func() null.Val[time.Time] {
if f == nil {
f = &defaultFaker
}
val := random_time_Time(f)
return null.From(val)
}
})
}
// Set the model columns to this value
func (m historyFieldscoutinglogMods) CreatedDate(val null.Val[int64]) HistoryFieldscoutinglogMod {
return HistoryFieldscoutinglogModFunc(func(_ context.Context, o *HistoryFieldscoutinglogTemplate) {

View file

@ -6,6 +6,7 @@ package factory
import (
"context"
"testing"
"time"
models "github.com/Gleipnir-Technology/nidus-sync/models"
"github.com/aarondl/opt/null"
@ -36,7 +37,7 @@ func (mods HistoryHabitatrelateModSlice) Apply(ctx context.Context, n *HistoryHa
// HistoryHabitatrelateTemplate is an object representing the database table.
// all columns are optional and should be set by mods
type HistoryHabitatrelateTemplate struct {
OrganizationID func() null.Val[int32]
OrganizationID func() int32
Creationdate func() null.Val[int64]
Creator func() null.Val[string]
Editdate func() null.Val[int64]
@ -45,6 +46,7 @@ type HistoryHabitatrelateTemplate struct {
Globalid func() null.Val[string]
Habitattype func() null.Val[string]
Objectid func() int32
Created func() null.Val[time.Time]
CreatedDate func() null.Val[int64]
CreatedUser func() null.Val[string]
GeometryX func() null.Val[float64]
@ -80,7 +82,7 @@ func (t HistoryHabitatrelateTemplate) setModelRels(o *models.HistoryHabitatrelat
if t.r.Organization != nil {
rel := t.r.Organization.o.Build()
rel.R.HistoryHabitatrelates = append(rel.R.HistoryHabitatrelates, o)
o.OrganizationID = null.From(rel.ID) // h2
o.OrganizationID = rel.ID // h2
o.R.Organization = rel
}
}
@ -92,7 +94,7 @@ func (o HistoryHabitatrelateTemplate) BuildSetter() *models.HistoryHabitatrelate
if o.OrganizationID != nil {
val := o.OrganizationID()
m.OrganizationID = omitnull.FromNull(val)
m.OrganizationID = omit.From(val)
}
if o.Creationdate != nil {
val := o.Creationdate()
@ -126,6 +128,10 @@ func (o HistoryHabitatrelateTemplate) BuildSetter() *models.HistoryHabitatrelate
val := o.Objectid()
m.Objectid = omit.From(val)
}
if o.Created != nil {
val := o.Created()
m.Created = omitnull.FromNull(val)
}
if o.CreatedDate != nil {
val := o.CreatedDate()
m.CreatedDate = omitnull.FromNull(val)
@ -203,6 +209,9 @@ func (o HistoryHabitatrelateTemplate) Build() *models.HistoryHabitatrelate {
if o.Objectid != nil {
m.Objectid = o.Objectid()
}
if o.Created != nil {
m.Created = o.Created()
}
if o.CreatedDate != nil {
m.CreatedDate = o.CreatedDate()
}
@ -244,6 +253,10 @@ func (o HistoryHabitatrelateTemplate) BuildMany(number int) models.HistoryHabita
}
func ensureCreatableHistoryHabitatrelate(m *models.HistoryHabitatrelateSetter) {
if !(m.OrganizationID.IsValue()) {
val := random_int32(nil)
m.OrganizationID = omit.From(val)
}
if !(m.Objectid.IsValue()) {
val := random_int32(nil)
m.Objectid = omit.From(val)
@ -260,25 +273,6 @@ func ensureCreatableHistoryHabitatrelate(m *models.HistoryHabitatrelateSetter) {
func (o *HistoryHabitatrelateTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryHabitatrelate) error {
var err error
isOrganizationDone, _ := historyHabitatrelateRelOrganizationCtx.Value(ctx)
if !isOrganizationDone && o.r.Organization != nil {
ctx = historyHabitatrelateRelOrganizationCtx.WithValue(ctx, true)
if o.r.Organization.o.alreadyPersisted {
m.R.Organization = o.r.Organization.o.Build()
} else {
var rel0 *models.Organization
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return err
}
err = m.AttachOrganization(ctx, exec, rel0)
if err != nil {
return err
}
}
}
return err
}
@ -289,11 +283,30 @@ func (o *HistoryHabitatrelateTemplate) Create(ctx context.Context, exec bob.Exec
opt := o.BuildSetter()
ensureCreatableHistoryHabitatrelate(opt)
if o.r.Organization == nil {
HistoryHabitatrelateMods.WithNewOrganization().Apply(ctx, o)
}
var rel0 *models.Organization
if o.r.Organization.o.alreadyPersisted {
rel0 = o.r.Organization.o.Build()
} else {
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return nil, err
}
}
opt.OrganizationID = omit.From(rel0.ID)
m, err := models.HistoryHabitatrelates.Insert(opt).One(ctx, exec)
if err != nil {
return nil, err
}
m.R.Organization = rel0
if err := o.insertOptRels(ctx, exec, m); err != nil {
return nil, err
}
@ -380,6 +393,7 @@ func (m historyHabitatrelateMods) RandomizeAllColumns(f *faker.Faker) HistoryHab
HistoryHabitatrelateMods.RandomGlobalid(f),
HistoryHabitatrelateMods.RandomHabitattype(f),
HistoryHabitatrelateMods.RandomObjectid(f),
HistoryHabitatrelateMods.RandomCreated(f),
HistoryHabitatrelateMods.RandomCreatedDate(f),
HistoryHabitatrelateMods.RandomCreatedUser(f),
HistoryHabitatrelateMods.RandomGeometryX(f),
@ -391,14 +405,14 @@ func (m historyHabitatrelateMods) RandomizeAllColumns(f *faker.Faker) HistoryHab
}
// Set the model columns to this value
func (m historyHabitatrelateMods) OrganizationID(val null.Val[int32]) HistoryHabitatrelateMod {
func (m historyHabitatrelateMods) OrganizationID(val int32) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
o.OrganizationID = func() null.Val[int32] { return val }
o.OrganizationID = func() int32 { return val }
})
}
// Set the Column from the function
func (m historyHabitatrelateMods) OrganizationIDFunc(f func() null.Val[int32]) HistoryHabitatrelateMod {
func (m historyHabitatrelateMods) OrganizationIDFunc(f func() int32) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
o.OrganizationID = f
})
@ -413,32 +427,10 @@ func (m historyHabitatrelateMods) UnsetOrganizationID() HistoryHabitatrelateMod
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m historyHabitatrelateMods) RandomOrganizationID(f *faker.Faker) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m historyHabitatrelateMods) RandomOrganizationIDNotNull(f *faker.Faker) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
o.OrganizationID = func() int32 {
return random_int32(f)
}
})
}
@ -845,6 +837,59 @@ func (m historyHabitatrelateMods) RandomObjectid(f *faker.Faker) HistoryHabitatr
})
}
// Set the model columns to this value
func (m historyHabitatrelateMods) Created(val null.Val[time.Time]) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
o.Created = func() null.Val[time.Time] { return val }
})
}
// Set the Column from the function
func (m historyHabitatrelateMods) CreatedFunc(f func() null.Val[time.Time]) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
o.Created = f
})
}
// Clear any values for the column
func (m historyHabitatrelateMods) UnsetCreated() HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
o.Created = nil
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m historyHabitatrelateMods) RandomCreated(f *faker.Faker) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
o.Created = func() null.Val[time.Time] {
if f == nil {
f = &defaultFaker
}
val := random_time_Time(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m historyHabitatrelateMods) RandomCreatedNotNull(f *faker.Faker) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {
o.Created = func() null.Val[time.Time] {
if f == nil {
f = &defaultFaker
}
val := random_time_Time(f)
return null.From(val)
}
})
}
// Set the model columns to this value
func (m historyHabitatrelateMods) CreatedDate(val null.Val[int64]) HistoryHabitatrelateMod {
return HistoryHabitatrelateModFunc(func(_ context.Context, o *HistoryHabitatrelateTemplate) {

View file

@ -6,6 +6,7 @@ package factory
import (
"context"
"testing"
"time"
models "github.com/Gleipnir-Technology/nidus-sync/models"
"github.com/aarondl/opt/null"
@ -36,7 +37,7 @@ func (mods HistoryInspectionsampleModSlice) Apply(ctx context.Context, n *Histor
// HistoryInspectionsampleTemplate is an object representing the database table.
// all columns are optional and should be set by mods
type HistoryInspectionsampleTemplate struct {
OrganizationID func() null.Val[int32]
OrganizationID func() int32
Creationdate func() null.Val[int64]
Creator func() null.Val[string]
Editdate func() null.Val[int64]
@ -47,6 +48,7 @@ type HistoryInspectionsampleTemplate struct {
Objectid func() int32
Processed func() null.Val[int16]
Sampleid func() null.Val[string]
Created func() null.Val[time.Time]
CreatedDate func() null.Val[int64]
CreatedUser func() null.Val[string]
GeometryX func() null.Val[float64]
@ -82,7 +84,7 @@ func (t HistoryInspectionsampleTemplate) setModelRels(o *models.HistoryInspectio
if t.r.Organization != nil {
rel := t.r.Organization.o.Build()
rel.R.HistoryInspectionsamples = append(rel.R.HistoryInspectionsamples, o)
o.OrganizationID = null.From(rel.ID) // h2
o.OrganizationID = rel.ID // h2
o.R.Organization = rel
}
}
@ -94,7 +96,7 @@ func (o HistoryInspectionsampleTemplate) BuildSetter() *models.HistoryInspection
if o.OrganizationID != nil {
val := o.OrganizationID()
m.OrganizationID = omitnull.FromNull(val)
m.OrganizationID = omit.From(val)
}
if o.Creationdate != nil {
val := o.Creationdate()
@ -136,6 +138,10 @@ func (o HistoryInspectionsampleTemplate) BuildSetter() *models.HistoryInspection
val := o.Sampleid()
m.Sampleid = omitnull.FromNull(val)
}
if o.Created != nil {
val := o.Created()
m.Created = omitnull.FromNull(val)
}
if o.CreatedDate != nil {
val := o.CreatedDate()
m.CreatedDate = omitnull.FromNull(val)
@ -219,6 +225,9 @@ func (o HistoryInspectionsampleTemplate) Build() *models.HistoryInspectionsample
if o.Sampleid != nil {
m.Sampleid = o.Sampleid()
}
if o.Created != nil {
m.Created = o.Created()
}
if o.CreatedDate != nil {
m.CreatedDate = o.CreatedDate()
}
@ -260,6 +269,10 @@ func (o HistoryInspectionsampleTemplate) BuildMany(number int) models.HistoryIns
}
func ensureCreatableHistoryInspectionsample(m *models.HistoryInspectionsampleSetter) {
if !(m.OrganizationID.IsValue()) {
val := random_int32(nil)
m.OrganizationID = omit.From(val)
}
if !(m.Objectid.IsValue()) {
val := random_int32(nil)
m.Objectid = omit.From(val)
@ -276,25 +289,6 @@ func ensureCreatableHistoryInspectionsample(m *models.HistoryInspectionsampleSet
func (o *HistoryInspectionsampleTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryInspectionsample) error {
var err error
isOrganizationDone, _ := historyInspectionsampleRelOrganizationCtx.Value(ctx)
if !isOrganizationDone && o.r.Organization != nil {
ctx = historyInspectionsampleRelOrganizationCtx.WithValue(ctx, true)
if o.r.Organization.o.alreadyPersisted {
m.R.Organization = o.r.Organization.o.Build()
} else {
var rel0 *models.Organization
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return err
}
err = m.AttachOrganization(ctx, exec, rel0)
if err != nil {
return err
}
}
}
return err
}
@ -305,11 +299,30 @@ func (o *HistoryInspectionsampleTemplate) Create(ctx context.Context, exec bob.E
opt := o.BuildSetter()
ensureCreatableHistoryInspectionsample(opt)
if o.r.Organization == nil {
HistoryInspectionsampleMods.WithNewOrganization().Apply(ctx, o)
}
var rel0 *models.Organization
if o.r.Organization.o.alreadyPersisted {
rel0 = o.r.Organization.o.Build()
} else {
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return nil, err
}
}
opt.OrganizationID = omit.From(rel0.ID)
m, err := models.HistoryInspectionsamples.Insert(opt).One(ctx, exec)
if err != nil {
return nil, err
}
m.R.Organization = rel0
if err := o.insertOptRels(ctx, exec, m); err != nil {
return nil, err
}
@ -398,6 +411,7 @@ func (m historyInspectionsampleMods) RandomizeAllColumns(f *faker.Faker) History
HistoryInspectionsampleMods.RandomObjectid(f),
HistoryInspectionsampleMods.RandomProcessed(f),
HistoryInspectionsampleMods.RandomSampleid(f),
HistoryInspectionsampleMods.RandomCreated(f),
HistoryInspectionsampleMods.RandomCreatedDate(f),
HistoryInspectionsampleMods.RandomCreatedUser(f),
HistoryInspectionsampleMods.RandomGeometryX(f),
@ -409,14 +423,14 @@ func (m historyInspectionsampleMods) RandomizeAllColumns(f *faker.Faker) History
}
// Set the model columns to this value
func (m historyInspectionsampleMods) OrganizationID(val null.Val[int32]) HistoryInspectionsampleMod {
func (m historyInspectionsampleMods) OrganizationID(val int32) HistoryInspectionsampleMod {
return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) {
o.OrganizationID = func() null.Val[int32] { return val }
o.OrganizationID = func() int32 { return val }
})
}
// Set the Column from the function
func (m historyInspectionsampleMods) OrganizationIDFunc(f func() null.Val[int32]) HistoryInspectionsampleMod {
func (m historyInspectionsampleMods) OrganizationIDFunc(f func() int32) HistoryInspectionsampleMod {
return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) {
o.OrganizationID = f
})
@ -431,32 +445,10 @@ func (m historyInspectionsampleMods) UnsetOrganizationID() HistoryInspectionsamp
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m historyInspectionsampleMods) RandomOrganizationID(f *faker.Faker) HistoryInspectionsampleMod {
return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m historyInspectionsampleMods) RandomOrganizationIDNotNull(f *faker.Faker) HistoryInspectionsampleMod {
return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
o.OrganizationID = func() int32 {
return random_int32(f)
}
})
}
@ -969,6 +961,59 @@ func (m historyInspectionsampleMods) RandomSampleidNotNull(f *faker.Faker) Histo
})
}
// Set the model columns to this value
func (m historyInspectionsampleMods) Created(val null.Val[time.Time]) HistoryInspectionsampleMod {
return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) {
o.Created = func() null.Val[time.Time] { return val }
})
}
// Set the Column from the function
func (m historyInspectionsampleMods) CreatedFunc(f func() null.Val[time.Time]) HistoryInspectionsampleMod {
return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) {
o.Created = f
})
}
// Clear any values for the column
func (m historyInspectionsampleMods) UnsetCreated() HistoryInspectionsampleMod {
return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) {
o.Created = nil
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m historyInspectionsampleMods) RandomCreated(f *faker.Faker) HistoryInspectionsampleMod {
return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) {
o.Created = func() null.Val[time.Time] {
if f == nil {
f = &defaultFaker
}
val := random_time_Time(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m historyInspectionsampleMods) RandomCreatedNotNull(f *faker.Faker) HistoryInspectionsampleMod {
return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) {
o.Created = func() null.Val[time.Time] {
if f == nil {
f = &defaultFaker
}
val := random_time_Time(f)
return null.From(val)
}
})
}
// Set the model columns to this value
func (m historyInspectionsampleMods) CreatedDate(val null.Val[int64]) HistoryInspectionsampleMod {
return HistoryInspectionsampleModFunc(func(_ context.Context, o *HistoryInspectionsampleTemplate) {

View file

@ -6,6 +6,7 @@ package factory
import (
"context"
"testing"
"time"
models "github.com/Gleipnir-Technology/nidus-sync/models"
"github.com/aarondl/opt/null"
@ -36,7 +37,7 @@ func (mods HistoryInspectionsampledetailModSlice) Apply(ctx context.Context, n *
// HistoryInspectionsampledetailTemplate is an object representing the database table.
// all columns are optional and should be set by mods
type HistoryInspectionsampledetailTemplate struct {
OrganizationID func() null.Val[int32]
OrganizationID func() int32
Comments func() null.Val[string]
Creationdate func() null.Val[int64]
Creator func() null.Val[string]
@ -58,6 +59,7 @@ type HistoryInspectionsampledetailTemplate struct {
Lpupcount func() null.Val[int16]
Objectid func() int32
Processed func() null.Val[int16]
Created func() null.Val[time.Time]
CreatedDate func() null.Val[int64]
CreatedUser func() null.Val[string]
GeometryX func() null.Val[float64]
@ -93,7 +95,7 @@ func (t HistoryInspectionsampledetailTemplate) setModelRels(o *models.HistoryIns
if t.r.Organization != nil {
rel := t.r.Organization.o.Build()
rel.R.HistoryInspectionsampledetails = append(rel.R.HistoryInspectionsampledetails, o)
o.OrganizationID = null.From(rel.ID) // h2
o.OrganizationID = rel.ID // h2
o.R.Organization = rel
}
}
@ -105,7 +107,7 @@ func (o HistoryInspectionsampledetailTemplate) BuildSetter() *models.HistoryInsp
if o.OrganizationID != nil {
val := o.OrganizationID()
m.OrganizationID = omitnull.FromNull(val)
m.OrganizationID = omit.From(val)
}
if o.Comments != nil {
val := o.Comments()
@ -191,6 +193,10 @@ func (o HistoryInspectionsampledetailTemplate) BuildSetter() *models.HistoryInsp
val := o.Processed()
m.Processed = omitnull.FromNull(val)
}
if o.Created != nil {
val := o.Created()
m.Created = omitnull.FromNull(val)
}
if o.CreatedDate != nil {
val := o.CreatedDate()
m.CreatedDate = omitnull.FromNull(val)
@ -307,6 +313,9 @@ func (o HistoryInspectionsampledetailTemplate) Build() *models.HistoryInspection
if o.Processed != nil {
m.Processed = o.Processed()
}
if o.Created != nil {
m.Created = o.Created()
}
if o.CreatedDate != nil {
m.CreatedDate = o.CreatedDate()
}
@ -348,6 +357,10 @@ func (o HistoryInspectionsampledetailTemplate) BuildMany(number int) models.Hist
}
func ensureCreatableHistoryInspectionsampledetail(m *models.HistoryInspectionsampledetailSetter) {
if !(m.OrganizationID.IsValue()) {
val := random_int32(nil)
m.OrganizationID = omit.From(val)
}
if !(m.Objectid.IsValue()) {
val := random_int32(nil)
m.Objectid = omit.From(val)
@ -364,25 +377,6 @@ func ensureCreatableHistoryInspectionsampledetail(m *models.HistoryInspectionsam
func (o *HistoryInspectionsampledetailTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryInspectionsampledetail) error {
var err error
isOrganizationDone, _ := historyInspectionsampledetailRelOrganizationCtx.Value(ctx)
if !isOrganizationDone && o.r.Organization != nil {
ctx = historyInspectionsampledetailRelOrganizationCtx.WithValue(ctx, true)
if o.r.Organization.o.alreadyPersisted {
m.R.Organization = o.r.Organization.o.Build()
} else {
var rel0 *models.Organization
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return err
}
err = m.AttachOrganization(ctx, exec, rel0)
if err != nil {
return err
}
}
}
return err
}
@ -393,11 +387,30 @@ func (o *HistoryInspectionsampledetailTemplate) Create(ctx context.Context, exec
opt := o.BuildSetter()
ensureCreatableHistoryInspectionsampledetail(opt)
if o.r.Organization == nil {
HistoryInspectionsampledetailMods.WithNewOrganization().Apply(ctx, o)
}
var rel0 *models.Organization
if o.r.Organization.o.alreadyPersisted {
rel0 = o.r.Organization.o.Build()
} else {
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return nil, err
}
}
opt.OrganizationID = omit.From(rel0.ID)
m, err := models.HistoryInspectionsampledetails.Insert(opt).One(ctx, exec)
if err != nil {
return nil, err
}
m.R.Organization = rel0
if err := o.insertOptRels(ctx, exec, m); err != nil {
return nil, err
}
@ -497,6 +510,7 @@ func (m historyInspectionsampledetailMods) RandomizeAllColumns(f *faker.Faker) H
HistoryInspectionsampledetailMods.RandomLpupcount(f),
HistoryInspectionsampledetailMods.RandomObjectid(f),
HistoryInspectionsampledetailMods.RandomProcessed(f),
HistoryInspectionsampledetailMods.RandomCreated(f),
HistoryInspectionsampledetailMods.RandomCreatedDate(f),
HistoryInspectionsampledetailMods.RandomCreatedUser(f),
HistoryInspectionsampledetailMods.RandomGeometryX(f),
@ -508,14 +522,14 @@ func (m historyInspectionsampledetailMods) RandomizeAllColumns(f *faker.Faker) H
}
// Set the model columns to this value
func (m historyInspectionsampledetailMods) OrganizationID(val null.Val[int32]) HistoryInspectionsampledetailMod {
func (m historyInspectionsampledetailMods) OrganizationID(val int32) HistoryInspectionsampledetailMod {
return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) {
o.OrganizationID = func() null.Val[int32] { return val }
o.OrganizationID = func() int32 { return val }
})
}
// Set the Column from the function
func (m historyInspectionsampledetailMods) OrganizationIDFunc(f func() null.Val[int32]) HistoryInspectionsampledetailMod {
func (m historyInspectionsampledetailMods) OrganizationIDFunc(f func() int32) HistoryInspectionsampledetailMod {
return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) {
o.OrganizationID = f
})
@ -530,32 +544,10 @@ func (m historyInspectionsampledetailMods) UnsetOrganizationID() HistoryInspecti
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m historyInspectionsampledetailMods) RandomOrganizationID(f *faker.Faker) HistoryInspectionsampledetailMod {
return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m historyInspectionsampledetailMods) RandomOrganizationIDNotNull(f *faker.Faker) HistoryInspectionsampledetailMod {
return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
o.OrganizationID = func() int32 {
return random_int32(f)
}
})
}
@ -1651,6 +1643,59 @@ func (m historyInspectionsampledetailMods) RandomProcessedNotNull(f *faker.Faker
})
}
// Set the model columns to this value
func (m historyInspectionsampledetailMods) Created(val null.Val[time.Time]) HistoryInspectionsampledetailMod {
return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) {
o.Created = func() null.Val[time.Time] { return val }
})
}
// Set the Column from the function
func (m historyInspectionsampledetailMods) CreatedFunc(f func() null.Val[time.Time]) HistoryInspectionsampledetailMod {
return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) {
o.Created = f
})
}
// Clear any values for the column
func (m historyInspectionsampledetailMods) UnsetCreated() HistoryInspectionsampledetailMod {
return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) {
o.Created = nil
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m historyInspectionsampledetailMods) RandomCreated(f *faker.Faker) HistoryInspectionsampledetailMod {
return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) {
o.Created = func() null.Val[time.Time] {
if f == nil {
f = &defaultFaker
}
val := random_time_Time(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m historyInspectionsampledetailMods) RandomCreatedNotNull(f *faker.Faker) HistoryInspectionsampledetailMod {
return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) {
o.Created = func() null.Val[time.Time] {
if f == nil {
f = &defaultFaker
}
val := random_time_Time(f)
return null.From(val)
}
})
}
// Set the model columns to this value
func (m historyInspectionsampledetailMods) CreatedDate(val null.Val[int64]) HistoryInspectionsampledetailMod {
return HistoryInspectionsampledetailModFunc(func(_ context.Context, o *HistoryInspectionsampledetailTemplate) {

View file

@ -6,6 +6,7 @@ package factory
import (
"context"
"testing"
"time"
models "github.com/Gleipnir-Technology/nidus-sync/models"
"github.com/aarondl/opt/null"
@ -36,7 +37,7 @@ func (mods HistoryLinelocationModSlice) Apply(ctx context.Context, n *HistoryLin
// HistoryLinelocationTemplate is an object representing the database table.
// all columns are optional and should be set by mods
type HistoryLinelocationTemplate struct {
OrganizationID func() null.Val[int32]
OrganizationID func() int32
Accessdesc func() null.Val[string]
Acres func() null.Val[float64]
Active func() null.Val[int16]
@ -81,6 +82,7 @@ type HistoryLinelocationTemplate struct {
WidthMeters func() null.Val[float64]
Zone func() null.Val[string]
Zone2 func() null.Val[string]
Created func() null.Val[time.Time]
CreatedDate func() null.Val[int64]
CreatedUser func() null.Val[string]
GeometryX func() null.Val[float64]
@ -116,7 +118,7 @@ func (t HistoryLinelocationTemplate) setModelRels(o *models.HistoryLinelocation)
if t.r.Organization != nil {
rel := t.r.Organization.o.Build()
rel.R.HistoryLinelocations = append(rel.R.HistoryLinelocations, o)
o.OrganizationID = null.From(rel.ID) // h2
o.OrganizationID = rel.ID // h2
o.R.Organization = rel
}
}
@ -128,7 +130,7 @@ func (o HistoryLinelocationTemplate) BuildSetter() *models.HistoryLinelocationSe
if o.OrganizationID != nil {
val := o.OrganizationID()
m.OrganizationID = omitnull.FromNull(val)
m.OrganizationID = omit.From(val)
}
if o.Accessdesc != nil {
val := o.Accessdesc()
@ -306,6 +308,10 @@ func (o HistoryLinelocationTemplate) BuildSetter() *models.HistoryLinelocationSe
val := o.Zone2()
m.Zone2 = omitnull.FromNull(val)
}
if o.Created != nil {
val := o.Created()
m.Created = omitnull.FromNull(val)
}
if o.CreatedDate != nil {
val := o.CreatedDate()
m.CreatedDate = omitnull.FromNull(val)
@ -491,6 +497,9 @@ func (o HistoryLinelocationTemplate) Build() *models.HistoryLinelocation {
if o.Zone2 != nil {
m.Zone2 = o.Zone2()
}
if o.Created != nil {
m.Created = o.Created()
}
if o.CreatedDate != nil {
m.CreatedDate = o.CreatedDate()
}
@ -532,6 +541,10 @@ func (o HistoryLinelocationTemplate) BuildMany(number int) models.HistoryLineloc
}
func ensureCreatableHistoryLinelocation(m *models.HistoryLinelocationSetter) {
if !(m.OrganizationID.IsValue()) {
val := random_int32(nil)
m.OrganizationID = omit.From(val)
}
if !(m.Objectid.IsValue()) {
val := random_int32(nil)
m.Objectid = omit.From(val)
@ -548,25 +561,6 @@ func ensureCreatableHistoryLinelocation(m *models.HistoryLinelocationSetter) {
func (o *HistoryLinelocationTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryLinelocation) error {
var err error
isOrganizationDone, _ := historyLinelocationRelOrganizationCtx.Value(ctx)
if !isOrganizationDone && o.r.Organization != nil {
ctx = historyLinelocationRelOrganizationCtx.WithValue(ctx, true)
if o.r.Organization.o.alreadyPersisted {
m.R.Organization = o.r.Organization.o.Build()
} else {
var rel0 *models.Organization
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return err
}
err = m.AttachOrganization(ctx, exec, rel0)
if err != nil {
return err
}
}
}
return err
}
@ -577,11 +571,30 @@ func (o *HistoryLinelocationTemplate) Create(ctx context.Context, exec bob.Execu
opt := o.BuildSetter()
ensureCreatableHistoryLinelocation(opt)
if o.r.Organization == nil {
HistoryLinelocationMods.WithNewOrganization().Apply(ctx, o)
}
var rel0 *models.Organization
if o.r.Organization.o.alreadyPersisted {
rel0 = o.r.Organization.o.Build()
} else {
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return nil, err
}
}
opt.OrganizationID = omit.From(rel0.ID)
m, err := models.HistoryLinelocations.Insert(opt).One(ctx, exec)
if err != nil {
return nil, err
}
m.R.Organization = rel0
if err := o.insertOptRels(ctx, exec, m); err != nil {
return nil, err
}
@ -704,6 +717,7 @@ func (m historyLinelocationMods) RandomizeAllColumns(f *faker.Faker) HistoryLine
HistoryLinelocationMods.RandomWidthMeters(f),
HistoryLinelocationMods.RandomZone(f),
HistoryLinelocationMods.RandomZone2(f),
HistoryLinelocationMods.RandomCreated(f),
HistoryLinelocationMods.RandomCreatedDate(f),
HistoryLinelocationMods.RandomCreatedUser(f),
HistoryLinelocationMods.RandomGeometryX(f),
@ -715,14 +729,14 @@ func (m historyLinelocationMods) RandomizeAllColumns(f *faker.Faker) HistoryLine
}
// Set the model columns to this value
func (m historyLinelocationMods) OrganizationID(val null.Val[int32]) HistoryLinelocationMod {
func (m historyLinelocationMods) OrganizationID(val int32) HistoryLinelocationMod {
return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) {
o.OrganizationID = func() null.Val[int32] { return val }
o.OrganizationID = func() int32 { return val }
})
}
// Set the Column from the function
func (m historyLinelocationMods) OrganizationIDFunc(f func() null.Val[int32]) HistoryLinelocationMod {
func (m historyLinelocationMods) OrganizationIDFunc(f func() int32) HistoryLinelocationMod {
return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) {
o.OrganizationID = f
})
@ -737,32 +751,10 @@ func (m historyLinelocationMods) UnsetOrganizationID() HistoryLinelocationMod {
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m historyLinelocationMods) RandomOrganizationID(f *faker.Faker) HistoryLinelocationMod {
return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m historyLinelocationMods) RandomOrganizationIDNotNull(f *faker.Faker) HistoryLinelocationMod {
return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
o.OrganizationID = func() int32 {
return random_int32(f)
}
})
}
@ -3077,6 +3069,59 @@ func (m historyLinelocationMods) RandomZone2NotNull(f *faker.Faker) HistoryLinel
})
}
// Set the model columns to this value
func (m historyLinelocationMods) Created(val null.Val[time.Time]) HistoryLinelocationMod {
return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) {
o.Created = func() null.Val[time.Time] { return val }
})
}
// Set the Column from the function
func (m historyLinelocationMods) CreatedFunc(f func() null.Val[time.Time]) HistoryLinelocationMod {
return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) {
o.Created = f
})
}
// Clear any values for the column
func (m historyLinelocationMods) UnsetCreated() HistoryLinelocationMod {
return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) {
o.Created = nil
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m historyLinelocationMods) RandomCreated(f *faker.Faker) HistoryLinelocationMod {
return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) {
o.Created = func() null.Val[time.Time] {
if f == nil {
f = &defaultFaker
}
val := random_time_Time(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m historyLinelocationMods) RandomCreatedNotNull(f *faker.Faker) HistoryLinelocationMod {
return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) {
o.Created = func() null.Val[time.Time] {
if f == nil {
f = &defaultFaker
}
val := random_time_Time(f)
return null.From(val)
}
})
}
// Set the model columns to this value
func (m historyLinelocationMods) CreatedDate(val null.Val[int64]) HistoryLinelocationMod {
return HistoryLinelocationModFunc(func(_ context.Context, o *HistoryLinelocationTemplate) {

View file

@ -6,6 +6,7 @@ package factory
import (
"context"
"testing"
"time"
models "github.com/Gleipnir-Technology/nidus-sync/models"
"github.com/aarondl/opt/null"
@ -36,7 +37,7 @@ func (mods HistoryLocationtrackingModSlice) Apply(ctx context.Context, n *Histor
// HistoryLocationtrackingTemplate is an object representing the database table.
// all columns are optional and should be set by mods
type HistoryLocationtrackingTemplate struct {
OrganizationID func() null.Val[int32]
OrganizationID func() int32
Accuracy func() null.Val[float64]
Creationdate func() null.Val[int64]
Creator func() null.Val[string]
@ -45,6 +46,7 @@ type HistoryLocationtrackingTemplate struct {
Fieldtech func() null.Val[string]
Globalid func() null.Val[string]
Objectid func() int32
Created func() null.Val[time.Time]
CreatedDate func() null.Val[int64]
CreatedUser func() null.Val[string]
GeometryX func() null.Val[float64]
@ -80,7 +82,7 @@ func (t HistoryLocationtrackingTemplate) setModelRels(o *models.HistoryLocationt
if t.r.Organization != nil {
rel := t.r.Organization.o.Build()
rel.R.HistoryLocationtrackings = append(rel.R.HistoryLocationtrackings, o)
o.OrganizationID = null.From(rel.ID) // h2
o.OrganizationID = rel.ID // h2
o.R.Organization = rel
}
}
@ -92,7 +94,7 @@ func (o HistoryLocationtrackingTemplate) BuildSetter() *models.HistoryLocationtr
if o.OrganizationID != nil {
val := o.OrganizationID()
m.OrganizationID = omitnull.FromNull(val)
m.OrganizationID = omit.From(val)
}
if o.Accuracy != nil {
val := o.Accuracy()
@ -126,6 +128,10 @@ func (o HistoryLocationtrackingTemplate) BuildSetter() *models.HistoryLocationtr
val := o.Objectid()
m.Objectid = omit.From(val)
}
if o.Created != nil {
val := o.Created()
m.Created = omitnull.FromNull(val)
}
if o.CreatedDate != nil {
val := o.CreatedDate()
m.CreatedDate = omitnull.FromNull(val)
@ -203,6 +209,9 @@ func (o HistoryLocationtrackingTemplate) Build() *models.HistoryLocationtracking
if o.Objectid != nil {
m.Objectid = o.Objectid()
}
if o.Created != nil {
m.Created = o.Created()
}
if o.CreatedDate != nil {
m.CreatedDate = o.CreatedDate()
}
@ -244,6 +253,10 @@ func (o HistoryLocationtrackingTemplate) BuildMany(number int) models.HistoryLoc
}
func ensureCreatableHistoryLocationtracking(m *models.HistoryLocationtrackingSetter) {
if !(m.OrganizationID.IsValue()) {
val := random_int32(nil)
m.OrganizationID = omit.From(val)
}
if !(m.Objectid.IsValue()) {
val := random_int32(nil)
m.Objectid = omit.From(val)
@ -260,25 +273,6 @@ func ensureCreatableHistoryLocationtracking(m *models.HistoryLocationtrackingSet
func (o *HistoryLocationtrackingTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryLocationtracking) error {
var err error
isOrganizationDone, _ := historyLocationtrackingRelOrganizationCtx.Value(ctx)
if !isOrganizationDone && o.r.Organization != nil {
ctx = historyLocationtrackingRelOrganizationCtx.WithValue(ctx, true)
if o.r.Organization.o.alreadyPersisted {
m.R.Organization = o.r.Organization.o.Build()
} else {
var rel0 *models.Organization
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return err
}
err = m.AttachOrganization(ctx, exec, rel0)
if err != nil {
return err
}
}
}
return err
}
@ -289,11 +283,30 @@ func (o *HistoryLocationtrackingTemplate) Create(ctx context.Context, exec bob.E
opt := o.BuildSetter()
ensureCreatableHistoryLocationtracking(opt)
if o.r.Organization == nil {
HistoryLocationtrackingMods.WithNewOrganization().Apply(ctx, o)
}
var rel0 *models.Organization
if o.r.Organization.o.alreadyPersisted {
rel0 = o.r.Organization.o.Build()
} else {
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return nil, err
}
}
opt.OrganizationID = omit.From(rel0.ID)
m, err := models.HistoryLocationtrackings.Insert(opt).One(ctx, exec)
if err != nil {
return nil, err
}
m.R.Organization = rel0
if err := o.insertOptRels(ctx, exec, m); err != nil {
return nil, err
}
@ -380,6 +393,7 @@ func (m historyLocationtrackingMods) RandomizeAllColumns(f *faker.Faker) History
HistoryLocationtrackingMods.RandomFieldtech(f),
HistoryLocationtrackingMods.RandomGlobalid(f),
HistoryLocationtrackingMods.RandomObjectid(f),
HistoryLocationtrackingMods.RandomCreated(f),
HistoryLocationtrackingMods.RandomCreatedDate(f),
HistoryLocationtrackingMods.RandomCreatedUser(f),
HistoryLocationtrackingMods.RandomGeometryX(f),
@ -391,14 +405,14 @@ func (m historyLocationtrackingMods) RandomizeAllColumns(f *faker.Faker) History
}
// Set the model columns to this value
func (m historyLocationtrackingMods) OrganizationID(val null.Val[int32]) HistoryLocationtrackingMod {
func (m historyLocationtrackingMods) OrganizationID(val int32) HistoryLocationtrackingMod {
return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) {
o.OrganizationID = func() null.Val[int32] { return val }
o.OrganizationID = func() int32 { return val }
})
}
// Set the Column from the function
func (m historyLocationtrackingMods) OrganizationIDFunc(f func() null.Val[int32]) HistoryLocationtrackingMod {
func (m historyLocationtrackingMods) OrganizationIDFunc(f func() int32) HistoryLocationtrackingMod {
return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) {
o.OrganizationID = f
})
@ -413,32 +427,10 @@ func (m historyLocationtrackingMods) UnsetOrganizationID() HistoryLocationtracki
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m historyLocationtrackingMods) RandomOrganizationID(f *faker.Faker) HistoryLocationtrackingMod {
return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m historyLocationtrackingMods) RandomOrganizationIDNotNull(f *faker.Faker) HistoryLocationtrackingMod {
return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
o.OrganizationID = func() int32 {
return random_int32(f)
}
})
}
@ -845,6 +837,59 @@ func (m historyLocationtrackingMods) RandomObjectid(f *faker.Faker) HistoryLocat
})
}
// Set the model columns to this value
func (m historyLocationtrackingMods) Created(val null.Val[time.Time]) HistoryLocationtrackingMod {
return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) {
o.Created = func() null.Val[time.Time] { return val }
})
}
// Set the Column from the function
func (m historyLocationtrackingMods) CreatedFunc(f func() null.Val[time.Time]) HistoryLocationtrackingMod {
return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) {
o.Created = f
})
}
// Clear any values for the column
func (m historyLocationtrackingMods) UnsetCreated() HistoryLocationtrackingMod {
return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) {
o.Created = nil
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m historyLocationtrackingMods) RandomCreated(f *faker.Faker) HistoryLocationtrackingMod {
return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) {
o.Created = func() null.Val[time.Time] {
if f == nil {
f = &defaultFaker
}
val := random_time_Time(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m historyLocationtrackingMods) RandomCreatedNotNull(f *faker.Faker) HistoryLocationtrackingMod {
return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) {
o.Created = func() null.Val[time.Time] {
if f == nil {
f = &defaultFaker
}
val := random_time_Time(f)
return null.From(val)
}
})
}
// Set the model columns to this value
func (m historyLocationtrackingMods) CreatedDate(val null.Val[int64]) HistoryLocationtrackingMod {
return HistoryLocationtrackingModFunc(func(_ context.Context, o *HistoryLocationtrackingTemplate) {

View file

@ -6,6 +6,7 @@ package factory
import (
"context"
"testing"
"time"
models "github.com/Gleipnir-Technology/nidus-sync/models"
"github.com/aarondl/opt/null"
@ -36,7 +37,7 @@ func (mods HistoryMosquitoinspectionModSlice) Apply(ctx context.Context, n *Hist
// HistoryMosquitoinspectionTemplate is an object representing the database table.
// all columns are optional and should be set by mods
type HistoryMosquitoinspectionTemplate struct {
OrganizationID func() null.Val[int32]
OrganizationID func() int32
Actiontaken func() null.Val[string]
Activity func() null.Val[string]
Adultact func() null.Val[string]
@ -88,6 +89,7 @@ type HistoryMosquitoinspectionTemplate struct {
Windspeed func() null.Val[float64]
Zone func() null.Val[string]
Zone2 func() null.Val[string]
Created func() null.Val[time.Time]
CreatedDate func() null.Val[int64]
CreatedUser func() null.Val[string]
GeometryX func() null.Val[float64]
@ -125,7 +127,7 @@ func (t HistoryMosquitoinspectionTemplate) setModelRels(o *models.HistoryMosquit
if t.r.Organization != nil {
rel := t.r.Organization.o.Build()
rel.R.HistoryMosquitoinspections = append(rel.R.HistoryMosquitoinspections, o)
o.OrganizationID = null.From(rel.ID) // h2
o.OrganizationID = rel.ID // h2
o.R.Organization = rel
}
}
@ -137,7 +139,7 @@ func (o HistoryMosquitoinspectionTemplate) BuildSetter() *models.HistoryMosquito
if o.OrganizationID != nil {
val := o.OrganizationID()
m.OrganizationID = omitnull.FromNull(val)
m.OrganizationID = omit.From(val)
}
if o.Actiontaken != nil {
val := o.Actiontaken()
@ -343,6 +345,10 @@ func (o HistoryMosquitoinspectionTemplate) BuildSetter() *models.HistoryMosquito
val := o.Zone2()
m.Zone2 = omitnull.FromNull(val)
}
if o.Created != nil {
val := o.Created()
m.Created = omitnull.FromNull(val)
}
if o.CreatedDate != nil {
val := o.CreatedDate()
m.CreatedDate = omitnull.FromNull(val)
@ -557,6 +563,9 @@ func (o HistoryMosquitoinspectionTemplate) Build() *models.HistoryMosquitoinspec
if o.Zone2 != nil {
m.Zone2 = o.Zone2()
}
if o.Created != nil {
m.Created = o.Created()
}
if o.CreatedDate != nil {
m.CreatedDate = o.CreatedDate()
}
@ -604,6 +613,10 @@ func (o HistoryMosquitoinspectionTemplate) BuildMany(number int) models.HistoryM
}
func ensureCreatableHistoryMosquitoinspection(m *models.HistoryMosquitoinspectionSetter) {
if !(m.OrganizationID.IsValue()) {
val := random_int32(nil)
m.OrganizationID = omit.From(val)
}
if !(m.Objectid.IsValue()) {
val := random_int32(nil)
m.Objectid = omit.From(val)
@ -620,25 +633,6 @@ func ensureCreatableHistoryMosquitoinspection(m *models.HistoryMosquitoinspectio
func (o *HistoryMosquitoinspectionTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryMosquitoinspection) error {
var err error
isOrganizationDone, _ := historyMosquitoinspectionRelOrganizationCtx.Value(ctx)
if !isOrganizationDone && o.r.Organization != nil {
ctx = historyMosquitoinspectionRelOrganizationCtx.WithValue(ctx, true)
if o.r.Organization.o.alreadyPersisted {
m.R.Organization = o.r.Organization.o.Build()
} else {
var rel0 *models.Organization
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return err
}
err = m.AttachOrganization(ctx, exec, rel0)
if err != nil {
return err
}
}
}
return err
}
@ -649,11 +643,30 @@ func (o *HistoryMosquitoinspectionTemplate) Create(ctx context.Context, exec bob
opt := o.BuildSetter()
ensureCreatableHistoryMosquitoinspection(opt)
if o.r.Organization == nil {
HistoryMosquitoinspectionMods.WithNewOrganization().Apply(ctx, o)
}
var rel0 *models.Organization
if o.r.Organization.o.alreadyPersisted {
rel0 = o.r.Organization.o.Build()
} else {
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return nil, err
}
}
opt.OrganizationID = omit.From(rel0.ID)
m, err := models.HistoryMosquitoinspections.Insert(opt).One(ctx, exec)
if err != nil {
return nil, err
}
m.R.Organization = rel0
if err := o.insertOptRels(ctx, exec, m); err != nil {
return nil, err
}
@ -783,6 +796,7 @@ func (m historyMosquitoinspectionMods) RandomizeAllColumns(f *faker.Faker) Histo
HistoryMosquitoinspectionMods.RandomWindspeed(f),
HistoryMosquitoinspectionMods.RandomZone(f),
HistoryMosquitoinspectionMods.RandomZone2(f),
HistoryMosquitoinspectionMods.RandomCreated(f),
HistoryMosquitoinspectionMods.RandomCreatedDate(f),
HistoryMosquitoinspectionMods.RandomCreatedUser(f),
HistoryMosquitoinspectionMods.RandomGeometryX(f),
@ -796,14 +810,14 @@ func (m historyMosquitoinspectionMods) RandomizeAllColumns(f *faker.Faker) Histo
}
// Set the model columns to this value
func (m historyMosquitoinspectionMods) OrganizationID(val null.Val[int32]) HistoryMosquitoinspectionMod {
func (m historyMosquitoinspectionMods) OrganizationID(val int32) HistoryMosquitoinspectionMod {
return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) {
o.OrganizationID = func() null.Val[int32] { return val }
o.OrganizationID = func() int32 { return val }
})
}
// Set the Column from the function
func (m historyMosquitoinspectionMods) OrganizationIDFunc(f func() null.Val[int32]) HistoryMosquitoinspectionMod {
func (m historyMosquitoinspectionMods) OrganizationIDFunc(f func() int32) HistoryMosquitoinspectionMod {
return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) {
o.OrganizationID = f
})
@ -818,32 +832,10 @@ func (m historyMosquitoinspectionMods) UnsetOrganizationID() HistoryMosquitoinsp
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m historyMosquitoinspectionMods) RandomOrganizationID(f *faker.Faker) HistoryMosquitoinspectionMod {
return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m historyMosquitoinspectionMods) RandomOrganizationIDNotNull(f *faker.Faker) HistoryMosquitoinspectionMod {
return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
o.OrganizationID = func() int32 {
return random_int32(f)
}
})
}
@ -3529,6 +3521,59 @@ func (m historyMosquitoinspectionMods) RandomZone2NotNull(f *faker.Faker) Histor
})
}
// Set the model columns to this value
func (m historyMosquitoinspectionMods) Created(val null.Val[time.Time]) HistoryMosquitoinspectionMod {
return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) {
o.Created = func() null.Val[time.Time] { return val }
})
}
// Set the Column from the function
func (m historyMosquitoinspectionMods) CreatedFunc(f func() null.Val[time.Time]) HistoryMosquitoinspectionMod {
return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) {
o.Created = f
})
}
// Clear any values for the column
func (m historyMosquitoinspectionMods) UnsetCreated() HistoryMosquitoinspectionMod {
return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) {
o.Created = nil
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m historyMosquitoinspectionMods) RandomCreated(f *faker.Faker) HistoryMosquitoinspectionMod {
return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) {
o.Created = func() null.Val[time.Time] {
if f == nil {
f = &defaultFaker
}
val := random_time_Time(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m historyMosquitoinspectionMods) RandomCreatedNotNull(f *faker.Faker) HistoryMosquitoinspectionMod {
return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) {
o.Created = func() null.Val[time.Time] {
if f == nil {
f = &defaultFaker
}
val := random_time_Time(f)
return null.From(val)
}
})
}
// Set the model columns to this value
func (m historyMosquitoinspectionMods) CreatedDate(val null.Val[int64]) HistoryMosquitoinspectionMod {
return HistoryMosquitoinspectionModFunc(func(_ context.Context, o *HistoryMosquitoinspectionTemplate) {

View file

@ -36,7 +36,7 @@ func (mods HistoryPointlocationModSlice) Apply(ctx context.Context, n *HistoryPo
// HistoryPointlocationTemplate is an object representing the database table.
// all columns are optional and should be set by mods
type HistoryPointlocationTemplate struct {
OrganizationID func() null.Val[int32]
OrganizationID func() int32
Accessdesc func() null.Val[string]
Active func() null.Val[int16]
Comments func() null.Val[string]
@ -112,7 +112,7 @@ func (t HistoryPointlocationTemplate) setModelRels(o *models.HistoryPointlocatio
if t.r.Organization != nil {
rel := t.r.Organization.o.Build()
rel.R.HistoryPointlocations = append(rel.R.HistoryPointlocations, o)
o.OrganizationID = null.From(rel.ID) // h2
o.OrganizationID = rel.ID // h2
o.R.Organization = rel
}
}
@ -124,7 +124,7 @@ func (o HistoryPointlocationTemplate) BuildSetter() *models.HistoryPointlocation
if o.OrganizationID != nil {
val := o.OrganizationID()
m.OrganizationID = omitnull.FromNull(val)
m.OrganizationID = omit.From(val)
}
if o.Accessdesc != nil {
val := o.Accessdesc()
@ -500,6 +500,10 @@ func (o HistoryPointlocationTemplate) BuildMany(number int) models.HistoryPointl
}
func ensureCreatableHistoryPointlocation(m *models.HistoryPointlocationSetter) {
if !(m.OrganizationID.IsValue()) {
val := random_int32(nil)
m.OrganizationID = omit.From(val)
}
if !(m.Objectid.IsValue()) {
val := random_int32(nil)
m.Objectid = omit.From(val)
@ -516,25 +520,6 @@ func ensureCreatableHistoryPointlocation(m *models.HistoryPointlocationSetter) {
func (o *HistoryPointlocationTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryPointlocation) error {
var err error
isOrganizationDone, _ := historyPointlocationRelOrganizationCtx.Value(ctx)
if !isOrganizationDone && o.r.Organization != nil {
ctx = historyPointlocationRelOrganizationCtx.WithValue(ctx, true)
if o.r.Organization.o.alreadyPersisted {
m.R.Organization = o.r.Organization.o.Build()
} else {
var rel0 *models.Organization
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return err
}
err = m.AttachOrganization(ctx, exec, rel0)
if err != nil {
return err
}
}
}
return err
}
@ -545,11 +530,30 @@ func (o *HistoryPointlocationTemplate) Create(ctx context.Context, exec bob.Exec
opt := o.BuildSetter()
ensureCreatableHistoryPointlocation(opt)
if o.r.Organization == nil {
HistoryPointlocationMods.WithNewOrganization().Apply(ctx, o)
}
var rel0 *models.Organization
if o.r.Organization.o.alreadyPersisted {
rel0 = o.r.Organization.o.Build()
} else {
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return nil, err
}
}
opt.OrganizationID = omit.From(rel0.ID)
m, err := models.HistoryPointlocations.Insert(opt).One(ctx, exec)
if err != nil {
return nil, err
}
m.R.Organization = rel0
if err := o.insertOptRels(ctx, exec, m); err != nil {
return nil, err
}
@ -679,14 +683,14 @@ func (m historyPointlocationMods) RandomizeAllColumns(f *faker.Faker) HistoryPoi
}
// Set the model columns to this value
func (m historyPointlocationMods) OrganizationID(val null.Val[int32]) HistoryPointlocationMod {
func (m historyPointlocationMods) OrganizationID(val int32) HistoryPointlocationMod {
return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) {
o.OrganizationID = func() null.Val[int32] { return val }
o.OrganizationID = func() int32 { return val }
})
}
// Set the Column from the function
func (m historyPointlocationMods) OrganizationIDFunc(f func() null.Val[int32]) HistoryPointlocationMod {
func (m historyPointlocationMods) OrganizationIDFunc(f func() int32) HistoryPointlocationMod {
return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) {
o.OrganizationID = f
})
@ -701,32 +705,10 @@ func (m historyPointlocationMods) UnsetOrganizationID() HistoryPointlocationMod
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m historyPointlocationMods) RandomOrganizationID(f *faker.Faker) HistoryPointlocationMod {
return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m historyPointlocationMods) RandomOrganizationIDNotNull(f *faker.Faker) HistoryPointlocationMod {
return HistoryPointlocationModFunc(func(_ context.Context, o *HistoryPointlocationTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
o.OrganizationID = func() int32 {
return random_int32(f)
}
})
}

View file

@ -36,7 +36,7 @@ func (mods HistoryPolygonlocationModSlice) Apply(ctx context.Context, n *History
// HistoryPolygonlocationTemplate is an object representing the database table.
// all columns are optional and should be set by mods
type HistoryPolygonlocationTemplate struct {
OrganizationID func() null.Val[int32]
OrganizationID func() int32
Accessdesc func() null.Val[string]
Acres func() null.Val[float64]
Active func() null.Val[int16]
@ -110,7 +110,7 @@ func (t HistoryPolygonlocationTemplate) setModelRels(o *models.HistoryPolygonloc
if t.r.Organization != nil {
rel := t.r.Organization.o.Build()
rel.R.HistoryPolygonlocations = append(rel.R.HistoryPolygonlocations, o)
o.OrganizationID = null.From(rel.ID) // h2
o.OrganizationID = rel.ID // h2
o.R.Organization = rel
}
}
@ -122,7 +122,7 @@ func (o HistoryPolygonlocationTemplate) BuildSetter() *models.HistoryPolygonloca
if o.OrganizationID != nil {
val := o.OrganizationID()
m.OrganizationID = omitnull.FromNull(val)
m.OrganizationID = omit.From(val)
}
if o.Accessdesc != nil {
val := o.Accessdesc()
@ -484,6 +484,10 @@ func (o HistoryPolygonlocationTemplate) BuildMany(number int) models.HistoryPoly
}
func ensureCreatableHistoryPolygonlocation(m *models.HistoryPolygonlocationSetter) {
if !(m.OrganizationID.IsValue()) {
val := random_int32(nil)
m.OrganizationID = omit.From(val)
}
if !(m.Objectid.IsValue()) {
val := random_int32(nil)
m.Objectid = omit.From(val)
@ -500,25 +504,6 @@ func ensureCreatableHistoryPolygonlocation(m *models.HistoryPolygonlocationSette
func (o *HistoryPolygonlocationTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryPolygonlocation) error {
var err error
isOrganizationDone, _ := historyPolygonlocationRelOrganizationCtx.Value(ctx)
if !isOrganizationDone && o.r.Organization != nil {
ctx = historyPolygonlocationRelOrganizationCtx.WithValue(ctx, true)
if o.r.Organization.o.alreadyPersisted {
m.R.Organization = o.r.Organization.o.Build()
} else {
var rel0 *models.Organization
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return err
}
err = m.AttachOrganization(ctx, exec, rel0)
if err != nil {
return err
}
}
}
return err
}
@ -529,11 +514,30 @@ func (o *HistoryPolygonlocationTemplate) Create(ctx context.Context, exec bob.Ex
opt := o.BuildSetter()
ensureCreatableHistoryPolygonlocation(opt)
if o.r.Organization == nil {
HistoryPolygonlocationMods.WithNewOrganization().Apply(ctx, o)
}
var rel0 *models.Organization
if o.r.Organization.o.alreadyPersisted {
rel0 = o.r.Organization.o.Build()
} else {
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return nil, err
}
}
opt.OrganizationID = omit.From(rel0.ID)
m, err := models.HistoryPolygonlocations.Insert(opt).One(ctx, exec)
if err != nil {
return nil, err
}
m.R.Organization = rel0
if err := o.insertOptRels(ctx, exec, m); err != nil {
return nil, err
}
@ -661,14 +665,14 @@ func (m historyPolygonlocationMods) RandomizeAllColumns(f *faker.Faker) HistoryP
}
// Set the model columns to this value
func (m historyPolygonlocationMods) OrganizationID(val null.Val[int32]) HistoryPolygonlocationMod {
func (m historyPolygonlocationMods) OrganizationID(val int32) HistoryPolygonlocationMod {
return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) {
o.OrganizationID = func() null.Val[int32] { return val }
o.OrganizationID = func() int32 { return val }
})
}
// Set the Column from the function
func (m historyPolygonlocationMods) OrganizationIDFunc(f func() null.Val[int32]) HistoryPolygonlocationMod {
func (m historyPolygonlocationMods) OrganizationIDFunc(f func() int32) HistoryPolygonlocationMod {
return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) {
o.OrganizationID = f
})
@ -683,32 +687,10 @@ func (m historyPolygonlocationMods) UnsetOrganizationID() HistoryPolygonlocation
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m historyPolygonlocationMods) RandomOrganizationID(f *faker.Faker) HistoryPolygonlocationMod {
return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m historyPolygonlocationMods) RandomOrganizationIDNotNull(f *faker.Faker) HistoryPolygonlocationMod {
return HistoryPolygonlocationModFunc(func(_ context.Context, o *HistoryPolygonlocationTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
o.OrganizationID = func() int32 {
return random_int32(f)
}
})
}

View file

@ -6,6 +6,7 @@ package factory
import (
"context"
"testing"
"time"
models "github.com/Gleipnir-Technology/nidus-sync/models"
"github.com/aarondl/opt/null"
@ -36,7 +37,7 @@ func (mods HistoryPoolModSlice) Apply(ctx context.Context, n *HistoryPoolTemplat
// HistoryPoolTemplate is an object representing the database table.
// all columns are optional and should be set by mods
type HistoryPoolTemplate struct {
OrganizationID func() null.Val[int32]
OrganizationID func() int32
Comments func() null.Val[string]
Creationdate func() null.Val[int64]
Creator func() null.Val[string]
@ -58,6 +59,7 @@ type HistoryPoolTemplate struct {
Testmethod func() null.Val[string]
Testtech func() null.Val[string]
TrapdataID func() null.Val[string]
Created func() null.Val[time.Time]
CreatedDate func() null.Val[int64]
CreatedUser func() null.Val[string]
GeometryX func() null.Val[float64]
@ -96,7 +98,7 @@ func (t HistoryPoolTemplate) setModelRels(o *models.HistoryPool) {
if t.r.Organization != nil {
rel := t.r.Organization.o.Build()
rel.R.HistoryPools = append(rel.R.HistoryPools, o)
o.OrganizationID = null.From(rel.ID) // h2
o.OrganizationID = rel.ID // h2
o.R.Organization = rel
}
}
@ -108,7 +110,7 @@ func (o HistoryPoolTemplate) BuildSetter() *models.HistoryPoolSetter {
if o.OrganizationID != nil {
val := o.OrganizationID()
m.OrganizationID = omitnull.FromNull(val)
m.OrganizationID = omit.From(val)
}
if o.Comments != nil {
val := o.Comments()
@ -194,6 +196,10 @@ func (o HistoryPoolTemplate) BuildSetter() *models.HistoryPoolSetter {
val := o.TrapdataID()
m.TrapdataID = omitnull.FromNull(val)
}
if o.Created != nil {
val := o.Created()
m.Created = omitnull.FromNull(val)
}
if o.CreatedDate != nil {
val := o.CreatedDate()
m.CreatedDate = omitnull.FromNull(val)
@ -322,6 +328,9 @@ func (o HistoryPoolTemplate) Build() *models.HistoryPool {
if o.TrapdataID != nil {
m.TrapdataID = o.TrapdataID()
}
if o.Created != nil {
m.Created = o.Created()
}
if o.CreatedDate != nil {
m.CreatedDate = o.CreatedDate()
}
@ -372,6 +381,10 @@ func (o HistoryPoolTemplate) BuildMany(number int) models.HistoryPoolSlice {
}
func ensureCreatableHistoryPool(m *models.HistoryPoolSetter) {
if !(m.OrganizationID.IsValue()) {
val := random_int32(nil)
m.OrganizationID = omit.From(val)
}
if !(m.Objectid.IsValue()) {
val := random_int32(nil)
m.Objectid = omit.From(val)
@ -388,25 +401,6 @@ func ensureCreatableHistoryPool(m *models.HistoryPoolSetter) {
func (o *HistoryPoolTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryPool) error {
var err error
isOrganizationDone, _ := historyPoolRelOrganizationCtx.Value(ctx)
if !isOrganizationDone && o.r.Organization != nil {
ctx = historyPoolRelOrganizationCtx.WithValue(ctx, true)
if o.r.Organization.o.alreadyPersisted {
m.R.Organization = o.r.Organization.o.Build()
} else {
var rel0 *models.Organization
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return err
}
err = m.AttachOrganization(ctx, exec, rel0)
if err != nil {
return err
}
}
}
return err
}
@ -417,11 +411,30 @@ func (o *HistoryPoolTemplate) Create(ctx context.Context, exec bob.Executor) (*m
opt := o.BuildSetter()
ensureCreatableHistoryPool(opt)
if o.r.Organization == nil {
HistoryPoolMods.WithNewOrganization().Apply(ctx, o)
}
var rel0 *models.Organization
if o.r.Organization.o.alreadyPersisted {
rel0 = o.r.Organization.o.Build()
} else {
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return nil, err
}
}
opt.OrganizationID = omit.From(rel0.ID)
m, err := models.HistoryPools.Insert(opt).One(ctx, exec)
if err != nil {
return nil, err
}
m.R.Organization = rel0
if err := o.insertOptRels(ctx, exec, m); err != nil {
return nil, err
}
@ -521,6 +534,7 @@ func (m historyPoolMods) RandomizeAllColumns(f *faker.Faker) HistoryPoolMod {
HistoryPoolMods.RandomTestmethod(f),
HistoryPoolMods.RandomTesttech(f),
HistoryPoolMods.RandomTrapdataID(f),
HistoryPoolMods.RandomCreated(f),
HistoryPoolMods.RandomCreatedDate(f),
HistoryPoolMods.RandomCreatedUser(f),
HistoryPoolMods.RandomGeometryX(f),
@ -535,14 +549,14 @@ func (m historyPoolMods) RandomizeAllColumns(f *faker.Faker) HistoryPoolMod {
}
// Set the model columns to this value
func (m historyPoolMods) OrganizationID(val null.Val[int32]) HistoryPoolMod {
func (m historyPoolMods) OrganizationID(val int32) HistoryPoolMod {
return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) {
o.OrganizationID = func() null.Val[int32] { return val }
o.OrganizationID = func() int32 { return val }
})
}
// Set the Column from the function
func (m historyPoolMods) OrganizationIDFunc(f func() null.Val[int32]) HistoryPoolMod {
func (m historyPoolMods) OrganizationIDFunc(f func() int32) HistoryPoolMod {
return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) {
o.OrganizationID = f
})
@ -557,32 +571,10 @@ func (m historyPoolMods) UnsetOrganizationID() HistoryPoolMod {
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m historyPoolMods) RandomOrganizationID(f *faker.Faker) HistoryPoolMod {
return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m historyPoolMods) RandomOrganizationIDNotNull(f *faker.Faker) HistoryPoolMod {
return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
o.OrganizationID = func() int32 {
return random_int32(f)
}
})
}
@ -1678,6 +1670,59 @@ func (m historyPoolMods) RandomTrapdataIDNotNull(f *faker.Faker) HistoryPoolMod
})
}
// Set the model columns to this value
func (m historyPoolMods) Created(val null.Val[time.Time]) HistoryPoolMod {
return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) {
o.Created = func() null.Val[time.Time] { return val }
})
}
// Set the Column from the function
func (m historyPoolMods) CreatedFunc(f func() null.Val[time.Time]) HistoryPoolMod {
return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) {
o.Created = f
})
}
// Clear any values for the column
func (m historyPoolMods) UnsetCreated() HistoryPoolMod {
return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) {
o.Created = nil
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m historyPoolMods) RandomCreated(f *faker.Faker) HistoryPoolMod {
return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) {
o.Created = func() null.Val[time.Time] {
if f == nil {
f = &defaultFaker
}
val := random_time_Time(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m historyPoolMods) RandomCreatedNotNull(f *faker.Faker) HistoryPoolMod {
return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) {
o.Created = func() null.Val[time.Time] {
if f == nil {
f = &defaultFaker
}
val := random_time_Time(f)
return null.From(val)
}
})
}
// Set the model columns to this value
func (m historyPoolMods) CreatedDate(val null.Val[int64]) HistoryPoolMod {
return HistoryPoolModFunc(func(_ context.Context, o *HistoryPoolTemplate) {

View file

@ -6,6 +6,7 @@ package factory
import (
"context"
"testing"
"time"
models "github.com/Gleipnir-Technology/nidus-sync/models"
"github.com/aarondl/opt/null"
@ -36,7 +37,7 @@ func (mods HistoryPooldetailModSlice) Apply(ctx context.Context, n *HistoryPoold
// HistoryPooldetailTemplate is an object representing the database table.
// all columns are optional and should be set by mods
type HistoryPooldetailTemplate struct {
OrganizationID func() null.Val[int32]
OrganizationID func() int32
Creationdate func() null.Val[int64]
Creator func() null.Val[string]
Editdate func() null.Val[int64]
@ -47,6 +48,7 @@ type HistoryPooldetailTemplate struct {
PoolID func() null.Val[string]
Species func() null.Val[string]
TrapdataID func() null.Val[string]
Created func() null.Val[time.Time]
CreatedDate func() null.Val[int64]
CreatedUser func() null.Val[string]
GeometryX func() null.Val[float64]
@ -82,7 +84,7 @@ func (t HistoryPooldetailTemplate) setModelRels(o *models.HistoryPooldetail) {
if t.r.Organization != nil {
rel := t.r.Organization.o.Build()
rel.R.HistoryPooldetails = append(rel.R.HistoryPooldetails, o)
o.OrganizationID = null.From(rel.ID) // h2
o.OrganizationID = rel.ID // h2
o.R.Organization = rel
}
}
@ -94,7 +96,7 @@ func (o HistoryPooldetailTemplate) BuildSetter() *models.HistoryPooldetailSetter
if o.OrganizationID != nil {
val := o.OrganizationID()
m.OrganizationID = omitnull.FromNull(val)
m.OrganizationID = omit.From(val)
}
if o.Creationdate != nil {
val := o.Creationdate()
@ -136,6 +138,10 @@ func (o HistoryPooldetailTemplate) BuildSetter() *models.HistoryPooldetailSetter
val := o.TrapdataID()
m.TrapdataID = omitnull.FromNull(val)
}
if o.Created != nil {
val := o.Created()
m.Created = omitnull.FromNull(val)
}
if o.CreatedDate != nil {
val := o.CreatedDate()
m.CreatedDate = omitnull.FromNull(val)
@ -219,6 +225,9 @@ func (o HistoryPooldetailTemplate) Build() *models.HistoryPooldetail {
if o.TrapdataID != nil {
m.TrapdataID = o.TrapdataID()
}
if o.Created != nil {
m.Created = o.Created()
}
if o.CreatedDate != nil {
m.CreatedDate = o.CreatedDate()
}
@ -260,6 +269,10 @@ func (o HistoryPooldetailTemplate) BuildMany(number int) models.HistoryPooldetai
}
func ensureCreatableHistoryPooldetail(m *models.HistoryPooldetailSetter) {
if !(m.OrganizationID.IsValue()) {
val := random_int32(nil)
m.OrganizationID = omit.From(val)
}
if !(m.Objectid.IsValue()) {
val := random_int32(nil)
m.Objectid = omit.From(val)
@ -276,25 +289,6 @@ func ensureCreatableHistoryPooldetail(m *models.HistoryPooldetailSetter) {
func (o *HistoryPooldetailTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.HistoryPooldetail) error {
var err error
isOrganizationDone, _ := historyPooldetailRelOrganizationCtx.Value(ctx)
if !isOrganizationDone && o.r.Organization != nil {
ctx = historyPooldetailRelOrganizationCtx.WithValue(ctx, true)
if o.r.Organization.o.alreadyPersisted {
m.R.Organization = o.r.Organization.o.Build()
} else {
var rel0 *models.Organization
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return err
}
err = m.AttachOrganization(ctx, exec, rel0)
if err != nil {
return err
}
}
}
return err
}
@ -305,11 +299,30 @@ func (o *HistoryPooldetailTemplate) Create(ctx context.Context, exec bob.Executo
opt := o.BuildSetter()
ensureCreatableHistoryPooldetail(opt)
if o.r.Organization == nil {
HistoryPooldetailMods.WithNewOrganization().Apply(ctx, o)
}
var rel0 *models.Organization
if o.r.Organization.o.alreadyPersisted {
rel0 = o.r.Organization.o.Build()
} else {
rel0, err = o.r.Organization.o.Create(ctx, exec)
if err != nil {
return nil, err
}
}
opt.OrganizationID = omit.From(rel0.ID)
m, err := models.HistoryPooldetails.Insert(opt).One(ctx, exec)
if err != nil {
return nil, err
}
m.R.Organization = rel0
if err := o.insertOptRels(ctx, exec, m); err != nil {
return nil, err
}
@ -398,6 +411,7 @@ func (m historyPooldetailMods) RandomizeAllColumns(f *faker.Faker) HistoryPoolde
HistoryPooldetailMods.RandomPoolID(f),
HistoryPooldetailMods.RandomSpecies(f),
HistoryPooldetailMods.RandomTrapdataID(f),
HistoryPooldetailMods.RandomCreated(f),
HistoryPooldetailMods.RandomCreatedDate(f),
HistoryPooldetailMods.RandomCreatedUser(f),
HistoryPooldetailMods.RandomGeometryX(f),
@ -409,14 +423,14 @@ func (m historyPooldetailMods) RandomizeAllColumns(f *faker.Faker) HistoryPoolde
}
// Set the model columns to this value
func (m historyPooldetailMods) OrganizationID(val null.Val[int32]) HistoryPooldetailMod {
func (m historyPooldetailMods) OrganizationID(val int32) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
o.OrganizationID = func() null.Val[int32] { return val }
o.OrganizationID = func() int32 { return val }
})
}
// Set the Column from the function
func (m historyPooldetailMods) OrganizationIDFunc(f func() null.Val[int32]) HistoryPooldetailMod {
func (m historyPooldetailMods) OrganizationIDFunc(f func() int32) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
o.OrganizationID = f
})
@ -431,32 +445,10 @@ func (m historyPooldetailMods) UnsetOrganizationID() HistoryPooldetailMod {
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m historyPooldetailMods) RandomOrganizationID(f *faker.Faker) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m historyPooldetailMods) RandomOrganizationIDNotNull(f *faker.Faker) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
o.OrganizationID = func() null.Val[int32] {
if f == nil {
f = &defaultFaker
}
val := random_int32(f)
return null.From(val)
o.OrganizationID = func() int32 {
return random_int32(f)
}
})
}
@ -969,6 +961,59 @@ func (m historyPooldetailMods) RandomTrapdataIDNotNull(f *faker.Faker) HistoryPo
})
}
// Set the model columns to this value
func (m historyPooldetailMods) Created(val null.Val[time.Time]) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
o.Created = func() null.Val[time.Time] { return val }
})
}
// Set the Column from the function
func (m historyPooldetailMods) CreatedFunc(f func() null.Val[time.Time]) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
o.Created = f
})
}
// Clear any values for the column
func (m historyPooldetailMods) UnsetCreated() HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
o.Created = nil
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m historyPooldetailMods) RandomCreated(f *faker.Faker) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
o.Created = func() null.Val[time.Time] {
if f == nil {
f = &defaultFaker
}
val := random_time_Time(f)
return null.From(val)
}
})
}
// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m historyPooldetailMods) RandomCreatedNotNull(f *faker.Faker) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {
o.Created = func() null.Val[time.Time] {
if f == nil {
f = &defaultFaker
}
val := random_time_Time(f)
return null.From(val)
}
})
}
// Set the model columns to this value
func (m historyPooldetailMods) CreatedDate(val null.Val[int64]) HistoryPooldetailMod {
return HistoryPooldetailModFunc(func(_ context.Context, o *HistoryPooldetailTemplate) {

Some files were not shown because too many files have changed in this diff Show more