This requires a bunch of changes since the types on these tables are much closer to the underlying types of the Fieldseeker data we are getting back from the API. I now need to use proper UUID types everywhere, which means I had to modify the bob gen config to consistently use google UUID, my UUID library of choice. I also had to add the organization_id to all the fieldseeker tables since we rely on them existing for some of our compound queries. There were some changes to the API type signatures to get things to build. I may yet regret those.
6680 lines
188 KiB
Go
6680 lines
188 KiB
Go
// Code generated by BobGen psql v0.0.4-0.20251216163753-8e325b7c773a+dirty. DO NOT EDIT.
|
|
// This file is meant to be re-generated in place and/or deleted at any time.
|
|
|
|
package models
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"io"
|
|
|
|
"github.com/aarondl/opt/null"
|
|
"github.com/aarondl/opt/omit"
|
|
"github.com/aarondl/opt/omitnull"
|
|
"github.com/stephenafamo/bob"
|
|
"github.com/stephenafamo/bob/dialect/psql"
|
|
"github.com/stephenafamo/bob/dialect/psql/dialect"
|
|
"github.com/stephenafamo/bob/dialect/psql/dm"
|
|
"github.com/stephenafamo/bob/dialect/psql/sm"
|
|
"github.com/stephenafamo/bob/dialect/psql/um"
|
|
"github.com/stephenafamo/bob/expr"
|
|
"github.com/stephenafamo/bob/mods"
|
|
"github.com/stephenafamo/bob/orm"
|
|
"github.com/stephenafamo/bob/types/pgtypes"
|
|
)
|
|
|
|
// Organization is an object representing the database table.
|
|
type Organization struct {
|
|
ID int32 `db:"id,pk" `
|
|
Name null.Val[string] `db:"name" `
|
|
ArcgisID null.Val[string] `db:"arcgis_id" `
|
|
ArcgisName null.Val[string] `db:"arcgis_name" `
|
|
FieldseekerURL null.Val[string] `db:"fieldseeker_url" `
|
|
|
|
R organizationR `db:"-" `
|
|
}
|
|
|
|
// OrganizationSlice is an alias for a slice of pointers to Organization.
|
|
// This should almost always be used instead of []*Organization.
|
|
type OrganizationSlice []*Organization
|
|
|
|
// Organizations contains methods to work with the organization table
|
|
var Organizations = psql.NewTablex[*Organization, OrganizationSlice, *OrganizationSetter]("", "organization", buildOrganizationColumns("organization"))
|
|
|
|
// OrganizationsQuery is a query on the organization table
|
|
type OrganizationsQuery = *psql.ViewQuery[*Organization, OrganizationSlice]
|
|
|
|
// organizationR is where relationships are stored.
|
|
type organizationR struct {
|
|
Containerrelates FieldseekerContainerrelateSlice // fieldseeker.containerrelate.containerrelate_organization_id_fkey
|
|
Fieldscoutinglogs FieldseekerFieldscoutinglogSlice // fieldseeker.fieldscoutinglog.fieldscoutinglog_organization_id_fkey
|
|
Habitatrelates FieldseekerHabitatrelateSlice // fieldseeker.habitatrelate.habitatrelate_organization_id_fkey
|
|
Inspectionsamples FieldseekerInspectionsampleSlice // fieldseeker.inspectionsample.inspectionsample_organization_id_fkey
|
|
Inspectionsampledetails FieldseekerInspectionsampledetailSlice // fieldseeker.inspectionsampledetail.inspectionsampledetail_organization_id_fkey
|
|
Linelocations FieldseekerLinelocationSlice // fieldseeker.linelocation.linelocation_organization_id_fkey
|
|
Locationtrackings FieldseekerLocationtrackingSlice // fieldseeker.locationtracking.locationtracking_organization_id_fkey
|
|
Mosquitoinspections FieldseekerMosquitoinspectionSlice // fieldseeker.mosquitoinspection.mosquitoinspection_organization_id_fkey
|
|
Pointlocations FieldseekerPointlocationSlice // fieldseeker.pointlocation.pointlocation_organization_id_fkey
|
|
Polygonlocations FieldseekerPolygonlocationSlice // fieldseeker.polygonlocation.polygonlocation_organization_id_fkey
|
|
Pools FieldseekerPoolSlice // fieldseeker.pool.pool_organization_id_fkey
|
|
Pooldetails FieldseekerPooldetailSlice // fieldseeker.pooldetail.pooldetail_organization_id_fkey
|
|
Proposedtreatmentareas FieldseekerProposedtreatmentareaSlice // fieldseeker.proposedtreatmentarea.proposedtreatmentarea_organization_id_fkey
|
|
Qamosquitoinspections FieldseekerQamosquitoinspectionSlice // fieldseeker.qamosquitoinspection.qamosquitoinspection_organization_id_fkey
|
|
Rodentlocations FieldseekerRodentlocationSlice // fieldseeker.rodentlocation.rodentlocation_organization_id_fkey
|
|
Samplecollections FieldseekerSamplecollectionSlice // fieldseeker.samplecollection.samplecollection_organization_id_fkey
|
|
Samplelocations FieldseekerSamplelocationSlice // fieldseeker.samplelocation.samplelocation_organization_id_fkey
|
|
Servicerequests FieldseekerServicerequestSlice // fieldseeker.servicerequest.servicerequest_organization_id_fkey
|
|
Speciesabundances FieldseekerSpeciesabundanceSlice // fieldseeker.speciesabundance.speciesabundance_organization_id_fkey
|
|
Stormdrains FieldseekerStormdrainSlice // fieldseeker.stormdrain.stormdrain_organization_id_fkey
|
|
Timecards FieldseekerTimecardSlice // fieldseeker.timecard.timecard_organization_id_fkey
|
|
Trapdata FieldseekerTrapdatumSlice // fieldseeker.trapdata.trapdata_organization_id_fkey
|
|
Traplocations FieldseekerTraplocationSlice // fieldseeker.traplocation.traplocation_organization_id_fkey
|
|
Treatments FieldseekerTreatmentSlice // fieldseeker.treatment.treatment_organization_id_fkey
|
|
Treatmentareas FieldseekerTreatmentareaSlice // fieldseeker.treatmentarea.treatmentarea_organization_id_fkey
|
|
Zones FieldseekerZoneSlice // fieldseeker.zones.zones_organization_id_fkey
|
|
Zones2s FieldseekerZones2Slice // fieldseeker.zones2.zones2_organization_id_fkey
|
|
FieldseekerSyncs FieldseekerSyncSlice // fieldseeker_sync.fieldseeker_sync_organization_id_fkey
|
|
H3Aggregations H3AggregationSlice // h3_aggregation.h3_aggregation_organization_id_fkey
|
|
NoteAudios NoteAudioSlice // note_audio.note_audio_organization_id_fkey
|
|
NoteImages NoteImageSlice // note_image.note_image_organization_id_fkey
|
|
User UserSlice // user_.user__organization_id_fkey
|
|
}
|
|
|
|
func buildOrganizationColumns(alias string) organizationColumns {
|
|
return organizationColumns{
|
|
ColumnsExpr: expr.NewColumnsExpr(
|
|
"id", "name", "arcgis_id", "arcgis_name", "fieldseeker_url",
|
|
).WithParent("organization"),
|
|
tableAlias: alias,
|
|
ID: psql.Quote(alias, "id"),
|
|
Name: psql.Quote(alias, "name"),
|
|
ArcgisID: psql.Quote(alias, "arcgis_id"),
|
|
ArcgisName: psql.Quote(alias, "arcgis_name"),
|
|
FieldseekerURL: psql.Quote(alias, "fieldseeker_url"),
|
|
}
|
|
}
|
|
|
|
type organizationColumns struct {
|
|
expr.ColumnsExpr
|
|
tableAlias string
|
|
ID psql.Expression
|
|
Name psql.Expression
|
|
ArcgisID psql.Expression
|
|
ArcgisName psql.Expression
|
|
FieldseekerURL psql.Expression
|
|
}
|
|
|
|
func (c organizationColumns) Alias() string {
|
|
return c.tableAlias
|
|
}
|
|
|
|
func (organizationColumns) AliasedAs(alias string) organizationColumns {
|
|
return buildOrganizationColumns(alias)
|
|
}
|
|
|
|
// OrganizationSetter is used for insert/upsert/update operations
|
|
// All values are optional, and do not have to be set
|
|
// Generated columns are not included
|
|
type OrganizationSetter struct {
|
|
ID omit.Val[int32] `db:"id,pk" `
|
|
Name omitnull.Val[string] `db:"name" `
|
|
ArcgisID omitnull.Val[string] `db:"arcgis_id" `
|
|
ArcgisName omitnull.Val[string] `db:"arcgis_name" `
|
|
FieldseekerURL omitnull.Val[string] `db:"fieldseeker_url" `
|
|
}
|
|
|
|
func (s OrganizationSetter) SetColumns() []string {
|
|
vals := make([]string, 0, 5)
|
|
if s.ID.IsValue() {
|
|
vals = append(vals, "id")
|
|
}
|
|
if !s.Name.IsUnset() {
|
|
vals = append(vals, "name")
|
|
}
|
|
if !s.ArcgisID.IsUnset() {
|
|
vals = append(vals, "arcgis_id")
|
|
}
|
|
if !s.ArcgisName.IsUnset() {
|
|
vals = append(vals, "arcgis_name")
|
|
}
|
|
if !s.FieldseekerURL.IsUnset() {
|
|
vals = append(vals, "fieldseeker_url")
|
|
}
|
|
return vals
|
|
}
|
|
|
|
func (s OrganizationSetter) Overwrite(t *Organization) {
|
|
if s.ID.IsValue() {
|
|
t.ID = s.ID.MustGet()
|
|
}
|
|
if !s.Name.IsUnset() {
|
|
t.Name = s.Name.MustGetNull()
|
|
}
|
|
if !s.ArcgisID.IsUnset() {
|
|
t.ArcgisID = s.ArcgisID.MustGetNull()
|
|
}
|
|
if !s.ArcgisName.IsUnset() {
|
|
t.ArcgisName = s.ArcgisName.MustGetNull()
|
|
}
|
|
if !s.FieldseekerURL.IsUnset() {
|
|
t.FieldseekerURL = s.FieldseekerURL.MustGetNull()
|
|
}
|
|
}
|
|
|
|
func (s *OrganizationSetter) Apply(q *dialect.InsertQuery) {
|
|
q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) {
|
|
return Organizations.BeforeInsertHooks.RunHooks(ctx, exec, s)
|
|
})
|
|
|
|
q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) {
|
|
vals := make([]bob.Expression, 5)
|
|
if s.ID.IsValue() {
|
|
vals[0] = psql.Arg(s.ID.MustGet())
|
|
} else {
|
|
vals[0] = psql.Raw("DEFAULT")
|
|
}
|
|
|
|
if !s.Name.IsUnset() {
|
|
vals[1] = psql.Arg(s.Name.MustGetNull())
|
|
} else {
|
|
vals[1] = psql.Raw("DEFAULT")
|
|
}
|
|
|
|
if !s.ArcgisID.IsUnset() {
|
|
vals[2] = psql.Arg(s.ArcgisID.MustGetNull())
|
|
} else {
|
|
vals[2] = psql.Raw("DEFAULT")
|
|
}
|
|
|
|
if !s.ArcgisName.IsUnset() {
|
|
vals[3] = psql.Arg(s.ArcgisName.MustGetNull())
|
|
} else {
|
|
vals[3] = psql.Raw("DEFAULT")
|
|
}
|
|
|
|
if !s.FieldseekerURL.IsUnset() {
|
|
vals[4] = psql.Arg(s.FieldseekerURL.MustGetNull())
|
|
} else {
|
|
vals[4] = psql.Raw("DEFAULT")
|
|
}
|
|
|
|
return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "")
|
|
}))
|
|
}
|
|
|
|
func (s OrganizationSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] {
|
|
return um.Set(s.Expressions()...)
|
|
}
|
|
|
|
func (s OrganizationSetter) Expressions(prefix ...string) []bob.Expression {
|
|
exprs := make([]bob.Expression, 0, 5)
|
|
|
|
if s.ID.IsValue() {
|
|
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
|
psql.Quote(append(prefix, "id")...),
|
|
psql.Arg(s.ID),
|
|
}})
|
|
}
|
|
|
|
if !s.Name.IsUnset() {
|
|
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
|
psql.Quote(append(prefix, "name")...),
|
|
psql.Arg(s.Name),
|
|
}})
|
|
}
|
|
|
|
if !s.ArcgisID.IsUnset() {
|
|
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
|
psql.Quote(append(prefix, "arcgis_id")...),
|
|
psql.Arg(s.ArcgisID),
|
|
}})
|
|
}
|
|
|
|
if !s.ArcgisName.IsUnset() {
|
|
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
|
psql.Quote(append(prefix, "arcgis_name")...),
|
|
psql.Arg(s.ArcgisName),
|
|
}})
|
|
}
|
|
|
|
if !s.FieldseekerURL.IsUnset() {
|
|
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
|
psql.Quote(append(prefix, "fieldseeker_url")...),
|
|
psql.Arg(s.FieldseekerURL),
|
|
}})
|
|
}
|
|
|
|
return exprs
|
|
}
|
|
|
|
// FindOrganization retrieves a single record by primary key
|
|
// If cols is empty Find will return all columns.
|
|
func FindOrganization(ctx context.Context, exec bob.Executor, IDPK int32, cols ...string) (*Organization, error) {
|
|
if len(cols) == 0 {
|
|
return Organizations.Query(
|
|
sm.Where(Organizations.Columns.ID.EQ(psql.Arg(IDPK))),
|
|
).One(ctx, exec)
|
|
}
|
|
|
|
return Organizations.Query(
|
|
sm.Where(Organizations.Columns.ID.EQ(psql.Arg(IDPK))),
|
|
sm.Columns(Organizations.Columns.Only(cols...)),
|
|
).One(ctx, exec)
|
|
}
|
|
|
|
// OrganizationExists checks the presence of a single record by primary key
|
|
func OrganizationExists(ctx context.Context, exec bob.Executor, IDPK int32) (bool, error) {
|
|
return Organizations.Query(
|
|
sm.Where(Organizations.Columns.ID.EQ(psql.Arg(IDPK))),
|
|
).Exists(ctx, exec)
|
|
}
|
|
|
|
// AfterQueryHook is called after Organization is retrieved from the database
|
|
func (o *Organization) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error {
|
|
var err error
|
|
|
|
switch queryType {
|
|
case bob.QueryTypeSelect:
|
|
ctx, err = Organizations.AfterSelectHooks.RunHooks(ctx, exec, OrganizationSlice{o})
|
|
case bob.QueryTypeInsert:
|
|
ctx, err = Organizations.AfterInsertHooks.RunHooks(ctx, exec, OrganizationSlice{o})
|
|
case bob.QueryTypeUpdate:
|
|
ctx, err = Organizations.AfterUpdateHooks.RunHooks(ctx, exec, OrganizationSlice{o})
|
|
case bob.QueryTypeDelete:
|
|
ctx, err = Organizations.AfterDeleteHooks.RunHooks(ctx, exec, OrganizationSlice{o})
|
|
}
|
|
|
|
return err
|
|
}
|
|
|
|
// primaryKeyVals returns the primary key values of the Organization
|
|
func (o *Organization) primaryKeyVals() bob.Expression {
|
|
return psql.Arg(o.ID)
|
|
}
|
|
|
|
func (o *Organization) pkEQ() dialect.Expression {
|
|
return psql.Quote("organization", "id").EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) {
|
|
return o.primaryKeyVals().WriteSQL(ctx, w, d, start)
|
|
}))
|
|
}
|
|
|
|
// Update uses an executor to update the Organization
|
|
func (o *Organization) Update(ctx context.Context, exec bob.Executor, s *OrganizationSetter) error {
|
|
v, err := Organizations.Update(s.UpdateMod(), um.Where(o.pkEQ())).One(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
o.R = v.R
|
|
*o = *v
|
|
|
|
return nil
|
|
}
|
|
|
|
// Delete deletes a single Organization record with an executor
|
|
func (o *Organization) Delete(ctx context.Context, exec bob.Executor) error {
|
|
_, err := Organizations.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec)
|
|
return err
|
|
}
|
|
|
|
// Reload refreshes the Organization using the executor
|
|
func (o *Organization) Reload(ctx context.Context, exec bob.Executor) error {
|
|
o2, err := Organizations.Query(
|
|
sm.Where(Organizations.Columns.ID.EQ(psql.Arg(o.ID))),
|
|
).One(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
o2.R = o.R
|
|
*o = *o2
|
|
|
|
return nil
|
|
}
|
|
|
|
// AfterQueryHook is called after OrganizationSlice is retrieved from the database
|
|
func (o OrganizationSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error {
|
|
var err error
|
|
|
|
switch queryType {
|
|
case bob.QueryTypeSelect:
|
|
ctx, err = Organizations.AfterSelectHooks.RunHooks(ctx, exec, o)
|
|
case bob.QueryTypeInsert:
|
|
ctx, err = Organizations.AfterInsertHooks.RunHooks(ctx, exec, o)
|
|
case bob.QueryTypeUpdate:
|
|
ctx, err = Organizations.AfterUpdateHooks.RunHooks(ctx, exec, o)
|
|
case bob.QueryTypeDelete:
|
|
ctx, err = Organizations.AfterDeleteHooks.RunHooks(ctx, exec, o)
|
|
}
|
|
|
|
return err
|
|
}
|
|
|
|
func (o OrganizationSlice) pkIN() dialect.Expression {
|
|
if len(o) == 0 {
|
|
return psql.Raw("NULL")
|
|
}
|
|
|
|
return psql.Quote("organization", "id").In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) {
|
|
pkPairs := make([]bob.Expression, len(o))
|
|
for i, row := range o {
|
|
pkPairs[i] = row.primaryKeyVals()
|
|
}
|
|
return bob.ExpressSlice(ctx, w, d, start, pkPairs, "", ", ", "")
|
|
}))
|
|
}
|
|
|
|
// copyMatchingRows finds models in the given slice that have the same primary key
|
|
// then it first copies the existing relationships from the old model to the new model
|
|
// and then replaces the old model in the slice with the new model
|
|
func (o OrganizationSlice) copyMatchingRows(from ...*Organization) {
|
|
for i, old := range o {
|
|
for _, new := range from {
|
|
if new.ID != old.ID {
|
|
continue
|
|
}
|
|
new.R = old.R
|
|
o[i] = new
|
|
break
|
|
}
|
|
}
|
|
}
|
|
|
|
// UpdateMod modifies an update query with "WHERE primary_key IN (o...)"
|
|
func (o OrganizationSlice) UpdateMod() bob.Mod[*dialect.UpdateQuery] {
|
|
return bob.ModFunc[*dialect.UpdateQuery](func(q *dialect.UpdateQuery) {
|
|
q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) {
|
|
return Organizations.BeforeUpdateHooks.RunHooks(ctx, exec, o)
|
|
})
|
|
|
|
q.AppendLoader(bob.LoaderFunc(func(ctx context.Context, exec bob.Executor, retrieved any) error {
|
|
var err error
|
|
switch retrieved := retrieved.(type) {
|
|
case *Organization:
|
|
o.copyMatchingRows(retrieved)
|
|
case []*Organization:
|
|
o.copyMatchingRows(retrieved...)
|
|
case OrganizationSlice:
|
|
o.copyMatchingRows(retrieved...)
|
|
default:
|
|
// If the retrieved value is not a Organization or a slice of Organization
|
|
// then run the AfterUpdateHooks on the slice
|
|
_, err = Organizations.AfterUpdateHooks.RunHooks(ctx, exec, o)
|
|
}
|
|
|
|
return err
|
|
}))
|
|
|
|
q.AppendWhere(o.pkIN())
|
|
})
|
|
}
|
|
|
|
// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)"
|
|
func (o OrganizationSlice) DeleteMod() bob.Mod[*dialect.DeleteQuery] {
|
|
return bob.ModFunc[*dialect.DeleteQuery](func(q *dialect.DeleteQuery) {
|
|
q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) {
|
|
return Organizations.BeforeDeleteHooks.RunHooks(ctx, exec, o)
|
|
})
|
|
|
|
q.AppendLoader(bob.LoaderFunc(func(ctx context.Context, exec bob.Executor, retrieved any) error {
|
|
var err error
|
|
switch retrieved := retrieved.(type) {
|
|
case *Organization:
|
|
o.copyMatchingRows(retrieved)
|
|
case []*Organization:
|
|
o.copyMatchingRows(retrieved...)
|
|
case OrganizationSlice:
|
|
o.copyMatchingRows(retrieved...)
|
|
default:
|
|
// If the retrieved value is not a Organization or a slice of Organization
|
|
// then run the AfterDeleteHooks on the slice
|
|
_, err = Organizations.AfterDeleteHooks.RunHooks(ctx, exec, o)
|
|
}
|
|
|
|
return err
|
|
}))
|
|
|
|
q.AppendWhere(o.pkIN())
|
|
})
|
|
}
|
|
|
|
func (o OrganizationSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals OrganizationSetter) error {
|
|
if len(o) == 0 {
|
|
return nil
|
|
}
|
|
|
|
_, err := Organizations.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec)
|
|
return err
|
|
}
|
|
|
|
func (o OrganizationSlice) DeleteAll(ctx context.Context, exec bob.Executor) error {
|
|
if len(o) == 0 {
|
|
return nil
|
|
}
|
|
|
|
_, err := Organizations.Delete(o.DeleteMod()).Exec(ctx, exec)
|
|
return err
|
|
}
|
|
|
|
func (o OrganizationSlice) ReloadAll(ctx context.Context, exec bob.Executor) error {
|
|
if len(o) == 0 {
|
|
return nil
|
|
}
|
|
|
|
o2, err := Organizations.Query(sm.Where(o.pkIN())).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
o.copyMatchingRows(o2...)
|
|
|
|
return nil
|
|
}
|
|
|
|
// Containerrelates starts a query for related objects on fieldseeker.containerrelate
|
|
func (o *Organization) Containerrelates(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerContainerrelatesQuery {
|
|
return FieldseekerContainerrelates.Query(append(mods,
|
|
sm.Where(FieldseekerContainerrelates.Columns.OrganizationID.EQ(psql.Arg(o.ID))),
|
|
)...)
|
|
}
|
|
|
|
func (os OrganizationSlice) Containerrelates(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerContainerrelatesQuery {
|
|
pkID := make(pgtypes.Array[int32], 0, len(os))
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
pkID = append(pkID, o.ID)
|
|
}
|
|
PKArgExpr := psql.Select(sm.Columns(
|
|
psql.F("unnest", psql.Cast(psql.Arg(pkID), "integer[]")),
|
|
))
|
|
|
|
return FieldseekerContainerrelates.Query(append(mods,
|
|
sm.Where(psql.Group(FieldseekerContainerrelates.Columns.OrganizationID).OP("IN", PKArgExpr)),
|
|
)...)
|
|
}
|
|
|
|
// Fieldscoutinglogs starts a query for related objects on fieldseeker.fieldscoutinglog
|
|
func (o *Organization) Fieldscoutinglogs(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerFieldscoutinglogsQuery {
|
|
return FieldseekerFieldscoutinglogs.Query(append(mods,
|
|
sm.Where(FieldseekerFieldscoutinglogs.Columns.OrganizationID.EQ(psql.Arg(o.ID))),
|
|
)...)
|
|
}
|
|
|
|
func (os OrganizationSlice) Fieldscoutinglogs(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerFieldscoutinglogsQuery {
|
|
pkID := make(pgtypes.Array[int32], 0, len(os))
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
pkID = append(pkID, o.ID)
|
|
}
|
|
PKArgExpr := psql.Select(sm.Columns(
|
|
psql.F("unnest", psql.Cast(psql.Arg(pkID), "integer[]")),
|
|
))
|
|
|
|
return FieldseekerFieldscoutinglogs.Query(append(mods,
|
|
sm.Where(psql.Group(FieldseekerFieldscoutinglogs.Columns.OrganizationID).OP("IN", PKArgExpr)),
|
|
)...)
|
|
}
|
|
|
|
// Habitatrelates starts a query for related objects on fieldseeker.habitatrelate
|
|
func (o *Organization) Habitatrelates(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerHabitatrelatesQuery {
|
|
return FieldseekerHabitatrelates.Query(append(mods,
|
|
sm.Where(FieldseekerHabitatrelates.Columns.OrganizationID.EQ(psql.Arg(o.ID))),
|
|
)...)
|
|
}
|
|
|
|
func (os OrganizationSlice) Habitatrelates(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerHabitatrelatesQuery {
|
|
pkID := make(pgtypes.Array[int32], 0, len(os))
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
pkID = append(pkID, o.ID)
|
|
}
|
|
PKArgExpr := psql.Select(sm.Columns(
|
|
psql.F("unnest", psql.Cast(psql.Arg(pkID), "integer[]")),
|
|
))
|
|
|
|
return FieldseekerHabitatrelates.Query(append(mods,
|
|
sm.Where(psql.Group(FieldseekerHabitatrelates.Columns.OrganizationID).OP("IN", PKArgExpr)),
|
|
)...)
|
|
}
|
|
|
|
// Inspectionsamples starts a query for related objects on fieldseeker.inspectionsample
|
|
func (o *Organization) Inspectionsamples(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerInspectionsamplesQuery {
|
|
return FieldseekerInspectionsamples.Query(append(mods,
|
|
sm.Where(FieldseekerInspectionsamples.Columns.OrganizationID.EQ(psql.Arg(o.ID))),
|
|
)...)
|
|
}
|
|
|
|
func (os OrganizationSlice) Inspectionsamples(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerInspectionsamplesQuery {
|
|
pkID := make(pgtypes.Array[int32], 0, len(os))
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
pkID = append(pkID, o.ID)
|
|
}
|
|
PKArgExpr := psql.Select(sm.Columns(
|
|
psql.F("unnest", psql.Cast(psql.Arg(pkID), "integer[]")),
|
|
))
|
|
|
|
return FieldseekerInspectionsamples.Query(append(mods,
|
|
sm.Where(psql.Group(FieldseekerInspectionsamples.Columns.OrganizationID).OP("IN", PKArgExpr)),
|
|
)...)
|
|
}
|
|
|
|
// Inspectionsampledetails starts a query for related objects on fieldseeker.inspectionsampledetail
|
|
func (o *Organization) Inspectionsampledetails(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerInspectionsampledetailsQuery {
|
|
return FieldseekerInspectionsampledetails.Query(append(mods,
|
|
sm.Where(FieldseekerInspectionsampledetails.Columns.OrganizationID.EQ(psql.Arg(o.ID))),
|
|
)...)
|
|
}
|
|
|
|
func (os OrganizationSlice) Inspectionsampledetails(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerInspectionsampledetailsQuery {
|
|
pkID := make(pgtypes.Array[int32], 0, len(os))
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
pkID = append(pkID, o.ID)
|
|
}
|
|
PKArgExpr := psql.Select(sm.Columns(
|
|
psql.F("unnest", psql.Cast(psql.Arg(pkID), "integer[]")),
|
|
))
|
|
|
|
return FieldseekerInspectionsampledetails.Query(append(mods,
|
|
sm.Where(psql.Group(FieldseekerInspectionsampledetails.Columns.OrganizationID).OP("IN", PKArgExpr)),
|
|
)...)
|
|
}
|
|
|
|
// Linelocations starts a query for related objects on fieldseeker.linelocation
|
|
func (o *Organization) Linelocations(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerLinelocationsQuery {
|
|
return FieldseekerLinelocations.Query(append(mods,
|
|
sm.Where(FieldseekerLinelocations.Columns.OrganizationID.EQ(psql.Arg(o.ID))),
|
|
)...)
|
|
}
|
|
|
|
func (os OrganizationSlice) Linelocations(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerLinelocationsQuery {
|
|
pkID := make(pgtypes.Array[int32], 0, len(os))
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
pkID = append(pkID, o.ID)
|
|
}
|
|
PKArgExpr := psql.Select(sm.Columns(
|
|
psql.F("unnest", psql.Cast(psql.Arg(pkID), "integer[]")),
|
|
))
|
|
|
|
return FieldseekerLinelocations.Query(append(mods,
|
|
sm.Where(psql.Group(FieldseekerLinelocations.Columns.OrganizationID).OP("IN", PKArgExpr)),
|
|
)...)
|
|
}
|
|
|
|
// Locationtrackings starts a query for related objects on fieldseeker.locationtracking
|
|
func (o *Organization) Locationtrackings(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerLocationtrackingsQuery {
|
|
return FieldseekerLocationtrackings.Query(append(mods,
|
|
sm.Where(FieldseekerLocationtrackings.Columns.OrganizationID.EQ(psql.Arg(o.ID))),
|
|
)...)
|
|
}
|
|
|
|
func (os OrganizationSlice) Locationtrackings(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerLocationtrackingsQuery {
|
|
pkID := make(pgtypes.Array[int32], 0, len(os))
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
pkID = append(pkID, o.ID)
|
|
}
|
|
PKArgExpr := psql.Select(sm.Columns(
|
|
psql.F("unnest", psql.Cast(psql.Arg(pkID), "integer[]")),
|
|
))
|
|
|
|
return FieldseekerLocationtrackings.Query(append(mods,
|
|
sm.Where(psql.Group(FieldseekerLocationtrackings.Columns.OrganizationID).OP("IN", PKArgExpr)),
|
|
)...)
|
|
}
|
|
|
|
// Mosquitoinspections starts a query for related objects on fieldseeker.mosquitoinspection
|
|
func (o *Organization) Mosquitoinspections(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerMosquitoinspectionsQuery {
|
|
return FieldseekerMosquitoinspections.Query(append(mods,
|
|
sm.Where(FieldseekerMosquitoinspections.Columns.OrganizationID.EQ(psql.Arg(o.ID))),
|
|
)...)
|
|
}
|
|
|
|
func (os OrganizationSlice) Mosquitoinspections(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerMosquitoinspectionsQuery {
|
|
pkID := make(pgtypes.Array[int32], 0, len(os))
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
pkID = append(pkID, o.ID)
|
|
}
|
|
PKArgExpr := psql.Select(sm.Columns(
|
|
psql.F("unnest", psql.Cast(psql.Arg(pkID), "integer[]")),
|
|
))
|
|
|
|
return FieldseekerMosquitoinspections.Query(append(mods,
|
|
sm.Where(psql.Group(FieldseekerMosquitoinspections.Columns.OrganizationID).OP("IN", PKArgExpr)),
|
|
)...)
|
|
}
|
|
|
|
// Pointlocations starts a query for related objects on fieldseeker.pointlocation
|
|
func (o *Organization) Pointlocations(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerPointlocationsQuery {
|
|
return FieldseekerPointlocations.Query(append(mods,
|
|
sm.Where(FieldseekerPointlocations.Columns.OrganizationID.EQ(psql.Arg(o.ID))),
|
|
)...)
|
|
}
|
|
|
|
func (os OrganizationSlice) Pointlocations(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerPointlocationsQuery {
|
|
pkID := make(pgtypes.Array[int32], 0, len(os))
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
pkID = append(pkID, o.ID)
|
|
}
|
|
PKArgExpr := psql.Select(sm.Columns(
|
|
psql.F("unnest", psql.Cast(psql.Arg(pkID), "integer[]")),
|
|
))
|
|
|
|
return FieldseekerPointlocations.Query(append(mods,
|
|
sm.Where(psql.Group(FieldseekerPointlocations.Columns.OrganizationID).OP("IN", PKArgExpr)),
|
|
)...)
|
|
}
|
|
|
|
// Polygonlocations starts a query for related objects on fieldseeker.polygonlocation
|
|
func (o *Organization) Polygonlocations(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerPolygonlocationsQuery {
|
|
return FieldseekerPolygonlocations.Query(append(mods,
|
|
sm.Where(FieldseekerPolygonlocations.Columns.OrganizationID.EQ(psql.Arg(o.ID))),
|
|
)...)
|
|
}
|
|
|
|
func (os OrganizationSlice) Polygonlocations(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerPolygonlocationsQuery {
|
|
pkID := make(pgtypes.Array[int32], 0, len(os))
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
pkID = append(pkID, o.ID)
|
|
}
|
|
PKArgExpr := psql.Select(sm.Columns(
|
|
psql.F("unnest", psql.Cast(psql.Arg(pkID), "integer[]")),
|
|
))
|
|
|
|
return FieldseekerPolygonlocations.Query(append(mods,
|
|
sm.Where(psql.Group(FieldseekerPolygonlocations.Columns.OrganizationID).OP("IN", PKArgExpr)),
|
|
)...)
|
|
}
|
|
|
|
// Pools starts a query for related objects on fieldseeker.pool
|
|
func (o *Organization) Pools(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerPoolsQuery {
|
|
return FieldseekerPools.Query(append(mods,
|
|
sm.Where(FieldseekerPools.Columns.OrganizationID.EQ(psql.Arg(o.ID))),
|
|
)...)
|
|
}
|
|
|
|
func (os OrganizationSlice) Pools(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerPoolsQuery {
|
|
pkID := make(pgtypes.Array[int32], 0, len(os))
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
pkID = append(pkID, o.ID)
|
|
}
|
|
PKArgExpr := psql.Select(sm.Columns(
|
|
psql.F("unnest", psql.Cast(psql.Arg(pkID), "integer[]")),
|
|
))
|
|
|
|
return FieldseekerPools.Query(append(mods,
|
|
sm.Where(psql.Group(FieldseekerPools.Columns.OrganizationID).OP("IN", PKArgExpr)),
|
|
)...)
|
|
}
|
|
|
|
// Pooldetails starts a query for related objects on fieldseeker.pooldetail
|
|
func (o *Organization) Pooldetails(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerPooldetailsQuery {
|
|
return FieldseekerPooldetails.Query(append(mods,
|
|
sm.Where(FieldseekerPooldetails.Columns.OrganizationID.EQ(psql.Arg(o.ID))),
|
|
)...)
|
|
}
|
|
|
|
func (os OrganizationSlice) Pooldetails(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerPooldetailsQuery {
|
|
pkID := make(pgtypes.Array[int32], 0, len(os))
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
pkID = append(pkID, o.ID)
|
|
}
|
|
PKArgExpr := psql.Select(sm.Columns(
|
|
psql.F("unnest", psql.Cast(psql.Arg(pkID), "integer[]")),
|
|
))
|
|
|
|
return FieldseekerPooldetails.Query(append(mods,
|
|
sm.Where(psql.Group(FieldseekerPooldetails.Columns.OrganizationID).OP("IN", PKArgExpr)),
|
|
)...)
|
|
}
|
|
|
|
// Proposedtreatmentareas starts a query for related objects on fieldseeker.proposedtreatmentarea
|
|
func (o *Organization) Proposedtreatmentareas(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerProposedtreatmentareasQuery {
|
|
return FieldseekerProposedtreatmentareas.Query(append(mods,
|
|
sm.Where(FieldseekerProposedtreatmentareas.Columns.OrganizationID.EQ(psql.Arg(o.ID))),
|
|
)...)
|
|
}
|
|
|
|
func (os OrganizationSlice) Proposedtreatmentareas(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerProposedtreatmentareasQuery {
|
|
pkID := make(pgtypes.Array[int32], 0, len(os))
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
pkID = append(pkID, o.ID)
|
|
}
|
|
PKArgExpr := psql.Select(sm.Columns(
|
|
psql.F("unnest", psql.Cast(psql.Arg(pkID), "integer[]")),
|
|
))
|
|
|
|
return FieldseekerProposedtreatmentareas.Query(append(mods,
|
|
sm.Where(psql.Group(FieldseekerProposedtreatmentareas.Columns.OrganizationID).OP("IN", PKArgExpr)),
|
|
)...)
|
|
}
|
|
|
|
// Qamosquitoinspections starts a query for related objects on fieldseeker.qamosquitoinspection
|
|
func (o *Organization) Qamosquitoinspections(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerQamosquitoinspectionsQuery {
|
|
return FieldseekerQamosquitoinspections.Query(append(mods,
|
|
sm.Where(FieldseekerQamosquitoinspections.Columns.OrganizationID.EQ(psql.Arg(o.ID))),
|
|
)...)
|
|
}
|
|
|
|
func (os OrganizationSlice) Qamosquitoinspections(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerQamosquitoinspectionsQuery {
|
|
pkID := make(pgtypes.Array[int32], 0, len(os))
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
pkID = append(pkID, o.ID)
|
|
}
|
|
PKArgExpr := psql.Select(sm.Columns(
|
|
psql.F("unnest", psql.Cast(psql.Arg(pkID), "integer[]")),
|
|
))
|
|
|
|
return FieldseekerQamosquitoinspections.Query(append(mods,
|
|
sm.Where(psql.Group(FieldseekerQamosquitoinspections.Columns.OrganizationID).OP("IN", PKArgExpr)),
|
|
)...)
|
|
}
|
|
|
|
// Rodentlocations starts a query for related objects on fieldseeker.rodentlocation
|
|
func (o *Organization) Rodentlocations(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerRodentlocationsQuery {
|
|
return FieldseekerRodentlocations.Query(append(mods,
|
|
sm.Where(FieldseekerRodentlocations.Columns.OrganizationID.EQ(psql.Arg(o.ID))),
|
|
)...)
|
|
}
|
|
|
|
func (os OrganizationSlice) Rodentlocations(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerRodentlocationsQuery {
|
|
pkID := make(pgtypes.Array[int32], 0, len(os))
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
pkID = append(pkID, o.ID)
|
|
}
|
|
PKArgExpr := psql.Select(sm.Columns(
|
|
psql.F("unnest", psql.Cast(psql.Arg(pkID), "integer[]")),
|
|
))
|
|
|
|
return FieldseekerRodentlocations.Query(append(mods,
|
|
sm.Where(psql.Group(FieldseekerRodentlocations.Columns.OrganizationID).OP("IN", PKArgExpr)),
|
|
)...)
|
|
}
|
|
|
|
// Samplecollections starts a query for related objects on fieldseeker.samplecollection
|
|
func (o *Organization) Samplecollections(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerSamplecollectionsQuery {
|
|
return FieldseekerSamplecollections.Query(append(mods,
|
|
sm.Where(FieldseekerSamplecollections.Columns.OrganizationID.EQ(psql.Arg(o.ID))),
|
|
)...)
|
|
}
|
|
|
|
func (os OrganizationSlice) Samplecollections(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerSamplecollectionsQuery {
|
|
pkID := make(pgtypes.Array[int32], 0, len(os))
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
pkID = append(pkID, o.ID)
|
|
}
|
|
PKArgExpr := psql.Select(sm.Columns(
|
|
psql.F("unnest", psql.Cast(psql.Arg(pkID), "integer[]")),
|
|
))
|
|
|
|
return FieldseekerSamplecollections.Query(append(mods,
|
|
sm.Where(psql.Group(FieldseekerSamplecollections.Columns.OrganizationID).OP("IN", PKArgExpr)),
|
|
)...)
|
|
}
|
|
|
|
// Samplelocations starts a query for related objects on fieldseeker.samplelocation
|
|
func (o *Organization) Samplelocations(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerSamplelocationsQuery {
|
|
return FieldseekerSamplelocations.Query(append(mods,
|
|
sm.Where(FieldseekerSamplelocations.Columns.OrganizationID.EQ(psql.Arg(o.ID))),
|
|
)...)
|
|
}
|
|
|
|
func (os OrganizationSlice) Samplelocations(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerSamplelocationsQuery {
|
|
pkID := make(pgtypes.Array[int32], 0, len(os))
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
pkID = append(pkID, o.ID)
|
|
}
|
|
PKArgExpr := psql.Select(sm.Columns(
|
|
psql.F("unnest", psql.Cast(psql.Arg(pkID), "integer[]")),
|
|
))
|
|
|
|
return FieldseekerSamplelocations.Query(append(mods,
|
|
sm.Where(psql.Group(FieldseekerSamplelocations.Columns.OrganizationID).OP("IN", PKArgExpr)),
|
|
)...)
|
|
}
|
|
|
|
// Servicerequests starts a query for related objects on fieldseeker.servicerequest
|
|
func (o *Organization) Servicerequests(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerServicerequestsQuery {
|
|
return FieldseekerServicerequests.Query(append(mods,
|
|
sm.Where(FieldseekerServicerequests.Columns.OrganizationID.EQ(psql.Arg(o.ID))),
|
|
)...)
|
|
}
|
|
|
|
func (os OrganizationSlice) Servicerequests(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerServicerequestsQuery {
|
|
pkID := make(pgtypes.Array[int32], 0, len(os))
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
pkID = append(pkID, o.ID)
|
|
}
|
|
PKArgExpr := psql.Select(sm.Columns(
|
|
psql.F("unnest", psql.Cast(psql.Arg(pkID), "integer[]")),
|
|
))
|
|
|
|
return FieldseekerServicerequests.Query(append(mods,
|
|
sm.Where(psql.Group(FieldseekerServicerequests.Columns.OrganizationID).OP("IN", PKArgExpr)),
|
|
)...)
|
|
}
|
|
|
|
// Speciesabundances starts a query for related objects on fieldseeker.speciesabundance
|
|
func (o *Organization) Speciesabundances(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerSpeciesabundancesQuery {
|
|
return FieldseekerSpeciesabundances.Query(append(mods,
|
|
sm.Where(FieldseekerSpeciesabundances.Columns.OrganizationID.EQ(psql.Arg(o.ID))),
|
|
)...)
|
|
}
|
|
|
|
func (os OrganizationSlice) Speciesabundances(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerSpeciesabundancesQuery {
|
|
pkID := make(pgtypes.Array[int32], 0, len(os))
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
pkID = append(pkID, o.ID)
|
|
}
|
|
PKArgExpr := psql.Select(sm.Columns(
|
|
psql.F("unnest", psql.Cast(psql.Arg(pkID), "integer[]")),
|
|
))
|
|
|
|
return FieldseekerSpeciesabundances.Query(append(mods,
|
|
sm.Where(psql.Group(FieldseekerSpeciesabundances.Columns.OrganizationID).OP("IN", PKArgExpr)),
|
|
)...)
|
|
}
|
|
|
|
// Stormdrains starts a query for related objects on fieldseeker.stormdrain
|
|
func (o *Organization) Stormdrains(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerStormdrainsQuery {
|
|
return FieldseekerStormdrains.Query(append(mods,
|
|
sm.Where(FieldseekerStormdrains.Columns.OrganizationID.EQ(psql.Arg(o.ID))),
|
|
)...)
|
|
}
|
|
|
|
func (os OrganizationSlice) Stormdrains(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerStormdrainsQuery {
|
|
pkID := make(pgtypes.Array[int32], 0, len(os))
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
pkID = append(pkID, o.ID)
|
|
}
|
|
PKArgExpr := psql.Select(sm.Columns(
|
|
psql.F("unnest", psql.Cast(psql.Arg(pkID), "integer[]")),
|
|
))
|
|
|
|
return FieldseekerStormdrains.Query(append(mods,
|
|
sm.Where(psql.Group(FieldseekerStormdrains.Columns.OrganizationID).OP("IN", PKArgExpr)),
|
|
)...)
|
|
}
|
|
|
|
// Timecards starts a query for related objects on fieldseeker.timecard
|
|
func (o *Organization) Timecards(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerTimecardsQuery {
|
|
return FieldseekerTimecards.Query(append(mods,
|
|
sm.Where(FieldseekerTimecards.Columns.OrganizationID.EQ(psql.Arg(o.ID))),
|
|
)...)
|
|
}
|
|
|
|
func (os OrganizationSlice) Timecards(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerTimecardsQuery {
|
|
pkID := make(pgtypes.Array[int32], 0, len(os))
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
pkID = append(pkID, o.ID)
|
|
}
|
|
PKArgExpr := psql.Select(sm.Columns(
|
|
psql.F("unnest", psql.Cast(psql.Arg(pkID), "integer[]")),
|
|
))
|
|
|
|
return FieldseekerTimecards.Query(append(mods,
|
|
sm.Where(psql.Group(FieldseekerTimecards.Columns.OrganizationID).OP("IN", PKArgExpr)),
|
|
)...)
|
|
}
|
|
|
|
// Trapdata starts a query for related objects on fieldseeker.trapdata
|
|
func (o *Organization) Trapdata(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerTrapdataQuery {
|
|
return FieldseekerTrapdata.Query(append(mods,
|
|
sm.Where(FieldseekerTrapdata.Columns.OrganizationID.EQ(psql.Arg(o.ID))),
|
|
)...)
|
|
}
|
|
|
|
func (os OrganizationSlice) Trapdata(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerTrapdataQuery {
|
|
pkID := make(pgtypes.Array[int32], 0, len(os))
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
pkID = append(pkID, o.ID)
|
|
}
|
|
PKArgExpr := psql.Select(sm.Columns(
|
|
psql.F("unnest", psql.Cast(psql.Arg(pkID), "integer[]")),
|
|
))
|
|
|
|
return FieldseekerTrapdata.Query(append(mods,
|
|
sm.Where(psql.Group(FieldseekerTrapdata.Columns.OrganizationID).OP("IN", PKArgExpr)),
|
|
)...)
|
|
}
|
|
|
|
// Traplocations starts a query for related objects on fieldseeker.traplocation
|
|
func (o *Organization) Traplocations(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerTraplocationsQuery {
|
|
return FieldseekerTraplocations.Query(append(mods,
|
|
sm.Where(FieldseekerTraplocations.Columns.OrganizationID.EQ(psql.Arg(o.ID))),
|
|
)...)
|
|
}
|
|
|
|
func (os OrganizationSlice) Traplocations(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerTraplocationsQuery {
|
|
pkID := make(pgtypes.Array[int32], 0, len(os))
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
pkID = append(pkID, o.ID)
|
|
}
|
|
PKArgExpr := psql.Select(sm.Columns(
|
|
psql.F("unnest", psql.Cast(psql.Arg(pkID), "integer[]")),
|
|
))
|
|
|
|
return FieldseekerTraplocations.Query(append(mods,
|
|
sm.Where(psql.Group(FieldseekerTraplocations.Columns.OrganizationID).OP("IN", PKArgExpr)),
|
|
)...)
|
|
}
|
|
|
|
// Treatments starts a query for related objects on fieldseeker.treatment
|
|
func (o *Organization) Treatments(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerTreatmentsQuery {
|
|
return FieldseekerTreatments.Query(append(mods,
|
|
sm.Where(FieldseekerTreatments.Columns.OrganizationID.EQ(psql.Arg(o.ID))),
|
|
)...)
|
|
}
|
|
|
|
func (os OrganizationSlice) Treatments(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerTreatmentsQuery {
|
|
pkID := make(pgtypes.Array[int32], 0, len(os))
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
pkID = append(pkID, o.ID)
|
|
}
|
|
PKArgExpr := psql.Select(sm.Columns(
|
|
psql.F("unnest", psql.Cast(psql.Arg(pkID), "integer[]")),
|
|
))
|
|
|
|
return FieldseekerTreatments.Query(append(mods,
|
|
sm.Where(psql.Group(FieldseekerTreatments.Columns.OrganizationID).OP("IN", PKArgExpr)),
|
|
)...)
|
|
}
|
|
|
|
// Treatmentareas starts a query for related objects on fieldseeker.treatmentarea
|
|
func (o *Organization) Treatmentareas(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerTreatmentareasQuery {
|
|
return FieldseekerTreatmentareas.Query(append(mods,
|
|
sm.Where(FieldseekerTreatmentareas.Columns.OrganizationID.EQ(psql.Arg(o.ID))),
|
|
)...)
|
|
}
|
|
|
|
func (os OrganizationSlice) Treatmentareas(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerTreatmentareasQuery {
|
|
pkID := make(pgtypes.Array[int32], 0, len(os))
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
pkID = append(pkID, o.ID)
|
|
}
|
|
PKArgExpr := psql.Select(sm.Columns(
|
|
psql.F("unnest", psql.Cast(psql.Arg(pkID), "integer[]")),
|
|
))
|
|
|
|
return FieldseekerTreatmentareas.Query(append(mods,
|
|
sm.Where(psql.Group(FieldseekerTreatmentareas.Columns.OrganizationID).OP("IN", PKArgExpr)),
|
|
)...)
|
|
}
|
|
|
|
// Zones starts a query for related objects on fieldseeker.zones
|
|
func (o *Organization) Zones(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerZonesQuery {
|
|
return FieldseekerZones.Query(append(mods,
|
|
sm.Where(FieldseekerZones.Columns.OrganizationID.EQ(psql.Arg(o.ID))),
|
|
)...)
|
|
}
|
|
|
|
func (os OrganizationSlice) Zones(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerZonesQuery {
|
|
pkID := make(pgtypes.Array[int32], 0, len(os))
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
pkID = append(pkID, o.ID)
|
|
}
|
|
PKArgExpr := psql.Select(sm.Columns(
|
|
psql.F("unnest", psql.Cast(psql.Arg(pkID), "integer[]")),
|
|
))
|
|
|
|
return FieldseekerZones.Query(append(mods,
|
|
sm.Where(psql.Group(FieldseekerZones.Columns.OrganizationID).OP("IN", PKArgExpr)),
|
|
)...)
|
|
}
|
|
|
|
// Zones2s starts a query for related objects on fieldseeker.zones2
|
|
func (o *Organization) Zones2s(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerZones2sQuery {
|
|
return FieldseekerZones2s.Query(append(mods,
|
|
sm.Where(FieldseekerZones2s.Columns.OrganizationID.EQ(psql.Arg(o.ID))),
|
|
)...)
|
|
}
|
|
|
|
func (os OrganizationSlice) Zones2s(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerZones2sQuery {
|
|
pkID := make(pgtypes.Array[int32], 0, len(os))
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
pkID = append(pkID, o.ID)
|
|
}
|
|
PKArgExpr := psql.Select(sm.Columns(
|
|
psql.F("unnest", psql.Cast(psql.Arg(pkID), "integer[]")),
|
|
))
|
|
|
|
return FieldseekerZones2s.Query(append(mods,
|
|
sm.Where(psql.Group(FieldseekerZones2s.Columns.OrganizationID).OP("IN", PKArgExpr)),
|
|
)...)
|
|
}
|
|
|
|
// FieldseekerSyncs starts a query for related objects on fieldseeker_sync
|
|
func (o *Organization) FieldseekerSyncs(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerSyncsQuery {
|
|
return FieldseekerSyncs.Query(append(mods,
|
|
sm.Where(FieldseekerSyncs.Columns.OrganizationID.EQ(psql.Arg(o.ID))),
|
|
)...)
|
|
}
|
|
|
|
func (os OrganizationSlice) FieldseekerSyncs(mods ...bob.Mod[*dialect.SelectQuery]) FieldseekerSyncsQuery {
|
|
pkID := make(pgtypes.Array[int32], 0, len(os))
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
pkID = append(pkID, o.ID)
|
|
}
|
|
PKArgExpr := psql.Select(sm.Columns(
|
|
psql.F("unnest", psql.Cast(psql.Arg(pkID), "integer[]")),
|
|
))
|
|
|
|
return FieldseekerSyncs.Query(append(mods,
|
|
sm.Where(psql.Group(FieldseekerSyncs.Columns.OrganizationID).OP("IN", PKArgExpr)),
|
|
)...)
|
|
}
|
|
|
|
// H3Aggregations starts a query for related objects on h3_aggregation
|
|
func (o *Organization) H3Aggregations(mods ...bob.Mod[*dialect.SelectQuery]) H3AggregationsQuery {
|
|
return H3Aggregations.Query(append(mods,
|
|
sm.Where(H3Aggregations.Columns.OrganizationID.EQ(psql.Arg(o.ID))),
|
|
)...)
|
|
}
|
|
|
|
func (os OrganizationSlice) H3Aggregations(mods ...bob.Mod[*dialect.SelectQuery]) H3AggregationsQuery {
|
|
pkID := make(pgtypes.Array[int32], 0, len(os))
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
pkID = append(pkID, o.ID)
|
|
}
|
|
PKArgExpr := psql.Select(sm.Columns(
|
|
psql.F("unnest", psql.Cast(psql.Arg(pkID), "integer[]")),
|
|
))
|
|
|
|
return H3Aggregations.Query(append(mods,
|
|
sm.Where(psql.Group(H3Aggregations.Columns.OrganizationID).OP("IN", PKArgExpr)),
|
|
)...)
|
|
}
|
|
|
|
// NoteAudios starts a query for related objects on note_audio
|
|
func (o *Organization) NoteAudios(mods ...bob.Mod[*dialect.SelectQuery]) NoteAudiosQuery {
|
|
return NoteAudios.Query(append(mods,
|
|
sm.Where(NoteAudios.Columns.OrganizationID.EQ(psql.Arg(o.ID))),
|
|
)...)
|
|
}
|
|
|
|
func (os OrganizationSlice) NoteAudios(mods ...bob.Mod[*dialect.SelectQuery]) NoteAudiosQuery {
|
|
pkID := make(pgtypes.Array[int32], 0, len(os))
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
pkID = append(pkID, o.ID)
|
|
}
|
|
PKArgExpr := psql.Select(sm.Columns(
|
|
psql.F("unnest", psql.Cast(psql.Arg(pkID), "integer[]")),
|
|
))
|
|
|
|
return NoteAudios.Query(append(mods,
|
|
sm.Where(psql.Group(NoteAudios.Columns.OrganizationID).OP("IN", PKArgExpr)),
|
|
)...)
|
|
}
|
|
|
|
// NoteImages starts a query for related objects on note_image
|
|
func (o *Organization) NoteImages(mods ...bob.Mod[*dialect.SelectQuery]) NoteImagesQuery {
|
|
return NoteImages.Query(append(mods,
|
|
sm.Where(NoteImages.Columns.OrganizationID.EQ(psql.Arg(o.ID))),
|
|
)...)
|
|
}
|
|
|
|
func (os OrganizationSlice) NoteImages(mods ...bob.Mod[*dialect.SelectQuery]) NoteImagesQuery {
|
|
pkID := make(pgtypes.Array[int32], 0, len(os))
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
pkID = append(pkID, o.ID)
|
|
}
|
|
PKArgExpr := psql.Select(sm.Columns(
|
|
psql.F("unnest", psql.Cast(psql.Arg(pkID), "integer[]")),
|
|
))
|
|
|
|
return NoteImages.Query(append(mods,
|
|
sm.Where(psql.Group(NoteImages.Columns.OrganizationID).OP("IN", PKArgExpr)),
|
|
)...)
|
|
}
|
|
|
|
// User starts a query for related objects on user_
|
|
func (o *Organization) User(mods ...bob.Mod[*dialect.SelectQuery]) UsersQuery {
|
|
return Users.Query(append(mods,
|
|
sm.Where(Users.Columns.OrganizationID.EQ(psql.Arg(o.ID))),
|
|
)...)
|
|
}
|
|
|
|
func (os OrganizationSlice) User(mods ...bob.Mod[*dialect.SelectQuery]) UsersQuery {
|
|
pkID := make(pgtypes.Array[int32], 0, len(os))
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
pkID = append(pkID, o.ID)
|
|
}
|
|
PKArgExpr := psql.Select(sm.Columns(
|
|
psql.F("unnest", psql.Cast(psql.Arg(pkID), "integer[]")),
|
|
))
|
|
|
|
return Users.Query(append(mods,
|
|
sm.Where(psql.Group(Users.Columns.OrganizationID).OP("IN", PKArgExpr)),
|
|
)...)
|
|
}
|
|
|
|
func insertOrganizationContainerrelates0(ctx context.Context, exec bob.Executor, fieldseekerContainerrelates1 []*FieldseekerContainerrelateSetter, organization0 *Organization) (FieldseekerContainerrelateSlice, error) {
|
|
for i := range fieldseekerContainerrelates1 {
|
|
fieldseekerContainerrelates1[i].OrganizationID = omit.From(organization0.ID)
|
|
}
|
|
|
|
ret, err := FieldseekerContainerrelates.Insert(bob.ToMods(fieldseekerContainerrelates1...)).All(ctx, exec)
|
|
if err != nil {
|
|
return ret, fmt.Errorf("insertOrganizationContainerrelates0: %w", err)
|
|
}
|
|
|
|
return ret, nil
|
|
}
|
|
|
|
func attachOrganizationContainerrelates0(ctx context.Context, exec bob.Executor, count int, fieldseekerContainerrelates1 FieldseekerContainerrelateSlice, organization0 *Organization) (FieldseekerContainerrelateSlice, error) {
|
|
setter := &FieldseekerContainerrelateSetter{
|
|
OrganizationID: omit.From(organization0.ID),
|
|
}
|
|
|
|
err := fieldseekerContainerrelates1.UpdateAll(ctx, exec, *setter)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("attachOrganizationContainerrelates0: %w", err)
|
|
}
|
|
|
|
return fieldseekerContainerrelates1, nil
|
|
}
|
|
|
|
func (organization0 *Organization) InsertContainerrelates(ctx context.Context, exec bob.Executor, related ...*FieldseekerContainerrelateSetter) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
|
|
fieldseekerContainerrelates1, err := insertOrganizationContainerrelates0(ctx, exec, related, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.Containerrelates = append(organization0.R.Containerrelates, fieldseekerContainerrelates1...)
|
|
|
|
for _, rel := range fieldseekerContainerrelates1 {
|
|
rel.R.Organization = organization0
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (organization0 *Organization) AttachContainerrelates(ctx context.Context, exec bob.Executor, related ...*FieldseekerContainerrelate) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
fieldseekerContainerrelates1 := FieldseekerContainerrelateSlice(related)
|
|
|
|
_, err = attachOrganizationContainerrelates0(ctx, exec, len(related), fieldseekerContainerrelates1, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.Containerrelates = append(organization0.R.Containerrelates, fieldseekerContainerrelates1...)
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = organization0
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func insertOrganizationFieldscoutinglogs0(ctx context.Context, exec bob.Executor, fieldseekerFieldscoutinglogs1 []*FieldseekerFieldscoutinglogSetter, organization0 *Organization) (FieldseekerFieldscoutinglogSlice, error) {
|
|
for i := range fieldseekerFieldscoutinglogs1 {
|
|
fieldseekerFieldscoutinglogs1[i].OrganizationID = omit.From(organization0.ID)
|
|
}
|
|
|
|
ret, err := FieldseekerFieldscoutinglogs.Insert(bob.ToMods(fieldseekerFieldscoutinglogs1...)).All(ctx, exec)
|
|
if err != nil {
|
|
return ret, fmt.Errorf("insertOrganizationFieldscoutinglogs0: %w", err)
|
|
}
|
|
|
|
return ret, nil
|
|
}
|
|
|
|
func attachOrganizationFieldscoutinglogs0(ctx context.Context, exec bob.Executor, count int, fieldseekerFieldscoutinglogs1 FieldseekerFieldscoutinglogSlice, organization0 *Organization) (FieldseekerFieldscoutinglogSlice, error) {
|
|
setter := &FieldseekerFieldscoutinglogSetter{
|
|
OrganizationID: omit.From(organization0.ID),
|
|
}
|
|
|
|
err := fieldseekerFieldscoutinglogs1.UpdateAll(ctx, exec, *setter)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("attachOrganizationFieldscoutinglogs0: %w", err)
|
|
}
|
|
|
|
return fieldseekerFieldscoutinglogs1, nil
|
|
}
|
|
|
|
func (organization0 *Organization) InsertFieldscoutinglogs(ctx context.Context, exec bob.Executor, related ...*FieldseekerFieldscoutinglogSetter) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
|
|
fieldseekerFieldscoutinglogs1, err := insertOrganizationFieldscoutinglogs0(ctx, exec, related, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.Fieldscoutinglogs = append(organization0.R.Fieldscoutinglogs, fieldseekerFieldscoutinglogs1...)
|
|
|
|
for _, rel := range fieldseekerFieldscoutinglogs1 {
|
|
rel.R.Organization = organization0
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (organization0 *Organization) AttachFieldscoutinglogs(ctx context.Context, exec bob.Executor, related ...*FieldseekerFieldscoutinglog) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
fieldseekerFieldscoutinglogs1 := FieldseekerFieldscoutinglogSlice(related)
|
|
|
|
_, err = attachOrganizationFieldscoutinglogs0(ctx, exec, len(related), fieldseekerFieldscoutinglogs1, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.Fieldscoutinglogs = append(organization0.R.Fieldscoutinglogs, fieldseekerFieldscoutinglogs1...)
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = organization0
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func insertOrganizationHabitatrelates0(ctx context.Context, exec bob.Executor, fieldseekerHabitatrelates1 []*FieldseekerHabitatrelateSetter, organization0 *Organization) (FieldseekerHabitatrelateSlice, error) {
|
|
for i := range fieldseekerHabitatrelates1 {
|
|
fieldseekerHabitatrelates1[i].OrganizationID = omit.From(organization0.ID)
|
|
}
|
|
|
|
ret, err := FieldseekerHabitatrelates.Insert(bob.ToMods(fieldseekerHabitatrelates1...)).All(ctx, exec)
|
|
if err != nil {
|
|
return ret, fmt.Errorf("insertOrganizationHabitatrelates0: %w", err)
|
|
}
|
|
|
|
return ret, nil
|
|
}
|
|
|
|
func attachOrganizationHabitatrelates0(ctx context.Context, exec bob.Executor, count int, fieldseekerHabitatrelates1 FieldseekerHabitatrelateSlice, organization0 *Organization) (FieldseekerHabitatrelateSlice, error) {
|
|
setter := &FieldseekerHabitatrelateSetter{
|
|
OrganizationID: omit.From(organization0.ID),
|
|
}
|
|
|
|
err := fieldseekerHabitatrelates1.UpdateAll(ctx, exec, *setter)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("attachOrganizationHabitatrelates0: %w", err)
|
|
}
|
|
|
|
return fieldseekerHabitatrelates1, nil
|
|
}
|
|
|
|
func (organization0 *Organization) InsertHabitatrelates(ctx context.Context, exec bob.Executor, related ...*FieldseekerHabitatrelateSetter) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
|
|
fieldseekerHabitatrelates1, err := insertOrganizationHabitatrelates0(ctx, exec, related, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.Habitatrelates = append(organization0.R.Habitatrelates, fieldseekerHabitatrelates1...)
|
|
|
|
for _, rel := range fieldseekerHabitatrelates1 {
|
|
rel.R.Organization = organization0
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (organization0 *Organization) AttachHabitatrelates(ctx context.Context, exec bob.Executor, related ...*FieldseekerHabitatrelate) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
fieldseekerHabitatrelates1 := FieldseekerHabitatrelateSlice(related)
|
|
|
|
_, err = attachOrganizationHabitatrelates0(ctx, exec, len(related), fieldseekerHabitatrelates1, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.Habitatrelates = append(organization0.R.Habitatrelates, fieldseekerHabitatrelates1...)
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = organization0
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func insertOrganizationInspectionsamples0(ctx context.Context, exec bob.Executor, fieldseekerInspectionsamples1 []*FieldseekerInspectionsampleSetter, organization0 *Organization) (FieldseekerInspectionsampleSlice, error) {
|
|
for i := range fieldseekerInspectionsamples1 {
|
|
fieldseekerInspectionsamples1[i].OrganizationID = omit.From(organization0.ID)
|
|
}
|
|
|
|
ret, err := FieldseekerInspectionsamples.Insert(bob.ToMods(fieldseekerInspectionsamples1...)).All(ctx, exec)
|
|
if err != nil {
|
|
return ret, fmt.Errorf("insertOrganizationInspectionsamples0: %w", err)
|
|
}
|
|
|
|
return ret, nil
|
|
}
|
|
|
|
func attachOrganizationInspectionsamples0(ctx context.Context, exec bob.Executor, count int, fieldseekerInspectionsamples1 FieldseekerInspectionsampleSlice, organization0 *Organization) (FieldseekerInspectionsampleSlice, error) {
|
|
setter := &FieldseekerInspectionsampleSetter{
|
|
OrganizationID: omit.From(organization0.ID),
|
|
}
|
|
|
|
err := fieldseekerInspectionsamples1.UpdateAll(ctx, exec, *setter)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("attachOrganizationInspectionsamples0: %w", err)
|
|
}
|
|
|
|
return fieldseekerInspectionsamples1, nil
|
|
}
|
|
|
|
func (organization0 *Organization) InsertInspectionsamples(ctx context.Context, exec bob.Executor, related ...*FieldseekerInspectionsampleSetter) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
|
|
fieldseekerInspectionsamples1, err := insertOrganizationInspectionsamples0(ctx, exec, related, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.Inspectionsamples = append(organization0.R.Inspectionsamples, fieldseekerInspectionsamples1...)
|
|
|
|
for _, rel := range fieldseekerInspectionsamples1 {
|
|
rel.R.Organization = organization0
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (organization0 *Organization) AttachInspectionsamples(ctx context.Context, exec bob.Executor, related ...*FieldseekerInspectionsample) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
fieldseekerInspectionsamples1 := FieldseekerInspectionsampleSlice(related)
|
|
|
|
_, err = attachOrganizationInspectionsamples0(ctx, exec, len(related), fieldseekerInspectionsamples1, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.Inspectionsamples = append(organization0.R.Inspectionsamples, fieldseekerInspectionsamples1...)
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = organization0
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func insertOrganizationInspectionsampledetails0(ctx context.Context, exec bob.Executor, fieldseekerInspectionsampledetails1 []*FieldseekerInspectionsampledetailSetter, organization0 *Organization) (FieldseekerInspectionsampledetailSlice, error) {
|
|
for i := range fieldseekerInspectionsampledetails1 {
|
|
fieldseekerInspectionsampledetails1[i].OrganizationID = omit.From(organization0.ID)
|
|
}
|
|
|
|
ret, err := FieldseekerInspectionsampledetails.Insert(bob.ToMods(fieldseekerInspectionsampledetails1...)).All(ctx, exec)
|
|
if err != nil {
|
|
return ret, fmt.Errorf("insertOrganizationInspectionsampledetails0: %w", err)
|
|
}
|
|
|
|
return ret, nil
|
|
}
|
|
|
|
func attachOrganizationInspectionsampledetails0(ctx context.Context, exec bob.Executor, count int, fieldseekerInspectionsampledetails1 FieldseekerInspectionsampledetailSlice, organization0 *Organization) (FieldseekerInspectionsampledetailSlice, error) {
|
|
setter := &FieldseekerInspectionsampledetailSetter{
|
|
OrganizationID: omit.From(organization0.ID),
|
|
}
|
|
|
|
err := fieldseekerInspectionsampledetails1.UpdateAll(ctx, exec, *setter)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("attachOrganizationInspectionsampledetails0: %w", err)
|
|
}
|
|
|
|
return fieldseekerInspectionsampledetails1, nil
|
|
}
|
|
|
|
func (organization0 *Organization) InsertInspectionsampledetails(ctx context.Context, exec bob.Executor, related ...*FieldseekerInspectionsampledetailSetter) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
|
|
fieldseekerInspectionsampledetails1, err := insertOrganizationInspectionsampledetails0(ctx, exec, related, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.Inspectionsampledetails = append(organization0.R.Inspectionsampledetails, fieldseekerInspectionsampledetails1...)
|
|
|
|
for _, rel := range fieldseekerInspectionsampledetails1 {
|
|
rel.R.Organization = organization0
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (organization0 *Organization) AttachInspectionsampledetails(ctx context.Context, exec bob.Executor, related ...*FieldseekerInspectionsampledetail) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
fieldseekerInspectionsampledetails1 := FieldseekerInspectionsampledetailSlice(related)
|
|
|
|
_, err = attachOrganizationInspectionsampledetails0(ctx, exec, len(related), fieldseekerInspectionsampledetails1, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.Inspectionsampledetails = append(organization0.R.Inspectionsampledetails, fieldseekerInspectionsampledetails1...)
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = organization0
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func insertOrganizationLinelocations0(ctx context.Context, exec bob.Executor, fieldseekerLinelocations1 []*FieldseekerLinelocationSetter, organization0 *Organization) (FieldseekerLinelocationSlice, error) {
|
|
for i := range fieldseekerLinelocations1 {
|
|
fieldseekerLinelocations1[i].OrganizationID = omit.From(organization0.ID)
|
|
}
|
|
|
|
ret, err := FieldseekerLinelocations.Insert(bob.ToMods(fieldseekerLinelocations1...)).All(ctx, exec)
|
|
if err != nil {
|
|
return ret, fmt.Errorf("insertOrganizationLinelocations0: %w", err)
|
|
}
|
|
|
|
return ret, nil
|
|
}
|
|
|
|
func attachOrganizationLinelocations0(ctx context.Context, exec bob.Executor, count int, fieldseekerLinelocations1 FieldseekerLinelocationSlice, organization0 *Organization) (FieldseekerLinelocationSlice, error) {
|
|
setter := &FieldseekerLinelocationSetter{
|
|
OrganizationID: omit.From(organization0.ID),
|
|
}
|
|
|
|
err := fieldseekerLinelocations1.UpdateAll(ctx, exec, *setter)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("attachOrganizationLinelocations0: %w", err)
|
|
}
|
|
|
|
return fieldseekerLinelocations1, nil
|
|
}
|
|
|
|
func (organization0 *Organization) InsertLinelocations(ctx context.Context, exec bob.Executor, related ...*FieldseekerLinelocationSetter) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
|
|
fieldseekerLinelocations1, err := insertOrganizationLinelocations0(ctx, exec, related, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.Linelocations = append(organization0.R.Linelocations, fieldseekerLinelocations1...)
|
|
|
|
for _, rel := range fieldseekerLinelocations1 {
|
|
rel.R.Organization = organization0
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (organization0 *Organization) AttachLinelocations(ctx context.Context, exec bob.Executor, related ...*FieldseekerLinelocation) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
fieldseekerLinelocations1 := FieldseekerLinelocationSlice(related)
|
|
|
|
_, err = attachOrganizationLinelocations0(ctx, exec, len(related), fieldseekerLinelocations1, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.Linelocations = append(organization0.R.Linelocations, fieldseekerLinelocations1...)
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = organization0
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func insertOrganizationLocationtrackings0(ctx context.Context, exec bob.Executor, fieldseekerLocationtrackings1 []*FieldseekerLocationtrackingSetter, organization0 *Organization) (FieldseekerLocationtrackingSlice, error) {
|
|
for i := range fieldseekerLocationtrackings1 {
|
|
fieldseekerLocationtrackings1[i].OrganizationID = omit.From(organization0.ID)
|
|
}
|
|
|
|
ret, err := FieldseekerLocationtrackings.Insert(bob.ToMods(fieldseekerLocationtrackings1...)).All(ctx, exec)
|
|
if err != nil {
|
|
return ret, fmt.Errorf("insertOrganizationLocationtrackings0: %w", err)
|
|
}
|
|
|
|
return ret, nil
|
|
}
|
|
|
|
func attachOrganizationLocationtrackings0(ctx context.Context, exec bob.Executor, count int, fieldseekerLocationtrackings1 FieldseekerLocationtrackingSlice, organization0 *Organization) (FieldseekerLocationtrackingSlice, error) {
|
|
setter := &FieldseekerLocationtrackingSetter{
|
|
OrganizationID: omit.From(organization0.ID),
|
|
}
|
|
|
|
err := fieldseekerLocationtrackings1.UpdateAll(ctx, exec, *setter)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("attachOrganizationLocationtrackings0: %w", err)
|
|
}
|
|
|
|
return fieldseekerLocationtrackings1, nil
|
|
}
|
|
|
|
func (organization0 *Organization) InsertLocationtrackings(ctx context.Context, exec bob.Executor, related ...*FieldseekerLocationtrackingSetter) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
|
|
fieldseekerLocationtrackings1, err := insertOrganizationLocationtrackings0(ctx, exec, related, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.Locationtrackings = append(organization0.R.Locationtrackings, fieldseekerLocationtrackings1...)
|
|
|
|
for _, rel := range fieldseekerLocationtrackings1 {
|
|
rel.R.Organization = organization0
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (organization0 *Organization) AttachLocationtrackings(ctx context.Context, exec bob.Executor, related ...*FieldseekerLocationtracking) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
fieldseekerLocationtrackings1 := FieldseekerLocationtrackingSlice(related)
|
|
|
|
_, err = attachOrganizationLocationtrackings0(ctx, exec, len(related), fieldseekerLocationtrackings1, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.Locationtrackings = append(organization0.R.Locationtrackings, fieldseekerLocationtrackings1...)
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = organization0
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func insertOrganizationMosquitoinspections0(ctx context.Context, exec bob.Executor, fieldseekerMosquitoinspections1 []*FieldseekerMosquitoinspectionSetter, organization0 *Organization) (FieldseekerMosquitoinspectionSlice, error) {
|
|
for i := range fieldseekerMosquitoinspections1 {
|
|
fieldseekerMosquitoinspections1[i].OrganizationID = omit.From(organization0.ID)
|
|
}
|
|
|
|
ret, err := FieldseekerMosquitoinspections.Insert(bob.ToMods(fieldseekerMosquitoinspections1...)).All(ctx, exec)
|
|
if err != nil {
|
|
return ret, fmt.Errorf("insertOrganizationMosquitoinspections0: %w", err)
|
|
}
|
|
|
|
return ret, nil
|
|
}
|
|
|
|
func attachOrganizationMosquitoinspections0(ctx context.Context, exec bob.Executor, count int, fieldseekerMosquitoinspections1 FieldseekerMosquitoinspectionSlice, organization0 *Organization) (FieldseekerMosquitoinspectionSlice, error) {
|
|
setter := &FieldseekerMosquitoinspectionSetter{
|
|
OrganizationID: omit.From(organization0.ID),
|
|
}
|
|
|
|
err := fieldseekerMosquitoinspections1.UpdateAll(ctx, exec, *setter)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("attachOrganizationMosquitoinspections0: %w", err)
|
|
}
|
|
|
|
return fieldseekerMosquitoinspections1, nil
|
|
}
|
|
|
|
func (organization0 *Organization) InsertMosquitoinspections(ctx context.Context, exec bob.Executor, related ...*FieldseekerMosquitoinspectionSetter) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
|
|
fieldseekerMosquitoinspections1, err := insertOrganizationMosquitoinspections0(ctx, exec, related, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.Mosquitoinspections = append(organization0.R.Mosquitoinspections, fieldseekerMosquitoinspections1...)
|
|
|
|
for _, rel := range fieldseekerMosquitoinspections1 {
|
|
rel.R.Organization = organization0
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (organization0 *Organization) AttachMosquitoinspections(ctx context.Context, exec bob.Executor, related ...*FieldseekerMosquitoinspection) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
fieldseekerMosquitoinspections1 := FieldseekerMosquitoinspectionSlice(related)
|
|
|
|
_, err = attachOrganizationMosquitoinspections0(ctx, exec, len(related), fieldseekerMosquitoinspections1, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.Mosquitoinspections = append(organization0.R.Mosquitoinspections, fieldseekerMosquitoinspections1...)
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = organization0
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func insertOrganizationPointlocations0(ctx context.Context, exec bob.Executor, fieldseekerPointlocations1 []*FieldseekerPointlocationSetter, organization0 *Organization) (FieldseekerPointlocationSlice, error) {
|
|
for i := range fieldseekerPointlocations1 {
|
|
fieldseekerPointlocations1[i].OrganizationID = omit.From(organization0.ID)
|
|
}
|
|
|
|
ret, err := FieldseekerPointlocations.Insert(bob.ToMods(fieldseekerPointlocations1...)).All(ctx, exec)
|
|
if err != nil {
|
|
return ret, fmt.Errorf("insertOrganizationPointlocations0: %w", err)
|
|
}
|
|
|
|
return ret, nil
|
|
}
|
|
|
|
func attachOrganizationPointlocations0(ctx context.Context, exec bob.Executor, count int, fieldseekerPointlocations1 FieldseekerPointlocationSlice, organization0 *Organization) (FieldseekerPointlocationSlice, error) {
|
|
setter := &FieldseekerPointlocationSetter{
|
|
OrganizationID: omit.From(organization0.ID),
|
|
}
|
|
|
|
err := fieldseekerPointlocations1.UpdateAll(ctx, exec, *setter)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("attachOrganizationPointlocations0: %w", err)
|
|
}
|
|
|
|
return fieldseekerPointlocations1, nil
|
|
}
|
|
|
|
func (organization0 *Organization) InsertPointlocations(ctx context.Context, exec bob.Executor, related ...*FieldseekerPointlocationSetter) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
|
|
fieldseekerPointlocations1, err := insertOrganizationPointlocations0(ctx, exec, related, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.Pointlocations = append(organization0.R.Pointlocations, fieldseekerPointlocations1...)
|
|
|
|
for _, rel := range fieldseekerPointlocations1 {
|
|
rel.R.Organization = organization0
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (organization0 *Organization) AttachPointlocations(ctx context.Context, exec bob.Executor, related ...*FieldseekerPointlocation) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
fieldseekerPointlocations1 := FieldseekerPointlocationSlice(related)
|
|
|
|
_, err = attachOrganizationPointlocations0(ctx, exec, len(related), fieldseekerPointlocations1, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.Pointlocations = append(organization0.R.Pointlocations, fieldseekerPointlocations1...)
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = organization0
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func insertOrganizationPolygonlocations0(ctx context.Context, exec bob.Executor, fieldseekerPolygonlocations1 []*FieldseekerPolygonlocationSetter, organization0 *Organization) (FieldseekerPolygonlocationSlice, error) {
|
|
for i := range fieldseekerPolygonlocations1 {
|
|
fieldseekerPolygonlocations1[i].OrganizationID = omit.From(organization0.ID)
|
|
}
|
|
|
|
ret, err := FieldseekerPolygonlocations.Insert(bob.ToMods(fieldseekerPolygonlocations1...)).All(ctx, exec)
|
|
if err != nil {
|
|
return ret, fmt.Errorf("insertOrganizationPolygonlocations0: %w", err)
|
|
}
|
|
|
|
return ret, nil
|
|
}
|
|
|
|
func attachOrganizationPolygonlocations0(ctx context.Context, exec bob.Executor, count int, fieldseekerPolygonlocations1 FieldseekerPolygonlocationSlice, organization0 *Organization) (FieldseekerPolygonlocationSlice, error) {
|
|
setter := &FieldseekerPolygonlocationSetter{
|
|
OrganizationID: omit.From(organization0.ID),
|
|
}
|
|
|
|
err := fieldseekerPolygonlocations1.UpdateAll(ctx, exec, *setter)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("attachOrganizationPolygonlocations0: %w", err)
|
|
}
|
|
|
|
return fieldseekerPolygonlocations1, nil
|
|
}
|
|
|
|
func (organization0 *Organization) InsertPolygonlocations(ctx context.Context, exec bob.Executor, related ...*FieldseekerPolygonlocationSetter) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
|
|
fieldseekerPolygonlocations1, err := insertOrganizationPolygonlocations0(ctx, exec, related, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.Polygonlocations = append(organization0.R.Polygonlocations, fieldseekerPolygonlocations1...)
|
|
|
|
for _, rel := range fieldseekerPolygonlocations1 {
|
|
rel.R.Organization = organization0
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (organization0 *Organization) AttachPolygonlocations(ctx context.Context, exec bob.Executor, related ...*FieldseekerPolygonlocation) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
fieldseekerPolygonlocations1 := FieldseekerPolygonlocationSlice(related)
|
|
|
|
_, err = attachOrganizationPolygonlocations0(ctx, exec, len(related), fieldseekerPolygonlocations1, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.Polygonlocations = append(organization0.R.Polygonlocations, fieldseekerPolygonlocations1...)
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = organization0
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func insertOrganizationPools0(ctx context.Context, exec bob.Executor, fieldseekerPools1 []*FieldseekerPoolSetter, organization0 *Organization) (FieldseekerPoolSlice, error) {
|
|
for i := range fieldseekerPools1 {
|
|
fieldseekerPools1[i].OrganizationID = omit.From(organization0.ID)
|
|
}
|
|
|
|
ret, err := FieldseekerPools.Insert(bob.ToMods(fieldseekerPools1...)).All(ctx, exec)
|
|
if err != nil {
|
|
return ret, fmt.Errorf("insertOrganizationPools0: %w", err)
|
|
}
|
|
|
|
return ret, nil
|
|
}
|
|
|
|
func attachOrganizationPools0(ctx context.Context, exec bob.Executor, count int, fieldseekerPools1 FieldseekerPoolSlice, organization0 *Organization) (FieldseekerPoolSlice, error) {
|
|
setter := &FieldseekerPoolSetter{
|
|
OrganizationID: omit.From(organization0.ID),
|
|
}
|
|
|
|
err := fieldseekerPools1.UpdateAll(ctx, exec, *setter)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("attachOrganizationPools0: %w", err)
|
|
}
|
|
|
|
return fieldseekerPools1, nil
|
|
}
|
|
|
|
func (organization0 *Organization) InsertPools(ctx context.Context, exec bob.Executor, related ...*FieldseekerPoolSetter) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
|
|
fieldseekerPools1, err := insertOrganizationPools0(ctx, exec, related, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.Pools = append(organization0.R.Pools, fieldseekerPools1...)
|
|
|
|
for _, rel := range fieldseekerPools1 {
|
|
rel.R.Organization = organization0
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (organization0 *Organization) AttachPools(ctx context.Context, exec bob.Executor, related ...*FieldseekerPool) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
fieldseekerPools1 := FieldseekerPoolSlice(related)
|
|
|
|
_, err = attachOrganizationPools0(ctx, exec, len(related), fieldseekerPools1, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.Pools = append(organization0.R.Pools, fieldseekerPools1...)
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = organization0
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func insertOrganizationPooldetails0(ctx context.Context, exec bob.Executor, fieldseekerPooldetails1 []*FieldseekerPooldetailSetter, organization0 *Organization) (FieldseekerPooldetailSlice, error) {
|
|
for i := range fieldseekerPooldetails1 {
|
|
fieldseekerPooldetails1[i].OrganizationID = omit.From(organization0.ID)
|
|
}
|
|
|
|
ret, err := FieldseekerPooldetails.Insert(bob.ToMods(fieldseekerPooldetails1...)).All(ctx, exec)
|
|
if err != nil {
|
|
return ret, fmt.Errorf("insertOrganizationPooldetails0: %w", err)
|
|
}
|
|
|
|
return ret, nil
|
|
}
|
|
|
|
func attachOrganizationPooldetails0(ctx context.Context, exec bob.Executor, count int, fieldseekerPooldetails1 FieldseekerPooldetailSlice, organization0 *Organization) (FieldseekerPooldetailSlice, error) {
|
|
setter := &FieldseekerPooldetailSetter{
|
|
OrganizationID: omit.From(organization0.ID),
|
|
}
|
|
|
|
err := fieldseekerPooldetails1.UpdateAll(ctx, exec, *setter)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("attachOrganizationPooldetails0: %w", err)
|
|
}
|
|
|
|
return fieldseekerPooldetails1, nil
|
|
}
|
|
|
|
func (organization0 *Organization) InsertPooldetails(ctx context.Context, exec bob.Executor, related ...*FieldseekerPooldetailSetter) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
|
|
fieldseekerPooldetails1, err := insertOrganizationPooldetails0(ctx, exec, related, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.Pooldetails = append(organization0.R.Pooldetails, fieldseekerPooldetails1...)
|
|
|
|
for _, rel := range fieldseekerPooldetails1 {
|
|
rel.R.Organization = organization0
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (organization0 *Organization) AttachPooldetails(ctx context.Context, exec bob.Executor, related ...*FieldseekerPooldetail) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
fieldseekerPooldetails1 := FieldseekerPooldetailSlice(related)
|
|
|
|
_, err = attachOrganizationPooldetails0(ctx, exec, len(related), fieldseekerPooldetails1, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.Pooldetails = append(organization0.R.Pooldetails, fieldseekerPooldetails1...)
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = organization0
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func insertOrganizationProposedtreatmentareas0(ctx context.Context, exec bob.Executor, fieldseekerProposedtreatmentareas1 []*FieldseekerProposedtreatmentareaSetter, organization0 *Organization) (FieldseekerProposedtreatmentareaSlice, error) {
|
|
for i := range fieldseekerProposedtreatmentareas1 {
|
|
fieldseekerProposedtreatmentareas1[i].OrganizationID = omit.From(organization0.ID)
|
|
}
|
|
|
|
ret, err := FieldseekerProposedtreatmentareas.Insert(bob.ToMods(fieldseekerProposedtreatmentareas1...)).All(ctx, exec)
|
|
if err != nil {
|
|
return ret, fmt.Errorf("insertOrganizationProposedtreatmentareas0: %w", err)
|
|
}
|
|
|
|
return ret, nil
|
|
}
|
|
|
|
func attachOrganizationProposedtreatmentareas0(ctx context.Context, exec bob.Executor, count int, fieldseekerProposedtreatmentareas1 FieldseekerProposedtreatmentareaSlice, organization0 *Organization) (FieldseekerProposedtreatmentareaSlice, error) {
|
|
setter := &FieldseekerProposedtreatmentareaSetter{
|
|
OrganizationID: omit.From(organization0.ID),
|
|
}
|
|
|
|
err := fieldseekerProposedtreatmentareas1.UpdateAll(ctx, exec, *setter)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("attachOrganizationProposedtreatmentareas0: %w", err)
|
|
}
|
|
|
|
return fieldseekerProposedtreatmentareas1, nil
|
|
}
|
|
|
|
func (organization0 *Organization) InsertProposedtreatmentareas(ctx context.Context, exec bob.Executor, related ...*FieldseekerProposedtreatmentareaSetter) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
|
|
fieldseekerProposedtreatmentareas1, err := insertOrganizationProposedtreatmentareas0(ctx, exec, related, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.Proposedtreatmentareas = append(organization0.R.Proposedtreatmentareas, fieldseekerProposedtreatmentareas1...)
|
|
|
|
for _, rel := range fieldseekerProposedtreatmentareas1 {
|
|
rel.R.Organization = organization0
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (organization0 *Organization) AttachProposedtreatmentareas(ctx context.Context, exec bob.Executor, related ...*FieldseekerProposedtreatmentarea) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
fieldseekerProposedtreatmentareas1 := FieldseekerProposedtreatmentareaSlice(related)
|
|
|
|
_, err = attachOrganizationProposedtreatmentareas0(ctx, exec, len(related), fieldseekerProposedtreatmentareas1, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.Proposedtreatmentareas = append(organization0.R.Proposedtreatmentareas, fieldseekerProposedtreatmentareas1...)
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = organization0
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func insertOrganizationQamosquitoinspections0(ctx context.Context, exec bob.Executor, fieldseekerQamosquitoinspections1 []*FieldseekerQamosquitoinspectionSetter, organization0 *Organization) (FieldseekerQamosquitoinspectionSlice, error) {
|
|
for i := range fieldseekerQamosquitoinspections1 {
|
|
fieldseekerQamosquitoinspections1[i].OrganizationID = omit.From(organization0.ID)
|
|
}
|
|
|
|
ret, err := FieldseekerQamosquitoinspections.Insert(bob.ToMods(fieldseekerQamosquitoinspections1...)).All(ctx, exec)
|
|
if err != nil {
|
|
return ret, fmt.Errorf("insertOrganizationQamosquitoinspections0: %w", err)
|
|
}
|
|
|
|
return ret, nil
|
|
}
|
|
|
|
func attachOrganizationQamosquitoinspections0(ctx context.Context, exec bob.Executor, count int, fieldseekerQamosquitoinspections1 FieldseekerQamosquitoinspectionSlice, organization0 *Organization) (FieldseekerQamosquitoinspectionSlice, error) {
|
|
setter := &FieldseekerQamosquitoinspectionSetter{
|
|
OrganizationID: omit.From(organization0.ID),
|
|
}
|
|
|
|
err := fieldseekerQamosquitoinspections1.UpdateAll(ctx, exec, *setter)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("attachOrganizationQamosquitoinspections0: %w", err)
|
|
}
|
|
|
|
return fieldseekerQamosquitoinspections1, nil
|
|
}
|
|
|
|
func (organization0 *Organization) InsertQamosquitoinspections(ctx context.Context, exec bob.Executor, related ...*FieldseekerQamosquitoinspectionSetter) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
|
|
fieldseekerQamosquitoinspections1, err := insertOrganizationQamosquitoinspections0(ctx, exec, related, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.Qamosquitoinspections = append(organization0.R.Qamosquitoinspections, fieldseekerQamosquitoinspections1...)
|
|
|
|
for _, rel := range fieldseekerQamosquitoinspections1 {
|
|
rel.R.Organization = organization0
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (organization0 *Organization) AttachQamosquitoinspections(ctx context.Context, exec bob.Executor, related ...*FieldseekerQamosquitoinspection) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
fieldseekerQamosquitoinspections1 := FieldseekerQamosquitoinspectionSlice(related)
|
|
|
|
_, err = attachOrganizationQamosquitoinspections0(ctx, exec, len(related), fieldseekerQamosquitoinspections1, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.Qamosquitoinspections = append(organization0.R.Qamosquitoinspections, fieldseekerQamosquitoinspections1...)
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = organization0
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func insertOrganizationRodentlocations0(ctx context.Context, exec bob.Executor, fieldseekerRodentlocations1 []*FieldseekerRodentlocationSetter, organization0 *Organization) (FieldseekerRodentlocationSlice, error) {
|
|
for i := range fieldseekerRodentlocations1 {
|
|
fieldseekerRodentlocations1[i].OrganizationID = omit.From(organization0.ID)
|
|
}
|
|
|
|
ret, err := FieldseekerRodentlocations.Insert(bob.ToMods(fieldseekerRodentlocations1...)).All(ctx, exec)
|
|
if err != nil {
|
|
return ret, fmt.Errorf("insertOrganizationRodentlocations0: %w", err)
|
|
}
|
|
|
|
return ret, nil
|
|
}
|
|
|
|
func attachOrganizationRodentlocations0(ctx context.Context, exec bob.Executor, count int, fieldseekerRodentlocations1 FieldseekerRodentlocationSlice, organization0 *Organization) (FieldseekerRodentlocationSlice, error) {
|
|
setter := &FieldseekerRodentlocationSetter{
|
|
OrganizationID: omit.From(organization0.ID),
|
|
}
|
|
|
|
err := fieldseekerRodentlocations1.UpdateAll(ctx, exec, *setter)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("attachOrganizationRodentlocations0: %w", err)
|
|
}
|
|
|
|
return fieldseekerRodentlocations1, nil
|
|
}
|
|
|
|
func (organization0 *Organization) InsertRodentlocations(ctx context.Context, exec bob.Executor, related ...*FieldseekerRodentlocationSetter) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
|
|
fieldseekerRodentlocations1, err := insertOrganizationRodentlocations0(ctx, exec, related, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.Rodentlocations = append(organization0.R.Rodentlocations, fieldseekerRodentlocations1...)
|
|
|
|
for _, rel := range fieldseekerRodentlocations1 {
|
|
rel.R.Organization = organization0
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (organization0 *Organization) AttachRodentlocations(ctx context.Context, exec bob.Executor, related ...*FieldseekerRodentlocation) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
fieldseekerRodentlocations1 := FieldseekerRodentlocationSlice(related)
|
|
|
|
_, err = attachOrganizationRodentlocations0(ctx, exec, len(related), fieldseekerRodentlocations1, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.Rodentlocations = append(organization0.R.Rodentlocations, fieldseekerRodentlocations1...)
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = organization0
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func insertOrganizationSamplecollections0(ctx context.Context, exec bob.Executor, fieldseekerSamplecollections1 []*FieldseekerSamplecollectionSetter, organization0 *Organization) (FieldseekerSamplecollectionSlice, error) {
|
|
for i := range fieldseekerSamplecollections1 {
|
|
fieldseekerSamplecollections1[i].OrganizationID = omit.From(organization0.ID)
|
|
}
|
|
|
|
ret, err := FieldseekerSamplecollections.Insert(bob.ToMods(fieldseekerSamplecollections1...)).All(ctx, exec)
|
|
if err != nil {
|
|
return ret, fmt.Errorf("insertOrganizationSamplecollections0: %w", err)
|
|
}
|
|
|
|
return ret, nil
|
|
}
|
|
|
|
func attachOrganizationSamplecollections0(ctx context.Context, exec bob.Executor, count int, fieldseekerSamplecollections1 FieldseekerSamplecollectionSlice, organization0 *Organization) (FieldseekerSamplecollectionSlice, error) {
|
|
setter := &FieldseekerSamplecollectionSetter{
|
|
OrganizationID: omit.From(organization0.ID),
|
|
}
|
|
|
|
err := fieldseekerSamplecollections1.UpdateAll(ctx, exec, *setter)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("attachOrganizationSamplecollections0: %w", err)
|
|
}
|
|
|
|
return fieldseekerSamplecollections1, nil
|
|
}
|
|
|
|
func (organization0 *Organization) InsertSamplecollections(ctx context.Context, exec bob.Executor, related ...*FieldseekerSamplecollectionSetter) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
|
|
fieldseekerSamplecollections1, err := insertOrganizationSamplecollections0(ctx, exec, related, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.Samplecollections = append(organization0.R.Samplecollections, fieldseekerSamplecollections1...)
|
|
|
|
for _, rel := range fieldseekerSamplecollections1 {
|
|
rel.R.Organization = organization0
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (organization0 *Organization) AttachSamplecollections(ctx context.Context, exec bob.Executor, related ...*FieldseekerSamplecollection) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
fieldseekerSamplecollections1 := FieldseekerSamplecollectionSlice(related)
|
|
|
|
_, err = attachOrganizationSamplecollections0(ctx, exec, len(related), fieldseekerSamplecollections1, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.Samplecollections = append(organization0.R.Samplecollections, fieldseekerSamplecollections1...)
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = organization0
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func insertOrganizationSamplelocations0(ctx context.Context, exec bob.Executor, fieldseekerSamplelocations1 []*FieldseekerSamplelocationSetter, organization0 *Organization) (FieldseekerSamplelocationSlice, error) {
|
|
for i := range fieldseekerSamplelocations1 {
|
|
fieldseekerSamplelocations1[i].OrganizationID = omit.From(organization0.ID)
|
|
}
|
|
|
|
ret, err := FieldseekerSamplelocations.Insert(bob.ToMods(fieldseekerSamplelocations1...)).All(ctx, exec)
|
|
if err != nil {
|
|
return ret, fmt.Errorf("insertOrganizationSamplelocations0: %w", err)
|
|
}
|
|
|
|
return ret, nil
|
|
}
|
|
|
|
func attachOrganizationSamplelocations0(ctx context.Context, exec bob.Executor, count int, fieldseekerSamplelocations1 FieldseekerSamplelocationSlice, organization0 *Organization) (FieldseekerSamplelocationSlice, error) {
|
|
setter := &FieldseekerSamplelocationSetter{
|
|
OrganizationID: omit.From(organization0.ID),
|
|
}
|
|
|
|
err := fieldseekerSamplelocations1.UpdateAll(ctx, exec, *setter)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("attachOrganizationSamplelocations0: %w", err)
|
|
}
|
|
|
|
return fieldseekerSamplelocations1, nil
|
|
}
|
|
|
|
func (organization0 *Organization) InsertSamplelocations(ctx context.Context, exec bob.Executor, related ...*FieldseekerSamplelocationSetter) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
|
|
fieldseekerSamplelocations1, err := insertOrganizationSamplelocations0(ctx, exec, related, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.Samplelocations = append(organization0.R.Samplelocations, fieldseekerSamplelocations1...)
|
|
|
|
for _, rel := range fieldseekerSamplelocations1 {
|
|
rel.R.Organization = organization0
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (organization0 *Organization) AttachSamplelocations(ctx context.Context, exec bob.Executor, related ...*FieldseekerSamplelocation) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
fieldseekerSamplelocations1 := FieldseekerSamplelocationSlice(related)
|
|
|
|
_, err = attachOrganizationSamplelocations0(ctx, exec, len(related), fieldseekerSamplelocations1, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.Samplelocations = append(organization0.R.Samplelocations, fieldseekerSamplelocations1...)
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = organization0
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func insertOrganizationServicerequests0(ctx context.Context, exec bob.Executor, fieldseekerServicerequests1 []*FieldseekerServicerequestSetter, organization0 *Organization) (FieldseekerServicerequestSlice, error) {
|
|
for i := range fieldseekerServicerequests1 {
|
|
fieldseekerServicerequests1[i].OrganizationID = omit.From(organization0.ID)
|
|
}
|
|
|
|
ret, err := FieldseekerServicerequests.Insert(bob.ToMods(fieldseekerServicerequests1...)).All(ctx, exec)
|
|
if err != nil {
|
|
return ret, fmt.Errorf("insertOrganizationServicerequests0: %w", err)
|
|
}
|
|
|
|
return ret, nil
|
|
}
|
|
|
|
func attachOrganizationServicerequests0(ctx context.Context, exec bob.Executor, count int, fieldseekerServicerequests1 FieldseekerServicerequestSlice, organization0 *Organization) (FieldseekerServicerequestSlice, error) {
|
|
setter := &FieldseekerServicerequestSetter{
|
|
OrganizationID: omit.From(organization0.ID),
|
|
}
|
|
|
|
err := fieldseekerServicerequests1.UpdateAll(ctx, exec, *setter)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("attachOrganizationServicerequests0: %w", err)
|
|
}
|
|
|
|
return fieldseekerServicerequests1, nil
|
|
}
|
|
|
|
func (organization0 *Organization) InsertServicerequests(ctx context.Context, exec bob.Executor, related ...*FieldseekerServicerequestSetter) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
|
|
fieldseekerServicerequests1, err := insertOrganizationServicerequests0(ctx, exec, related, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.Servicerequests = append(organization0.R.Servicerequests, fieldseekerServicerequests1...)
|
|
|
|
for _, rel := range fieldseekerServicerequests1 {
|
|
rel.R.Organization = organization0
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (organization0 *Organization) AttachServicerequests(ctx context.Context, exec bob.Executor, related ...*FieldseekerServicerequest) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
fieldseekerServicerequests1 := FieldseekerServicerequestSlice(related)
|
|
|
|
_, err = attachOrganizationServicerequests0(ctx, exec, len(related), fieldseekerServicerequests1, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.Servicerequests = append(organization0.R.Servicerequests, fieldseekerServicerequests1...)
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = organization0
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func insertOrganizationSpeciesabundances0(ctx context.Context, exec bob.Executor, fieldseekerSpeciesabundances1 []*FieldseekerSpeciesabundanceSetter, organization0 *Organization) (FieldseekerSpeciesabundanceSlice, error) {
|
|
for i := range fieldseekerSpeciesabundances1 {
|
|
fieldseekerSpeciesabundances1[i].OrganizationID = omit.From(organization0.ID)
|
|
}
|
|
|
|
ret, err := FieldseekerSpeciesabundances.Insert(bob.ToMods(fieldseekerSpeciesabundances1...)).All(ctx, exec)
|
|
if err != nil {
|
|
return ret, fmt.Errorf("insertOrganizationSpeciesabundances0: %w", err)
|
|
}
|
|
|
|
return ret, nil
|
|
}
|
|
|
|
func attachOrganizationSpeciesabundances0(ctx context.Context, exec bob.Executor, count int, fieldseekerSpeciesabundances1 FieldseekerSpeciesabundanceSlice, organization0 *Organization) (FieldseekerSpeciesabundanceSlice, error) {
|
|
setter := &FieldseekerSpeciesabundanceSetter{
|
|
OrganizationID: omit.From(organization0.ID),
|
|
}
|
|
|
|
err := fieldseekerSpeciesabundances1.UpdateAll(ctx, exec, *setter)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("attachOrganizationSpeciesabundances0: %w", err)
|
|
}
|
|
|
|
return fieldseekerSpeciesabundances1, nil
|
|
}
|
|
|
|
func (organization0 *Organization) InsertSpeciesabundances(ctx context.Context, exec bob.Executor, related ...*FieldseekerSpeciesabundanceSetter) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
|
|
fieldseekerSpeciesabundances1, err := insertOrganizationSpeciesabundances0(ctx, exec, related, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.Speciesabundances = append(organization0.R.Speciesabundances, fieldseekerSpeciesabundances1...)
|
|
|
|
for _, rel := range fieldseekerSpeciesabundances1 {
|
|
rel.R.Organization = organization0
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (organization0 *Organization) AttachSpeciesabundances(ctx context.Context, exec bob.Executor, related ...*FieldseekerSpeciesabundance) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
fieldseekerSpeciesabundances1 := FieldseekerSpeciesabundanceSlice(related)
|
|
|
|
_, err = attachOrganizationSpeciesabundances0(ctx, exec, len(related), fieldseekerSpeciesabundances1, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.Speciesabundances = append(organization0.R.Speciesabundances, fieldseekerSpeciesabundances1...)
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = organization0
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func insertOrganizationStormdrains0(ctx context.Context, exec bob.Executor, fieldseekerStormdrains1 []*FieldseekerStormdrainSetter, organization0 *Organization) (FieldseekerStormdrainSlice, error) {
|
|
for i := range fieldseekerStormdrains1 {
|
|
fieldseekerStormdrains1[i].OrganizationID = omit.From(organization0.ID)
|
|
}
|
|
|
|
ret, err := FieldseekerStormdrains.Insert(bob.ToMods(fieldseekerStormdrains1...)).All(ctx, exec)
|
|
if err != nil {
|
|
return ret, fmt.Errorf("insertOrganizationStormdrains0: %w", err)
|
|
}
|
|
|
|
return ret, nil
|
|
}
|
|
|
|
func attachOrganizationStormdrains0(ctx context.Context, exec bob.Executor, count int, fieldseekerStormdrains1 FieldseekerStormdrainSlice, organization0 *Organization) (FieldseekerStormdrainSlice, error) {
|
|
setter := &FieldseekerStormdrainSetter{
|
|
OrganizationID: omit.From(organization0.ID),
|
|
}
|
|
|
|
err := fieldseekerStormdrains1.UpdateAll(ctx, exec, *setter)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("attachOrganizationStormdrains0: %w", err)
|
|
}
|
|
|
|
return fieldseekerStormdrains1, nil
|
|
}
|
|
|
|
func (organization0 *Organization) InsertStormdrains(ctx context.Context, exec bob.Executor, related ...*FieldseekerStormdrainSetter) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
|
|
fieldseekerStormdrains1, err := insertOrganizationStormdrains0(ctx, exec, related, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.Stormdrains = append(organization0.R.Stormdrains, fieldseekerStormdrains1...)
|
|
|
|
for _, rel := range fieldseekerStormdrains1 {
|
|
rel.R.Organization = organization0
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (organization0 *Organization) AttachStormdrains(ctx context.Context, exec bob.Executor, related ...*FieldseekerStormdrain) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
fieldseekerStormdrains1 := FieldseekerStormdrainSlice(related)
|
|
|
|
_, err = attachOrganizationStormdrains0(ctx, exec, len(related), fieldseekerStormdrains1, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.Stormdrains = append(organization0.R.Stormdrains, fieldseekerStormdrains1...)
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = organization0
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func insertOrganizationTimecards0(ctx context.Context, exec bob.Executor, fieldseekerTimecards1 []*FieldseekerTimecardSetter, organization0 *Organization) (FieldseekerTimecardSlice, error) {
|
|
for i := range fieldseekerTimecards1 {
|
|
fieldseekerTimecards1[i].OrganizationID = omit.From(organization0.ID)
|
|
}
|
|
|
|
ret, err := FieldseekerTimecards.Insert(bob.ToMods(fieldseekerTimecards1...)).All(ctx, exec)
|
|
if err != nil {
|
|
return ret, fmt.Errorf("insertOrganizationTimecards0: %w", err)
|
|
}
|
|
|
|
return ret, nil
|
|
}
|
|
|
|
func attachOrganizationTimecards0(ctx context.Context, exec bob.Executor, count int, fieldseekerTimecards1 FieldseekerTimecardSlice, organization0 *Organization) (FieldseekerTimecardSlice, error) {
|
|
setter := &FieldseekerTimecardSetter{
|
|
OrganizationID: omit.From(organization0.ID),
|
|
}
|
|
|
|
err := fieldseekerTimecards1.UpdateAll(ctx, exec, *setter)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("attachOrganizationTimecards0: %w", err)
|
|
}
|
|
|
|
return fieldseekerTimecards1, nil
|
|
}
|
|
|
|
func (organization0 *Organization) InsertTimecards(ctx context.Context, exec bob.Executor, related ...*FieldseekerTimecardSetter) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
|
|
fieldseekerTimecards1, err := insertOrganizationTimecards0(ctx, exec, related, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.Timecards = append(organization0.R.Timecards, fieldseekerTimecards1...)
|
|
|
|
for _, rel := range fieldseekerTimecards1 {
|
|
rel.R.Organization = organization0
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (organization0 *Organization) AttachTimecards(ctx context.Context, exec bob.Executor, related ...*FieldseekerTimecard) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
fieldseekerTimecards1 := FieldseekerTimecardSlice(related)
|
|
|
|
_, err = attachOrganizationTimecards0(ctx, exec, len(related), fieldseekerTimecards1, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.Timecards = append(organization0.R.Timecards, fieldseekerTimecards1...)
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = organization0
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func insertOrganizationTrapdata0(ctx context.Context, exec bob.Executor, fieldseekerTrapdata1 []*FieldseekerTrapdatumSetter, organization0 *Organization) (FieldseekerTrapdatumSlice, error) {
|
|
for i := range fieldseekerTrapdata1 {
|
|
fieldseekerTrapdata1[i].OrganizationID = omit.From(organization0.ID)
|
|
}
|
|
|
|
ret, err := FieldseekerTrapdata.Insert(bob.ToMods(fieldseekerTrapdata1...)).All(ctx, exec)
|
|
if err != nil {
|
|
return ret, fmt.Errorf("insertOrganizationTrapdata0: %w", err)
|
|
}
|
|
|
|
return ret, nil
|
|
}
|
|
|
|
func attachOrganizationTrapdata0(ctx context.Context, exec bob.Executor, count int, fieldseekerTrapdata1 FieldseekerTrapdatumSlice, organization0 *Organization) (FieldseekerTrapdatumSlice, error) {
|
|
setter := &FieldseekerTrapdatumSetter{
|
|
OrganizationID: omit.From(organization0.ID),
|
|
}
|
|
|
|
err := fieldseekerTrapdata1.UpdateAll(ctx, exec, *setter)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("attachOrganizationTrapdata0: %w", err)
|
|
}
|
|
|
|
return fieldseekerTrapdata1, nil
|
|
}
|
|
|
|
func (organization0 *Organization) InsertTrapdata(ctx context.Context, exec bob.Executor, related ...*FieldseekerTrapdatumSetter) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
|
|
fieldseekerTrapdata1, err := insertOrganizationTrapdata0(ctx, exec, related, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.Trapdata = append(organization0.R.Trapdata, fieldseekerTrapdata1...)
|
|
|
|
for _, rel := range fieldseekerTrapdata1 {
|
|
rel.R.Organization = organization0
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (organization0 *Organization) AttachTrapdata(ctx context.Context, exec bob.Executor, related ...*FieldseekerTrapdatum) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
fieldseekerTrapdata1 := FieldseekerTrapdatumSlice(related)
|
|
|
|
_, err = attachOrganizationTrapdata0(ctx, exec, len(related), fieldseekerTrapdata1, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.Trapdata = append(organization0.R.Trapdata, fieldseekerTrapdata1...)
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = organization0
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func insertOrganizationTraplocations0(ctx context.Context, exec bob.Executor, fieldseekerTraplocations1 []*FieldseekerTraplocationSetter, organization0 *Organization) (FieldseekerTraplocationSlice, error) {
|
|
for i := range fieldseekerTraplocations1 {
|
|
fieldseekerTraplocations1[i].OrganizationID = omit.From(organization0.ID)
|
|
}
|
|
|
|
ret, err := FieldseekerTraplocations.Insert(bob.ToMods(fieldseekerTraplocations1...)).All(ctx, exec)
|
|
if err != nil {
|
|
return ret, fmt.Errorf("insertOrganizationTraplocations0: %w", err)
|
|
}
|
|
|
|
return ret, nil
|
|
}
|
|
|
|
func attachOrganizationTraplocations0(ctx context.Context, exec bob.Executor, count int, fieldseekerTraplocations1 FieldseekerTraplocationSlice, organization0 *Organization) (FieldseekerTraplocationSlice, error) {
|
|
setter := &FieldseekerTraplocationSetter{
|
|
OrganizationID: omit.From(organization0.ID),
|
|
}
|
|
|
|
err := fieldseekerTraplocations1.UpdateAll(ctx, exec, *setter)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("attachOrganizationTraplocations0: %w", err)
|
|
}
|
|
|
|
return fieldseekerTraplocations1, nil
|
|
}
|
|
|
|
func (organization0 *Organization) InsertTraplocations(ctx context.Context, exec bob.Executor, related ...*FieldseekerTraplocationSetter) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
|
|
fieldseekerTraplocations1, err := insertOrganizationTraplocations0(ctx, exec, related, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.Traplocations = append(organization0.R.Traplocations, fieldseekerTraplocations1...)
|
|
|
|
for _, rel := range fieldseekerTraplocations1 {
|
|
rel.R.Organization = organization0
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (organization0 *Organization) AttachTraplocations(ctx context.Context, exec bob.Executor, related ...*FieldseekerTraplocation) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
fieldseekerTraplocations1 := FieldseekerTraplocationSlice(related)
|
|
|
|
_, err = attachOrganizationTraplocations0(ctx, exec, len(related), fieldseekerTraplocations1, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.Traplocations = append(organization0.R.Traplocations, fieldseekerTraplocations1...)
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = organization0
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func insertOrganizationTreatments0(ctx context.Context, exec bob.Executor, fieldseekerTreatments1 []*FieldseekerTreatmentSetter, organization0 *Organization) (FieldseekerTreatmentSlice, error) {
|
|
for i := range fieldseekerTreatments1 {
|
|
fieldseekerTreatments1[i].OrganizationID = omit.From(organization0.ID)
|
|
}
|
|
|
|
ret, err := FieldseekerTreatments.Insert(bob.ToMods(fieldseekerTreatments1...)).All(ctx, exec)
|
|
if err != nil {
|
|
return ret, fmt.Errorf("insertOrganizationTreatments0: %w", err)
|
|
}
|
|
|
|
return ret, nil
|
|
}
|
|
|
|
func attachOrganizationTreatments0(ctx context.Context, exec bob.Executor, count int, fieldseekerTreatments1 FieldseekerTreatmentSlice, organization0 *Organization) (FieldseekerTreatmentSlice, error) {
|
|
setter := &FieldseekerTreatmentSetter{
|
|
OrganizationID: omit.From(organization0.ID),
|
|
}
|
|
|
|
err := fieldseekerTreatments1.UpdateAll(ctx, exec, *setter)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("attachOrganizationTreatments0: %w", err)
|
|
}
|
|
|
|
return fieldseekerTreatments1, nil
|
|
}
|
|
|
|
func (organization0 *Organization) InsertTreatments(ctx context.Context, exec bob.Executor, related ...*FieldseekerTreatmentSetter) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
|
|
fieldseekerTreatments1, err := insertOrganizationTreatments0(ctx, exec, related, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.Treatments = append(organization0.R.Treatments, fieldseekerTreatments1...)
|
|
|
|
for _, rel := range fieldseekerTreatments1 {
|
|
rel.R.Organization = organization0
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (organization0 *Organization) AttachTreatments(ctx context.Context, exec bob.Executor, related ...*FieldseekerTreatment) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
fieldseekerTreatments1 := FieldseekerTreatmentSlice(related)
|
|
|
|
_, err = attachOrganizationTreatments0(ctx, exec, len(related), fieldseekerTreatments1, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.Treatments = append(organization0.R.Treatments, fieldseekerTreatments1...)
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = organization0
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func insertOrganizationTreatmentareas0(ctx context.Context, exec bob.Executor, fieldseekerTreatmentareas1 []*FieldseekerTreatmentareaSetter, organization0 *Organization) (FieldseekerTreatmentareaSlice, error) {
|
|
for i := range fieldseekerTreatmentareas1 {
|
|
fieldseekerTreatmentareas1[i].OrganizationID = omit.From(organization0.ID)
|
|
}
|
|
|
|
ret, err := FieldseekerTreatmentareas.Insert(bob.ToMods(fieldseekerTreatmentareas1...)).All(ctx, exec)
|
|
if err != nil {
|
|
return ret, fmt.Errorf("insertOrganizationTreatmentareas0: %w", err)
|
|
}
|
|
|
|
return ret, nil
|
|
}
|
|
|
|
func attachOrganizationTreatmentareas0(ctx context.Context, exec bob.Executor, count int, fieldseekerTreatmentareas1 FieldseekerTreatmentareaSlice, organization0 *Organization) (FieldseekerTreatmentareaSlice, error) {
|
|
setter := &FieldseekerTreatmentareaSetter{
|
|
OrganizationID: omit.From(organization0.ID),
|
|
}
|
|
|
|
err := fieldseekerTreatmentareas1.UpdateAll(ctx, exec, *setter)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("attachOrganizationTreatmentareas0: %w", err)
|
|
}
|
|
|
|
return fieldseekerTreatmentareas1, nil
|
|
}
|
|
|
|
func (organization0 *Organization) InsertTreatmentareas(ctx context.Context, exec bob.Executor, related ...*FieldseekerTreatmentareaSetter) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
|
|
fieldseekerTreatmentareas1, err := insertOrganizationTreatmentareas0(ctx, exec, related, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.Treatmentareas = append(organization0.R.Treatmentareas, fieldseekerTreatmentareas1...)
|
|
|
|
for _, rel := range fieldseekerTreatmentareas1 {
|
|
rel.R.Organization = organization0
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (organization0 *Organization) AttachTreatmentareas(ctx context.Context, exec bob.Executor, related ...*FieldseekerTreatmentarea) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
fieldseekerTreatmentareas1 := FieldseekerTreatmentareaSlice(related)
|
|
|
|
_, err = attachOrganizationTreatmentareas0(ctx, exec, len(related), fieldseekerTreatmentareas1, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.Treatmentareas = append(organization0.R.Treatmentareas, fieldseekerTreatmentareas1...)
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = organization0
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func insertOrganizationZones0(ctx context.Context, exec bob.Executor, fieldseekerZones1 []*FieldseekerZoneSetter, organization0 *Organization) (FieldseekerZoneSlice, error) {
|
|
for i := range fieldseekerZones1 {
|
|
fieldseekerZones1[i].OrganizationID = omit.From(organization0.ID)
|
|
}
|
|
|
|
ret, err := FieldseekerZones.Insert(bob.ToMods(fieldseekerZones1...)).All(ctx, exec)
|
|
if err != nil {
|
|
return ret, fmt.Errorf("insertOrganizationZones0: %w", err)
|
|
}
|
|
|
|
return ret, nil
|
|
}
|
|
|
|
func attachOrganizationZones0(ctx context.Context, exec bob.Executor, count int, fieldseekerZones1 FieldseekerZoneSlice, organization0 *Organization) (FieldseekerZoneSlice, error) {
|
|
setter := &FieldseekerZoneSetter{
|
|
OrganizationID: omit.From(organization0.ID),
|
|
}
|
|
|
|
err := fieldseekerZones1.UpdateAll(ctx, exec, *setter)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("attachOrganizationZones0: %w", err)
|
|
}
|
|
|
|
return fieldseekerZones1, nil
|
|
}
|
|
|
|
func (organization0 *Organization) InsertZones(ctx context.Context, exec bob.Executor, related ...*FieldseekerZoneSetter) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
|
|
fieldseekerZones1, err := insertOrganizationZones0(ctx, exec, related, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.Zones = append(organization0.R.Zones, fieldseekerZones1...)
|
|
|
|
for _, rel := range fieldseekerZones1 {
|
|
rel.R.Organization = organization0
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (organization0 *Organization) AttachZones(ctx context.Context, exec bob.Executor, related ...*FieldseekerZone) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
fieldseekerZones1 := FieldseekerZoneSlice(related)
|
|
|
|
_, err = attachOrganizationZones0(ctx, exec, len(related), fieldseekerZones1, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.Zones = append(organization0.R.Zones, fieldseekerZones1...)
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = organization0
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func insertOrganizationZones2s0(ctx context.Context, exec bob.Executor, fieldseekerZones2s1 []*FieldseekerZones2Setter, organization0 *Organization) (FieldseekerZones2Slice, error) {
|
|
for i := range fieldseekerZones2s1 {
|
|
fieldseekerZones2s1[i].OrganizationID = omit.From(organization0.ID)
|
|
}
|
|
|
|
ret, err := FieldseekerZones2s.Insert(bob.ToMods(fieldseekerZones2s1...)).All(ctx, exec)
|
|
if err != nil {
|
|
return ret, fmt.Errorf("insertOrganizationZones2s0: %w", err)
|
|
}
|
|
|
|
return ret, nil
|
|
}
|
|
|
|
func attachOrganizationZones2s0(ctx context.Context, exec bob.Executor, count int, fieldseekerZones2s1 FieldseekerZones2Slice, organization0 *Organization) (FieldseekerZones2Slice, error) {
|
|
setter := &FieldseekerZones2Setter{
|
|
OrganizationID: omit.From(organization0.ID),
|
|
}
|
|
|
|
err := fieldseekerZones2s1.UpdateAll(ctx, exec, *setter)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("attachOrganizationZones2s0: %w", err)
|
|
}
|
|
|
|
return fieldseekerZones2s1, nil
|
|
}
|
|
|
|
func (organization0 *Organization) InsertZones2s(ctx context.Context, exec bob.Executor, related ...*FieldseekerZones2Setter) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
|
|
fieldseekerZones2s1, err := insertOrganizationZones2s0(ctx, exec, related, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.Zones2s = append(organization0.R.Zones2s, fieldseekerZones2s1...)
|
|
|
|
for _, rel := range fieldseekerZones2s1 {
|
|
rel.R.Organization = organization0
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (organization0 *Organization) AttachZones2s(ctx context.Context, exec bob.Executor, related ...*FieldseekerZones2) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
fieldseekerZones2s1 := FieldseekerZones2Slice(related)
|
|
|
|
_, err = attachOrganizationZones2s0(ctx, exec, len(related), fieldseekerZones2s1, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.Zones2s = append(organization0.R.Zones2s, fieldseekerZones2s1...)
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = organization0
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func insertOrganizationFieldseekerSyncs0(ctx context.Context, exec bob.Executor, fieldseekerSyncs1 []*FieldseekerSyncSetter, organization0 *Organization) (FieldseekerSyncSlice, error) {
|
|
for i := range fieldseekerSyncs1 {
|
|
fieldseekerSyncs1[i].OrganizationID = omit.From(organization0.ID)
|
|
}
|
|
|
|
ret, err := FieldseekerSyncs.Insert(bob.ToMods(fieldseekerSyncs1...)).All(ctx, exec)
|
|
if err != nil {
|
|
return ret, fmt.Errorf("insertOrganizationFieldseekerSyncs0: %w", err)
|
|
}
|
|
|
|
return ret, nil
|
|
}
|
|
|
|
func attachOrganizationFieldseekerSyncs0(ctx context.Context, exec bob.Executor, count int, fieldseekerSyncs1 FieldseekerSyncSlice, organization0 *Organization) (FieldseekerSyncSlice, error) {
|
|
setter := &FieldseekerSyncSetter{
|
|
OrganizationID: omit.From(organization0.ID),
|
|
}
|
|
|
|
err := fieldseekerSyncs1.UpdateAll(ctx, exec, *setter)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("attachOrganizationFieldseekerSyncs0: %w", err)
|
|
}
|
|
|
|
return fieldseekerSyncs1, nil
|
|
}
|
|
|
|
func (organization0 *Organization) InsertFieldseekerSyncs(ctx context.Context, exec bob.Executor, related ...*FieldseekerSyncSetter) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
|
|
fieldseekerSyncs1, err := insertOrganizationFieldseekerSyncs0(ctx, exec, related, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.FieldseekerSyncs = append(organization0.R.FieldseekerSyncs, fieldseekerSyncs1...)
|
|
|
|
for _, rel := range fieldseekerSyncs1 {
|
|
rel.R.Organization = organization0
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (organization0 *Organization) AttachFieldseekerSyncs(ctx context.Context, exec bob.Executor, related ...*FieldseekerSync) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
fieldseekerSyncs1 := FieldseekerSyncSlice(related)
|
|
|
|
_, err = attachOrganizationFieldseekerSyncs0(ctx, exec, len(related), fieldseekerSyncs1, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.FieldseekerSyncs = append(organization0.R.FieldseekerSyncs, fieldseekerSyncs1...)
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = organization0
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func insertOrganizationH3Aggregations0(ctx context.Context, exec bob.Executor, h3Aggregations1 []*H3AggregationSetter, organization0 *Organization) (H3AggregationSlice, error) {
|
|
for i := range h3Aggregations1 {
|
|
h3Aggregations1[i].OrganizationID = omit.From(organization0.ID)
|
|
}
|
|
|
|
ret, err := H3Aggregations.Insert(bob.ToMods(h3Aggregations1...)).All(ctx, exec)
|
|
if err != nil {
|
|
return ret, fmt.Errorf("insertOrganizationH3Aggregations0: %w", err)
|
|
}
|
|
|
|
return ret, nil
|
|
}
|
|
|
|
func attachOrganizationH3Aggregations0(ctx context.Context, exec bob.Executor, count int, h3Aggregations1 H3AggregationSlice, organization0 *Organization) (H3AggregationSlice, error) {
|
|
setter := &H3AggregationSetter{
|
|
OrganizationID: omit.From(organization0.ID),
|
|
}
|
|
|
|
err := h3Aggregations1.UpdateAll(ctx, exec, *setter)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("attachOrganizationH3Aggregations0: %w", err)
|
|
}
|
|
|
|
return h3Aggregations1, nil
|
|
}
|
|
|
|
func (organization0 *Organization) InsertH3Aggregations(ctx context.Context, exec bob.Executor, related ...*H3AggregationSetter) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
|
|
h3Aggregations1, err := insertOrganizationH3Aggregations0(ctx, exec, related, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.H3Aggregations = append(organization0.R.H3Aggregations, h3Aggregations1...)
|
|
|
|
for _, rel := range h3Aggregations1 {
|
|
rel.R.Organization = organization0
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (organization0 *Organization) AttachH3Aggregations(ctx context.Context, exec bob.Executor, related ...*H3Aggregation) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
h3Aggregations1 := H3AggregationSlice(related)
|
|
|
|
_, err = attachOrganizationH3Aggregations0(ctx, exec, len(related), h3Aggregations1, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.H3Aggregations = append(organization0.R.H3Aggregations, h3Aggregations1...)
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = organization0
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func insertOrganizationNoteAudios0(ctx context.Context, exec bob.Executor, noteAudios1 []*NoteAudioSetter, organization0 *Organization) (NoteAudioSlice, error) {
|
|
for i := range noteAudios1 {
|
|
noteAudios1[i].OrganizationID = omit.From(organization0.ID)
|
|
}
|
|
|
|
ret, err := NoteAudios.Insert(bob.ToMods(noteAudios1...)).All(ctx, exec)
|
|
if err != nil {
|
|
return ret, fmt.Errorf("insertOrganizationNoteAudios0: %w", err)
|
|
}
|
|
|
|
return ret, nil
|
|
}
|
|
|
|
func attachOrganizationNoteAudios0(ctx context.Context, exec bob.Executor, count int, noteAudios1 NoteAudioSlice, organization0 *Organization) (NoteAudioSlice, error) {
|
|
setter := &NoteAudioSetter{
|
|
OrganizationID: omit.From(organization0.ID),
|
|
}
|
|
|
|
err := noteAudios1.UpdateAll(ctx, exec, *setter)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("attachOrganizationNoteAudios0: %w", err)
|
|
}
|
|
|
|
return noteAudios1, nil
|
|
}
|
|
|
|
func (organization0 *Organization) InsertNoteAudios(ctx context.Context, exec bob.Executor, related ...*NoteAudioSetter) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
|
|
noteAudios1, err := insertOrganizationNoteAudios0(ctx, exec, related, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.NoteAudios = append(organization0.R.NoteAudios, noteAudios1...)
|
|
|
|
for _, rel := range noteAudios1 {
|
|
rel.R.Organization = organization0
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (organization0 *Organization) AttachNoteAudios(ctx context.Context, exec bob.Executor, related ...*NoteAudio) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
noteAudios1 := NoteAudioSlice(related)
|
|
|
|
_, err = attachOrganizationNoteAudios0(ctx, exec, len(related), noteAudios1, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.NoteAudios = append(organization0.R.NoteAudios, noteAudios1...)
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = organization0
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func insertOrganizationNoteImages0(ctx context.Context, exec bob.Executor, noteImages1 []*NoteImageSetter, organization0 *Organization) (NoteImageSlice, error) {
|
|
for i := range noteImages1 {
|
|
noteImages1[i].OrganizationID = omit.From(organization0.ID)
|
|
}
|
|
|
|
ret, err := NoteImages.Insert(bob.ToMods(noteImages1...)).All(ctx, exec)
|
|
if err != nil {
|
|
return ret, fmt.Errorf("insertOrganizationNoteImages0: %w", err)
|
|
}
|
|
|
|
return ret, nil
|
|
}
|
|
|
|
func attachOrganizationNoteImages0(ctx context.Context, exec bob.Executor, count int, noteImages1 NoteImageSlice, organization0 *Organization) (NoteImageSlice, error) {
|
|
setter := &NoteImageSetter{
|
|
OrganizationID: omit.From(organization0.ID),
|
|
}
|
|
|
|
err := noteImages1.UpdateAll(ctx, exec, *setter)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("attachOrganizationNoteImages0: %w", err)
|
|
}
|
|
|
|
return noteImages1, nil
|
|
}
|
|
|
|
func (organization0 *Organization) InsertNoteImages(ctx context.Context, exec bob.Executor, related ...*NoteImageSetter) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
|
|
noteImages1, err := insertOrganizationNoteImages0(ctx, exec, related, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.NoteImages = append(organization0.R.NoteImages, noteImages1...)
|
|
|
|
for _, rel := range noteImages1 {
|
|
rel.R.Organization = organization0
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (organization0 *Organization) AttachNoteImages(ctx context.Context, exec bob.Executor, related ...*NoteImage) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
noteImages1 := NoteImageSlice(related)
|
|
|
|
_, err = attachOrganizationNoteImages0(ctx, exec, len(related), noteImages1, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.NoteImages = append(organization0.R.NoteImages, noteImages1...)
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = organization0
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func insertOrganizationUser0(ctx context.Context, exec bob.Executor, users1 []*UserSetter, organization0 *Organization) (UserSlice, error) {
|
|
for i := range users1 {
|
|
users1[i].OrganizationID = omitnull.From(organization0.ID)
|
|
}
|
|
|
|
ret, err := Users.Insert(bob.ToMods(users1...)).All(ctx, exec)
|
|
if err != nil {
|
|
return ret, fmt.Errorf("insertOrganizationUser0: %w", err)
|
|
}
|
|
|
|
return ret, nil
|
|
}
|
|
|
|
func attachOrganizationUser0(ctx context.Context, exec bob.Executor, count int, users1 UserSlice, organization0 *Organization) (UserSlice, error) {
|
|
setter := &UserSetter{
|
|
OrganizationID: omitnull.From(organization0.ID),
|
|
}
|
|
|
|
err := users1.UpdateAll(ctx, exec, *setter)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("attachOrganizationUser0: %w", err)
|
|
}
|
|
|
|
return users1, nil
|
|
}
|
|
|
|
func (organization0 *Organization) InsertUser(ctx context.Context, exec bob.Executor, related ...*UserSetter) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
|
|
users1, err := insertOrganizationUser0(ctx, exec, related, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.User = append(organization0.R.User, users1...)
|
|
|
|
for _, rel := range users1 {
|
|
rel.R.Organization = organization0
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (organization0 *Organization) AttachUser(ctx context.Context, exec bob.Executor, related ...*User) error {
|
|
if len(related) == 0 {
|
|
return nil
|
|
}
|
|
|
|
var err error
|
|
users1 := UserSlice(related)
|
|
|
|
_, err = attachOrganizationUser0(ctx, exec, len(related), users1, organization0)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
organization0.R.User = append(organization0.R.User, users1...)
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = organization0
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
type organizationWhere[Q psql.Filterable] struct {
|
|
ID psql.WhereMod[Q, int32]
|
|
Name psql.WhereNullMod[Q, string]
|
|
ArcgisID psql.WhereNullMod[Q, string]
|
|
ArcgisName psql.WhereNullMod[Q, string]
|
|
FieldseekerURL psql.WhereNullMod[Q, string]
|
|
}
|
|
|
|
func (organizationWhere[Q]) AliasedAs(alias string) organizationWhere[Q] {
|
|
return buildOrganizationWhere[Q](buildOrganizationColumns(alias))
|
|
}
|
|
|
|
func buildOrganizationWhere[Q psql.Filterable](cols organizationColumns) organizationWhere[Q] {
|
|
return organizationWhere[Q]{
|
|
ID: psql.Where[Q, int32](cols.ID),
|
|
Name: psql.WhereNull[Q, string](cols.Name),
|
|
ArcgisID: psql.WhereNull[Q, string](cols.ArcgisID),
|
|
ArcgisName: psql.WhereNull[Q, string](cols.ArcgisName),
|
|
FieldseekerURL: psql.WhereNull[Q, string](cols.FieldseekerURL),
|
|
}
|
|
}
|
|
|
|
func (o *Organization) Preload(name string, retrieved any) error {
|
|
if o == nil {
|
|
return nil
|
|
}
|
|
|
|
switch name {
|
|
case "Containerrelates":
|
|
rels, ok := retrieved.(FieldseekerContainerrelateSlice)
|
|
if !ok {
|
|
return fmt.Errorf("organization cannot load %T as %q", retrieved, name)
|
|
}
|
|
|
|
o.R.Containerrelates = rels
|
|
|
|
for _, rel := range rels {
|
|
if rel != nil {
|
|
rel.R.Organization = o
|
|
}
|
|
}
|
|
return nil
|
|
case "Fieldscoutinglogs":
|
|
rels, ok := retrieved.(FieldseekerFieldscoutinglogSlice)
|
|
if !ok {
|
|
return fmt.Errorf("organization cannot load %T as %q", retrieved, name)
|
|
}
|
|
|
|
o.R.Fieldscoutinglogs = rels
|
|
|
|
for _, rel := range rels {
|
|
if rel != nil {
|
|
rel.R.Organization = o
|
|
}
|
|
}
|
|
return nil
|
|
case "Habitatrelates":
|
|
rels, ok := retrieved.(FieldseekerHabitatrelateSlice)
|
|
if !ok {
|
|
return fmt.Errorf("organization cannot load %T as %q", retrieved, name)
|
|
}
|
|
|
|
o.R.Habitatrelates = rels
|
|
|
|
for _, rel := range rels {
|
|
if rel != nil {
|
|
rel.R.Organization = o
|
|
}
|
|
}
|
|
return nil
|
|
case "Inspectionsamples":
|
|
rels, ok := retrieved.(FieldseekerInspectionsampleSlice)
|
|
if !ok {
|
|
return fmt.Errorf("organization cannot load %T as %q", retrieved, name)
|
|
}
|
|
|
|
o.R.Inspectionsamples = rels
|
|
|
|
for _, rel := range rels {
|
|
if rel != nil {
|
|
rel.R.Organization = o
|
|
}
|
|
}
|
|
return nil
|
|
case "Inspectionsampledetails":
|
|
rels, ok := retrieved.(FieldseekerInspectionsampledetailSlice)
|
|
if !ok {
|
|
return fmt.Errorf("organization cannot load %T as %q", retrieved, name)
|
|
}
|
|
|
|
o.R.Inspectionsampledetails = rels
|
|
|
|
for _, rel := range rels {
|
|
if rel != nil {
|
|
rel.R.Organization = o
|
|
}
|
|
}
|
|
return nil
|
|
case "Linelocations":
|
|
rels, ok := retrieved.(FieldseekerLinelocationSlice)
|
|
if !ok {
|
|
return fmt.Errorf("organization cannot load %T as %q", retrieved, name)
|
|
}
|
|
|
|
o.R.Linelocations = rels
|
|
|
|
for _, rel := range rels {
|
|
if rel != nil {
|
|
rel.R.Organization = o
|
|
}
|
|
}
|
|
return nil
|
|
case "Locationtrackings":
|
|
rels, ok := retrieved.(FieldseekerLocationtrackingSlice)
|
|
if !ok {
|
|
return fmt.Errorf("organization cannot load %T as %q", retrieved, name)
|
|
}
|
|
|
|
o.R.Locationtrackings = rels
|
|
|
|
for _, rel := range rels {
|
|
if rel != nil {
|
|
rel.R.Organization = o
|
|
}
|
|
}
|
|
return nil
|
|
case "Mosquitoinspections":
|
|
rels, ok := retrieved.(FieldseekerMosquitoinspectionSlice)
|
|
if !ok {
|
|
return fmt.Errorf("organization cannot load %T as %q", retrieved, name)
|
|
}
|
|
|
|
o.R.Mosquitoinspections = rels
|
|
|
|
for _, rel := range rels {
|
|
if rel != nil {
|
|
rel.R.Organization = o
|
|
}
|
|
}
|
|
return nil
|
|
case "Pointlocations":
|
|
rels, ok := retrieved.(FieldseekerPointlocationSlice)
|
|
if !ok {
|
|
return fmt.Errorf("organization cannot load %T as %q", retrieved, name)
|
|
}
|
|
|
|
o.R.Pointlocations = rels
|
|
|
|
for _, rel := range rels {
|
|
if rel != nil {
|
|
rel.R.Organization = o
|
|
}
|
|
}
|
|
return nil
|
|
case "Polygonlocations":
|
|
rels, ok := retrieved.(FieldseekerPolygonlocationSlice)
|
|
if !ok {
|
|
return fmt.Errorf("organization cannot load %T as %q", retrieved, name)
|
|
}
|
|
|
|
o.R.Polygonlocations = rels
|
|
|
|
for _, rel := range rels {
|
|
if rel != nil {
|
|
rel.R.Organization = o
|
|
}
|
|
}
|
|
return nil
|
|
case "Pools":
|
|
rels, ok := retrieved.(FieldseekerPoolSlice)
|
|
if !ok {
|
|
return fmt.Errorf("organization cannot load %T as %q", retrieved, name)
|
|
}
|
|
|
|
o.R.Pools = rels
|
|
|
|
for _, rel := range rels {
|
|
if rel != nil {
|
|
rel.R.Organization = o
|
|
}
|
|
}
|
|
return nil
|
|
case "Pooldetails":
|
|
rels, ok := retrieved.(FieldseekerPooldetailSlice)
|
|
if !ok {
|
|
return fmt.Errorf("organization cannot load %T as %q", retrieved, name)
|
|
}
|
|
|
|
o.R.Pooldetails = rels
|
|
|
|
for _, rel := range rels {
|
|
if rel != nil {
|
|
rel.R.Organization = o
|
|
}
|
|
}
|
|
return nil
|
|
case "Proposedtreatmentareas":
|
|
rels, ok := retrieved.(FieldseekerProposedtreatmentareaSlice)
|
|
if !ok {
|
|
return fmt.Errorf("organization cannot load %T as %q", retrieved, name)
|
|
}
|
|
|
|
o.R.Proposedtreatmentareas = rels
|
|
|
|
for _, rel := range rels {
|
|
if rel != nil {
|
|
rel.R.Organization = o
|
|
}
|
|
}
|
|
return nil
|
|
case "Qamosquitoinspections":
|
|
rels, ok := retrieved.(FieldseekerQamosquitoinspectionSlice)
|
|
if !ok {
|
|
return fmt.Errorf("organization cannot load %T as %q", retrieved, name)
|
|
}
|
|
|
|
o.R.Qamosquitoinspections = rels
|
|
|
|
for _, rel := range rels {
|
|
if rel != nil {
|
|
rel.R.Organization = o
|
|
}
|
|
}
|
|
return nil
|
|
case "Rodentlocations":
|
|
rels, ok := retrieved.(FieldseekerRodentlocationSlice)
|
|
if !ok {
|
|
return fmt.Errorf("organization cannot load %T as %q", retrieved, name)
|
|
}
|
|
|
|
o.R.Rodentlocations = rels
|
|
|
|
for _, rel := range rels {
|
|
if rel != nil {
|
|
rel.R.Organization = o
|
|
}
|
|
}
|
|
return nil
|
|
case "Samplecollections":
|
|
rels, ok := retrieved.(FieldseekerSamplecollectionSlice)
|
|
if !ok {
|
|
return fmt.Errorf("organization cannot load %T as %q", retrieved, name)
|
|
}
|
|
|
|
o.R.Samplecollections = rels
|
|
|
|
for _, rel := range rels {
|
|
if rel != nil {
|
|
rel.R.Organization = o
|
|
}
|
|
}
|
|
return nil
|
|
case "Samplelocations":
|
|
rels, ok := retrieved.(FieldseekerSamplelocationSlice)
|
|
if !ok {
|
|
return fmt.Errorf("organization cannot load %T as %q", retrieved, name)
|
|
}
|
|
|
|
o.R.Samplelocations = rels
|
|
|
|
for _, rel := range rels {
|
|
if rel != nil {
|
|
rel.R.Organization = o
|
|
}
|
|
}
|
|
return nil
|
|
case "Servicerequests":
|
|
rels, ok := retrieved.(FieldseekerServicerequestSlice)
|
|
if !ok {
|
|
return fmt.Errorf("organization cannot load %T as %q", retrieved, name)
|
|
}
|
|
|
|
o.R.Servicerequests = rels
|
|
|
|
for _, rel := range rels {
|
|
if rel != nil {
|
|
rel.R.Organization = o
|
|
}
|
|
}
|
|
return nil
|
|
case "Speciesabundances":
|
|
rels, ok := retrieved.(FieldseekerSpeciesabundanceSlice)
|
|
if !ok {
|
|
return fmt.Errorf("organization cannot load %T as %q", retrieved, name)
|
|
}
|
|
|
|
o.R.Speciesabundances = rels
|
|
|
|
for _, rel := range rels {
|
|
if rel != nil {
|
|
rel.R.Organization = o
|
|
}
|
|
}
|
|
return nil
|
|
case "Stormdrains":
|
|
rels, ok := retrieved.(FieldseekerStormdrainSlice)
|
|
if !ok {
|
|
return fmt.Errorf("organization cannot load %T as %q", retrieved, name)
|
|
}
|
|
|
|
o.R.Stormdrains = rels
|
|
|
|
for _, rel := range rels {
|
|
if rel != nil {
|
|
rel.R.Organization = o
|
|
}
|
|
}
|
|
return nil
|
|
case "Timecards":
|
|
rels, ok := retrieved.(FieldseekerTimecardSlice)
|
|
if !ok {
|
|
return fmt.Errorf("organization cannot load %T as %q", retrieved, name)
|
|
}
|
|
|
|
o.R.Timecards = rels
|
|
|
|
for _, rel := range rels {
|
|
if rel != nil {
|
|
rel.R.Organization = o
|
|
}
|
|
}
|
|
return nil
|
|
case "Trapdata":
|
|
rels, ok := retrieved.(FieldseekerTrapdatumSlice)
|
|
if !ok {
|
|
return fmt.Errorf("organization cannot load %T as %q", retrieved, name)
|
|
}
|
|
|
|
o.R.Trapdata = rels
|
|
|
|
for _, rel := range rels {
|
|
if rel != nil {
|
|
rel.R.Organization = o
|
|
}
|
|
}
|
|
return nil
|
|
case "Traplocations":
|
|
rels, ok := retrieved.(FieldseekerTraplocationSlice)
|
|
if !ok {
|
|
return fmt.Errorf("organization cannot load %T as %q", retrieved, name)
|
|
}
|
|
|
|
o.R.Traplocations = rels
|
|
|
|
for _, rel := range rels {
|
|
if rel != nil {
|
|
rel.R.Organization = o
|
|
}
|
|
}
|
|
return nil
|
|
case "Treatments":
|
|
rels, ok := retrieved.(FieldseekerTreatmentSlice)
|
|
if !ok {
|
|
return fmt.Errorf("organization cannot load %T as %q", retrieved, name)
|
|
}
|
|
|
|
o.R.Treatments = rels
|
|
|
|
for _, rel := range rels {
|
|
if rel != nil {
|
|
rel.R.Organization = o
|
|
}
|
|
}
|
|
return nil
|
|
case "Treatmentareas":
|
|
rels, ok := retrieved.(FieldseekerTreatmentareaSlice)
|
|
if !ok {
|
|
return fmt.Errorf("organization cannot load %T as %q", retrieved, name)
|
|
}
|
|
|
|
o.R.Treatmentareas = rels
|
|
|
|
for _, rel := range rels {
|
|
if rel != nil {
|
|
rel.R.Organization = o
|
|
}
|
|
}
|
|
return nil
|
|
case "Zones":
|
|
rels, ok := retrieved.(FieldseekerZoneSlice)
|
|
if !ok {
|
|
return fmt.Errorf("organization cannot load %T as %q", retrieved, name)
|
|
}
|
|
|
|
o.R.Zones = rels
|
|
|
|
for _, rel := range rels {
|
|
if rel != nil {
|
|
rel.R.Organization = o
|
|
}
|
|
}
|
|
return nil
|
|
case "Zones2s":
|
|
rels, ok := retrieved.(FieldseekerZones2Slice)
|
|
if !ok {
|
|
return fmt.Errorf("organization cannot load %T as %q", retrieved, name)
|
|
}
|
|
|
|
o.R.Zones2s = rels
|
|
|
|
for _, rel := range rels {
|
|
if rel != nil {
|
|
rel.R.Organization = o
|
|
}
|
|
}
|
|
return nil
|
|
case "FieldseekerSyncs":
|
|
rels, ok := retrieved.(FieldseekerSyncSlice)
|
|
if !ok {
|
|
return fmt.Errorf("organization cannot load %T as %q", retrieved, name)
|
|
}
|
|
|
|
o.R.FieldseekerSyncs = rels
|
|
|
|
for _, rel := range rels {
|
|
if rel != nil {
|
|
rel.R.Organization = o
|
|
}
|
|
}
|
|
return nil
|
|
case "H3Aggregations":
|
|
rels, ok := retrieved.(H3AggregationSlice)
|
|
if !ok {
|
|
return fmt.Errorf("organization cannot load %T as %q", retrieved, name)
|
|
}
|
|
|
|
o.R.H3Aggregations = rels
|
|
|
|
for _, rel := range rels {
|
|
if rel != nil {
|
|
rel.R.Organization = o
|
|
}
|
|
}
|
|
return nil
|
|
case "NoteAudios":
|
|
rels, ok := retrieved.(NoteAudioSlice)
|
|
if !ok {
|
|
return fmt.Errorf("organization cannot load %T as %q", retrieved, name)
|
|
}
|
|
|
|
o.R.NoteAudios = rels
|
|
|
|
for _, rel := range rels {
|
|
if rel != nil {
|
|
rel.R.Organization = o
|
|
}
|
|
}
|
|
return nil
|
|
case "NoteImages":
|
|
rels, ok := retrieved.(NoteImageSlice)
|
|
if !ok {
|
|
return fmt.Errorf("organization cannot load %T as %q", retrieved, name)
|
|
}
|
|
|
|
o.R.NoteImages = rels
|
|
|
|
for _, rel := range rels {
|
|
if rel != nil {
|
|
rel.R.Organization = o
|
|
}
|
|
}
|
|
return nil
|
|
case "User":
|
|
rels, ok := retrieved.(UserSlice)
|
|
if !ok {
|
|
return fmt.Errorf("organization cannot load %T as %q", retrieved, name)
|
|
}
|
|
|
|
o.R.User = rels
|
|
|
|
for _, rel := range rels {
|
|
if rel != nil {
|
|
rel.R.Organization = o
|
|
}
|
|
}
|
|
return nil
|
|
default:
|
|
return fmt.Errorf("organization has no relationship %q", name)
|
|
}
|
|
}
|
|
|
|
type organizationPreloader struct{}
|
|
|
|
func buildOrganizationPreloader() organizationPreloader {
|
|
return organizationPreloader{}
|
|
}
|
|
|
|
type organizationThenLoader[Q orm.Loadable] struct {
|
|
Containerrelates func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q]
|
|
Fieldscoutinglogs func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q]
|
|
Habitatrelates func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q]
|
|
Inspectionsamples func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q]
|
|
Inspectionsampledetails func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q]
|
|
Linelocations func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q]
|
|
Locationtrackings func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q]
|
|
Mosquitoinspections func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q]
|
|
Pointlocations func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q]
|
|
Polygonlocations func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q]
|
|
Pools func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q]
|
|
Pooldetails func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q]
|
|
Proposedtreatmentareas func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q]
|
|
Qamosquitoinspections func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q]
|
|
Rodentlocations func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q]
|
|
Samplecollections func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q]
|
|
Samplelocations func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q]
|
|
Servicerequests func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q]
|
|
Speciesabundances func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q]
|
|
Stormdrains func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q]
|
|
Timecards func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q]
|
|
Trapdata func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q]
|
|
Traplocations func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q]
|
|
Treatments func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q]
|
|
Treatmentareas func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q]
|
|
Zones func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q]
|
|
Zones2s func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q]
|
|
FieldseekerSyncs func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q]
|
|
H3Aggregations func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q]
|
|
NoteAudios func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q]
|
|
NoteImages func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q]
|
|
User func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q]
|
|
}
|
|
|
|
func buildOrganizationThenLoader[Q orm.Loadable]() organizationThenLoader[Q] {
|
|
type ContainerrelatesLoadInterface interface {
|
|
LoadContainerrelates(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error
|
|
}
|
|
type FieldscoutinglogsLoadInterface interface {
|
|
LoadFieldscoutinglogs(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error
|
|
}
|
|
type HabitatrelatesLoadInterface interface {
|
|
LoadHabitatrelates(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error
|
|
}
|
|
type InspectionsamplesLoadInterface interface {
|
|
LoadInspectionsamples(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error
|
|
}
|
|
type InspectionsampledetailsLoadInterface interface {
|
|
LoadInspectionsampledetails(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error
|
|
}
|
|
type LinelocationsLoadInterface interface {
|
|
LoadLinelocations(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error
|
|
}
|
|
type LocationtrackingsLoadInterface interface {
|
|
LoadLocationtrackings(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error
|
|
}
|
|
type MosquitoinspectionsLoadInterface interface {
|
|
LoadMosquitoinspections(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error
|
|
}
|
|
type PointlocationsLoadInterface interface {
|
|
LoadPointlocations(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error
|
|
}
|
|
type PolygonlocationsLoadInterface interface {
|
|
LoadPolygonlocations(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error
|
|
}
|
|
type PoolsLoadInterface interface {
|
|
LoadPools(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error
|
|
}
|
|
type PooldetailsLoadInterface interface {
|
|
LoadPooldetails(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error
|
|
}
|
|
type ProposedtreatmentareasLoadInterface interface {
|
|
LoadProposedtreatmentareas(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error
|
|
}
|
|
type QamosquitoinspectionsLoadInterface interface {
|
|
LoadQamosquitoinspections(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error
|
|
}
|
|
type RodentlocationsLoadInterface interface {
|
|
LoadRodentlocations(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error
|
|
}
|
|
type SamplecollectionsLoadInterface interface {
|
|
LoadSamplecollections(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error
|
|
}
|
|
type SamplelocationsLoadInterface interface {
|
|
LoadSamplelocations(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error
|
|
}
|
|
type ServicerequestsLoadInterface interface {
|
|
LoadServicerequests(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error
|
|
}
|
|
type SpeciesabundancesLoadInterface interface {
|
|
LoadSpeciesabundances(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error
|
|
}
|
|
type StormdrainsLoadInterface interface {
|
|
LoadStormdrains(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error
|
|
}
|
|
type TimecardsLoadInterface interface {
|
|
LoadTimecards(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error
|
|
}
|
|
type TrapdataLoadInterface interface {
|
|
LoadTrapdata(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error
|
|
}
|
|
type TraplocationsLoadInterface interface {
|
|
LoadTraplocations(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error
|
|
}
|
|
type TreatmentsLoadInterface interface {
|
|
LoadTreatments(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error
|
|
}
|
|
type TreatmentareasLoadInterface interface {
|
|
LoadTreatmentareas(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error
|
|
}
|
|
type ZonesLoadInterface interface {
|
|
LoadZones(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error
|
|
}
|
|
type Zones2sLoadInterface interface {
|
|
LoadZones2s(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error
|
|
}
|
|
type FieldseekerSyncsLoadInterface interface {
|
|
LoadFieldseekerSyncs(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error
|
|
}
|
|
type H3AggregationsLoadInterface interface {
|
|
LoadH3Aggregations(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error
|
|
}
|
|
type NoteAudiosLoadInterface interface {
|
|
LoadNoteAudios(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error
|
|
}
|
|
type NoteImagesLoadInterface interface {
|
|
LoadNoteImages(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error
|
|
}
|
|
type UserLoadInterface interface {
|
|
LoadUser(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error
|
|
}
|
|
|
|
return organizationThenLoader[Q]{
|
|
Containerrelates: thenLoadBuilder[Q](
|
|
"Containerrelates",
|
|
func(ctx context.Context, exec bob.Executor, retrieved ContainerrelatesLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
return retrieved.LoadContainerrelates(ctx, exec, mods...)
|
|
},
|
|
),
|
|
Fieldscoutinglogs: thenLoadBuilder[Q](
|
|
"Fieldscoutinglogs",
|
|
func(ctx context.Context, exec bob.Executor, retrieved FieldscoutinglogsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
return retrieved.LoadFieldscoutinglogs(ctx, exec, mods...)
|
|
},
|
|
),
|
|
Habitatrelates: thenLoadBuilder[Q](
|
|
"Habitatrelates",
|
|
func(ctx context.Context, exec bob.Executor, retrieved HabitatrelatesLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
return retrieved.LoadHabitatrelates(ctx, exec, mods...)
|
|
},
|
|
),
|
|
Inspectionsamples: thenLoadBuilder[Q](
|
|
"Inspectionsamples",
|
|
func(ctx context.Context, exec bob.Executor, retrieved InspectionsamplesLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
return retrieved.LoadInspectionsamples(ctx, exec, mods...)
|
|
},
|
|
),
|
|
Inspectionsampledetails: thenLoadBuilder[Q](
|
|
"Inspectionsampledetails",
|
|
func(ctx context.Context, exec bob.Executor, retrieved InspectionsampledetailsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
return retrieved.LoadInspectionsampledetails(ctx, exec, mods...)
|
|
},
|
|
),
|
|
Linelocations: thenLoadBuilder[Q](
|
|
"Linelocations",
|
|
func(ctx context.Context, exec bob.Executor, retrieved LinelocationsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
return retrieved.LoadLinelocations(ctx, exec, mods...)
|
|
},
|
|
),
|
|
Locationtrackings: thenLoadBuilder[Q](
|
|
"Locationtrackings",
|
|
func(ctx context.Context, exec bob.Executor, retrieved LocationtrackingsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
return retrieved.LoadLocationtrackings(ctx, exec, mods...)
|
|
},
|
|
),
|
|
Mosquitoinspections: thenLoadBuilder[Q](
|
|
"Mosquitoinspections",
|
|
func(ctx context.Context, exec bob.Executor, retrieved MosquitoinspectionsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
return retrieved.LoadMosquitoinspections(ctx, exec, mods...)
|
|
},
|
|
),
|
|
Pointlocations: thenLoadBuilder[Q](
|
|
"Pointlocations",
|
|
func(ctx context.Context, exec bob.Executor, retrieved PointlocationsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
return retrieved.LoadPointlocations(ctx, exec, mods...)
|
|
},
|
|
),
|
|
Polygonlocations: thenLoadBuilder[Q](
|
|
"Polygonlocations",
|
|
func(ctx context.Context, exec bob.Executor, retrieved PolygonlocationsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
return retrieved.LoadPolygonlocations(ctx, exec, mods...)
|
|
},
|
|
),
|
|
Pools: thenLoadBuilder[Q](
|
|
"Pools",
|
|
func(ctx context.Context, exec bob.Executor, retrieved PoolsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
return retrieved.LoadPools(ctx, exec, mods...)
|
|
},
|
|
),
|
|
Pooldetails: thenLoadBuilder[Q](
|
|
"Pooldetails",
|
|
func(ctx context.Context, exec bob.Executor, retrieved PooldetailsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
return retrieved.LoadPooldetails(ctx, exec, mods...)
|
|
},
|
|
),
|
|
Proposedtreatmentareas: thenLoadBuilder[Q](
|
|
"Proposedtreatmentareas",
|
|
func(ctx context.Context, exec bob.Executor, retrieved ProposedtreatmentareasLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
return retrieved.LoadProposedtreatmentareas(ctx, exec, mods...)
|
|
},
|
|
),
|
|
Qamosquitoinspections: thenLoadBuilder[Q](
|
|
"Qamosquitoinspections",
|
|
func(ctx context.Context, exec bob.Executor, retrieved QamosquitoinspectionsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
return retrieved.LoadQamosquitoinspections(ctx, exec, mods...)
|
|
},
|
|
),
|
|
Rodentlocations: thenLoadBuilder[Q](
|
|
"Rodentlocations",
|
|
func(ctx context.Context, exec bob.Executor, retrieved RodentlocationsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
return retrieved.LoadRodentlocations(ctx, exec, mods...)
|
|
},
|
|
),
|
|
Samplecollections: thenLoadBuilder[Q](
|
|
"Samplecollections",
|
|
func(ctx context.Context, exec bob.Executor, retrieved SamplecollectionsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
return retrieved.LoadSamplecollections(ctx, exec, mods...)
|
|
},
|
|
),
|
|
Samplelocations: thenLoadBuilder[Q](
|
|
"Samplelocations",
|
|
func(ctx context.Context, exec bob.Executor, retrieved SamplelocationsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
return retrieved.LoadSamplelocations(ctx, exec, mods...)
|
|
},
|
|
),
|
|
Servicerequests: thenLoadBuilder[Q](
|
|
"Servicerequests",
|
|
func(ctx context.Context, exec bob.Executor, retrieved ServicerequestsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
return retrieved.LoadServicerequests(ctx, exec, mods...)
|
|
},
|
|
),
|
|
Speciesabundances: thenLoadBuilder[Q](
|
|
"Speciesabundances",
|
|
func(ctx context.Context, exec bob.Executor, retrieved SpeciesabundancesLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
return retrieved.LoadSpeciesabundances(ctx, exec, mods...)
|
|
},
|
|
),
|
|
Stormdrains: thenLoadBuilder[Q](
|
|
"Stormdrains",
|
|
func(ctx context.Context, exec bob.Executor, retrieved StormdrainsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
return retrieved.LoadStormdrains(ctx, exec, mods...)
|
|
},
|
|
),
|
|
Timecards: thenLoadBuilder[Q](
|
|
"Timecards",
|
|
func(ctx context.Context, exec bob.Executor, retrieved TimecardsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
return retrieved.LoadTimecards(ctx, exec, mods...)
|
|
},
|
|
),
|
|
Trapdata: thenLoadBuilder[Q](
|
|
"Trapdata",
|
|
func(ctx context.Context, exec bob.Executor, retrieved TrapdataLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
return retrieved.LoadTrapdata(ctx, exec, mods...)
|
|
},
|
|
),
|
|
Traplocations: thenLoadBuilder[Q](
|
|
"Traplocations",
|
|
func(ctx context.Context, exec bob.Executor, retrieved TraplocationsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
return retrieved.LoadTraplocations(ctx, exec, mods...)
|
|
},
|
|
),
|
|
Treatments: thenLoadBuilder[Q](
|
|
"Treatments",
|
|
func(ctx context.Context, exec bob.Executor, retrieved TreatmentsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
return retrieved.LoadTreatments(ctx, exec, mods...)
|
|
},
|
|
),
|
|
Treatmentareas: thenLoadBuilder[Q](
|
|
"Treatmentareas",
|
|
func(ctx context.Context, exec bob.Executor, retrieved TreatmentareasLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
return retrieved.LoadTreatmentareas(ctx, exec, mods...)
|
|
},
|
|
),
|
|
Zones: thenLoadBuilder[Q](
|
|
"Zones",
|
|
func(ctx context.Context, exec bob.Executor, retrieved ZonesLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
return retrieved.LoadZones(ctx, exec, mods...)
|
|
},
|
|
),
|
|
Zones2s: thenLoadBuilder[Q](
|
|
"Zones2s",
|
|
func(ctx context.Context, exec bob.Executor, retrieved Zones2sLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
return retrieved.LoadZones2s(ctx, exec, mods...)
|
|
},
|
|
),
|
|
FieldseekerSyncs: thenLoadBuilder[Q](
|
|
"FieldseekerSyncs",
|
|
func(ctx context.Context, exec bob.Executor, retrieved FieldseekerSyncsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
return retrieved.LoadFieldseekerSyncs(ctx, exec, mods...)
|
|
},
|
|
),
|
|
H3Aggregations: thenLoadBuilder[Q](
|
|
"H3Aggregations",
|
|
func(ctx context.Context, exec bob.Executor, retrieved H3AggregationsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
return retrieved.LoadH3Aggregations(ctx, exec, mods...)
|
|
},
|
|
),
|
|
NoteAudios: thenLoadBuilder[Q](
|
|
"NoteAudios",
|
|
func(ctx context.Context, exec bob.Executor, retrieved NoteAudiosLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
return retrieved.LoadNoteAudios(ctx, exec, mods...)
|
|
},
|
|
),
|
|
NoteImages: thenLoadBuilder[Q](
|
|
"NoteImages",
|
|
func(ctx context.Context, exec bob.Executor, retrieved NoteImagesLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
return retrieved.LoadNoteImages(ctx, exec, mods...)
|
|
},
|
|
),
|
|
User: thenLoadBuilder[Q](
|
|
"User",
|
|
func(ctx context.Context, exec bob.Executor, retrieved UserLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
return retrieved.LoadUser(ctx, exec, mods...)
|
|
},
|
|
),
|
|
}
|
|
}
|
|
|
|
// LoadContainerrelates loads the organization's Containerrelates into the .R struct
|
|
func (o *Organization) LoadContainerrelates(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if o == nil {
|
|
return nil
|
|
}
|
|
|
|
// Reset the relationship
|
|
o.R.Containerrelates = nil
|
|
|
|
related, err := o.Containerrelates(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = o
|
|
}
|
|
|
|
o.R.Containerrelates = related
|
|
return nil
|
|
}
|
|
|
|
// LoadContainerrelates loads the organization's Containerrelates into the .R struct
|
|
func (os OrganizationSlice) LoadContainerrelates(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if len(os) == 0 {
|
|
return nil
|
|
}
|
|
|
|
fieldseekerContainerrelates, err := os.Containerrelates(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
o.R.Containerrelates = nil
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
for _, rel := range fieldseekerContainerrelates {
|
|
|
|
if !(o.ID == rel.OrganizationID) {
|
|
continue
|
|
}
|
|
|
|
rel.R.Organization = o
|
|
|
|
o.R.Containerrelates = append(o.R.Containerrelates, rel)
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// LoadFieldscoutinglogs loads the organization's Fieldscoutinglogs into the .R struct
|
|
func (o *Organization) LoadFieldscoutinglogs(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if o == nil {
|
|
return nil
|
|
}
|
|
|
|
// Reset the relationship
|
|
o.R.Fieldscoutinglogs = nil
|
|
|
|
related, err := o.Fieldscoutinglogs(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = o
|
|
}
|
|
|
|
o.R.Fieldscoutinglogs = related
|
|
return nil
|
|
}
|
|
|
|
// LoadFieldscoutinglogs loads the organization's Fieldscoutinglogs into the .R struct
|
|
func (os OrganizationSlice) LoadFieldscoutinglogs(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if len(os) == 0 {
|
|
return nil
|
|
}
|
|
|
|
fieldseekerFieldscoutinglogs, err := os.Fieldscoutinglogs(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
o.R.Fieldscoutinglogs = nil
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
for _, rel := range fieldseekerFieldscoutinglogs {
|
|
|
|
if !(o.ID == rel.OrganizationID) {
|
|
continue
|
|
}
|
|
|
|
rel.R.Organization = o
|
|
|
|
o.R.Fieldscoutinglogs = append(o.R.Fieldscoutinglogs, rel)
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// LoadHabitatrelates loads the organization's Habitatrelates into the .R struct
|
|
func (o *Organization) LoadHabitatrelates(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if o == nil {
|
|
return nil
|
|
}
|
|
|
|
// Reset the relationship
|
|
o.R.Habitatrelates = nil
|
|
|
|
related, err := o.Habitatrelates(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = o
|
|
}
|
|
|
|
o.R.Habitatrelates = related
|
|
return nil
|
|
}
|
|
|
|
// LoadHabitatrelates loads the organization's Habitatrelates into the .R struct
|
|
func (os OrganizationSlice) LoadHabitatrelates(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if len(os) == 0 {
|
|
return nil
|
|
}
|
|
|
|
fieldseekerHabitatrelates, err := os.Habitatrelates(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
o.R.Habitatrelates = nil
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
for _, rel := range fieldseekerHabitatrelates {
|
|
|
|
if !(o.ID == rel.OrganizationID) {
|
|
continue
|
|
}
|
|
|
|
rel.R.Organization = o
|
|
|
|
o.R.Habitatrelates = append(o.R.Habitatrelates, rel)
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// LoadInspectionsamples loads the organization's Inspectionsamples into the .R struct
|
|
func (o *Organization) LoadInspectionsamples(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if o == nil {
|
|
return nil
|
|
}
|
|
|
|
// Reset the relationship
|
|
o.R.Inspectionsamples = nil
|
|
|
|
related, err := o.Inspectionsamples(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = o
|
|
}
|
|
|
|
o.R.Inspectionsamples = related
|
|
return nil
|
|
}
|
|
|
|
// LoadInspectionsamples loads the organization's Inspectionsamples into the .R struct
|
|
func (os OrganizationSlice) LoadInspectionsamples(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if len(os) == 0 {
|
|
return nil
|
|
}
|
|
|
|
fieldseekerInspectionsamples, err := os.Inspectionsamples(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
o.R.Inspectionsamples = nil
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
for _, rel := range fieldseekerInspectionsamples {
|
|
|
|
if !(o.ID == rel.OrganizationID) {
|
|
continue
|
|
}
|
|
|
|
rel.R.Organization = o
|
|
|
|
o.R.Inspectionsamples = append(o.R.Inspectionsamples, rel)
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// LoadInspectionsampledetails loads the organization's Inspectionsampledetails into the .R struct
|
|
func (o *Organization) LoadInspectionsampledetails(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if o == nil {
|
|
return nil
|
|
}
|
|
|
|
// Reset the relationship
|
|
o.R.Inspectionsampledetails = nil
|
|
|
|
related, err := o.Inspectionsampledetails(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = o
|
|
}
|
|
|
|
o.R.Inspectionsampledetails = related
|
|
return nil
|
|
}
|
|
|
|
// LoadInspectionsampledetails loads the organization's Inspectionsampledetails into the .R struct
|
|
func (os OrganizationSlice) LoadInspectionsampledetails(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if len(os) == 0 {
|
|
return nil
|
|
}
|
|
|
|
fieldseekerInspectionsampledetails, err := os.Inspectionsampledetails(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
o.R.Inspectionsampledetails = nil
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
for _, rel := range fieldseekerInspectionsampledetails {
|
|
|
|
if !(o.ID == rel.OrganizationID) {
|
|
continue
|
|
}
|
|
|
|
rel.R.Organization = o
|
|
|
|
o.R.Inspectionsampledetails = append(o.R.Inspectionsampledetails, rel)
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// LoadLinelocations loads the organization's Linelocations into the .R struct
|
|
func (o *Organization) LoadLinelocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if o == nil {
|
|
return nil
|
|
}
|
|
|
|
// Reset the relationship
|
|
o.R.Linelocations = nil
|
|
|
|
related, err := o.Linelocations(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = o
|
|
}
|
|
|
|
o.R.Linelocations = related
|
|
return nil
|
|
}
|
|
|
|
// LoadLinelocations loads the organization's Linelocations into the .R struct
|
|
func (os OrganizationSlice) LoadLinelocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if len(os) == 0 {
|
|
return nil
|
|
}
|
|
|
|
fieldseekerLinelocations, err := os.Linelocations(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
o.R.Linelocations = nil
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
for _, rel := range fieldseekerLinelocations {
|
|
|
|
if !(o.ID == rel.OrganizationID) {
|
|
continue
|
|
}
|
|
|
|
rel.R.Organization = o
|
|
|
|
o.R.Linelocations = append(o.R.Linelocations, rel)
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// LoadLocationtrackings loads the organization's Locationtrackings into the .R struct
|
|
func (o *Organization) LoadLocationtrackings(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if o == nil {
|
|
return nil
|
|
}
|
|
|
|
// Reset the relationship
|
|
o.R.Locationtrackings = nil
|
|
|
|
related, err := o.Locationtrackings(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = o
|
|
}
|
|
|
|
o.R.Locationtrackings = related
|
|
return nil
|
|
}
|
|
|
|
// LoadLocationtrackings loads the organization's Locationtrackings into the .R struct
|
|
func (os OrganizationSlice) LoadLocationtrackings(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if len(os) == 0 {
|
|
return nil
|
|
}
|
|
|
|
fieldseekerLocationtrackings, err := os.Locationtrackings(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
o.R.Locationtrackings = nil
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
for _, rel := range fieldseekerLocationtrackings {
|
|
|
|
if !(o.ID == rel.OrganizationID) {
|
|
continue
|
|
}
|
|
|
|
rel.R.Organization = o
|
|
|
|
o.R.Locationtrackings = append(o.R.Locationtrackings, rel)
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// LoadMosquitoinspections loads the organization's Mosquitoinspections into the .R struct
|
|
func (o *Organization) LoadMosquitoinspections(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if o == nil {
|
|
return nil
|
|
}
|
|
|
|
// Reset the relationship
|
|
o.R.Mosquitoinspections = nil
|
|
|
|
related, err := o.Mosquitoinspections(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = o
|
|
}
|
|
|
|
o.R.Mosquitoinspections = related
|
|
return nil
|
|
}
|
|
|
|
// LoadMosquitoinspections loads the organization's Mosquitoinspections into the .R struct
|
|
func (os OrganizationSlice) LoadMosquitoinspections(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if len(os) == 0 {
|
|
return nil
|
|
}
|
|
|
|
fieldseekerMosquitoinspections, err := os.Mosquitoinspections(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
o.R.Mosquitoinspections = nil
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
for _, rel := range fieldseekerMosquitoinspections {
|
|
|
|
if !(o.ID == rel.OrganizationID) {
|
|
continue
|
|
}
|
|
|
|
rel.R.Organization = o
|
|
|
|
o.R.Mosquitoinspections = append(o.R.Mosquitoinspections, rel)
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// LoadPointlocations loads the organization's Pointlocations into the .R struct
|
|
func (o *Organization) LoadPointlocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if o == nil {
|
|
return nil
|
|
}
|
|
|
|
// Reset the relationship
|
|
o.R.Pointlocations = nil
|
|
|
|
related, err := o.Pointlocations(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = o
|
|
}
|
|
|
|
o.R.Pointlocations = related
|
|
return nil
|
|
}
|
|
|
|
// LoadPointlocations loads the organization's Pointlocations into the .R struct
|
|
func (os OrganizationSlice) LoadPointlocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if len(os) == 0 {
|
|
return nil
|
|
}
|
|
|
|
fieldseekerPointlocations, err := os.Pointlocations(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
o.R.Pointlocations = nil
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
for _, rel := range fieldseekerPointlocations {
|
|
|
|
if !(o.ID == rel.OrganizationID) {
|
|
continue
|
|
}
|
|
|
|
rel.R.Organization = o
|
|
|
|
o.R.Pointlocations = append(o.R.Pointlocations, rel)
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// LoadPolygonlocations loads the organization's Polygonlocations into the .R struct
|
|
func (o *Organization) LoadPolygonlocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if o == nil {
|
|
return nil
|
|
}
|
|
|
|
// Reset the relationship
|
|
o.R.Polygonlocations = nil
|
|
|
|
related, err := o.Polygonlocations(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = o
|
|
}
|
|
|
|
o.R.Polygonlocations = related
|
|
return nil
|
|
}
|
|
|
|
// LoadPolygonlocations loads the organization's Polygonlocations into the .R struct
|
|
func (os OrganizationSlice) LoadPolygonlocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if len(os) == 0 {
|
|
return nil
|
|
}
|
|
|
|
fieldseekerPolygonlocations, err := os.Polygonlocations(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
o.R.Polygonlocations = nil
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
for _, rel := range fieldseekerPolygonlocations {
|
|
|
|
if !(o.ID == rel.OrganizationID) {
|
|
continue
|
|
}
|
|
|
|
rel.R.Organization = o
|
|
|
|
o.R.Polygonlocations = append(o.R.Polygonlocations, rel)
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// LoadPools loads the organization's Pools into the .R struct
|
|
func (o *Organization) LoadPools(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if o == nil {
|
|
return nil
|
|
}
|
|
|
|
// Reset the relationship
|
|
o.R.Pools = nil
|
|
|
|
related, err := o.Pools(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = o
|
|
}
|
|
|
|
o.R.Pools = related
|
|
return nil
|
|
}
|
|
|
|
// LoadPools loads the organization's Pools into the .R struct
|
|
func (os OrganizationSlice) LoadPools(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if len(os) == 0 {
|
|
return nil
|
|
}
|
|
|
|
fieldseekerPools, err := os.Pools(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
o.R.Pools = nil
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
for _, rel := range fieldseekerPools {
|
|
|
|
if !(o.ID == rel.OrganizationID) {
|
|
continue
|
|
}
|
|
|
|
rel.R.Organization = o
|
|
|
|
o.R.Pools = append(o.R.Pools, rel)
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// LoadPooldetails loads the organization's Pooldetails into the .R struct
|
|
func (o *Organization) LoadPooldetails(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if o == nil {
|
|
return nil
|
|
}
|
|
|
|
// Reset the relationship
|
|
o.R.Pooldetails = nil
|
|
|
|
related, err := o.Pooldetails(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = o
|
|
}
|
|
|
|
o.R.Pooldetails = related
|
|
return nil
|
|
}
|
|
|
|
// LoadPooldetails loads the organization's Pooldetails into the .R struct
|
|
func (os OrganizationSlice) LoadPooldetails(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if len(os) == 0 {
|
|
return nil
|
|
}
|
|
|
|
fieldseekerPooldetails, err := os.Pooldetails(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
o.R.Pooldetails = nil
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
for _, rel := range fieldseekerPooldetails {
|
|
|
|
if !(o.ID == rel.OrganizationID) {
|
|
continue
|
|
}
|
|
|
|
rel.R.Organization = o
|
|
|
|
o.R.Pooldetails = append(o.R.Pooldetails, rel)
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// LoadProposedtreatmentareas loads the organization's Proposedtreatmentareas into the .R struct
|
|
func (o *Organization) LoadProposedtreatmentareas(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if o == nil {
|
|
return nil
|
|
}
|
|
|
|
// Reset the relationship
|
|
o.R.Proposedtreatmentareas = nil
|
|
|
|
related, err := o.Proposedtreatmentareas(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = o
|
|
}
|
|
|
|
o.R.Proposedtreatmentareas = related
|
|
return nil
|
|
}
|
|
|
|
// LoadProposedtreatmentareas loads the organization's Proposedtreatmentareas into the .R struct
|
|
func (os OrganizationSlice) LoadProposedtreatmentareas(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if len(os) == 0 {
|
|
return nil
|
|
}
|
|
|
|
fieldseekerProposedtreatmentareas, err := os.Proposedtreatmentareas(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
o.R.Proposedtreatmentareas = nil
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
for _, rel := range fieldseekerProposedtreatmentareas {
|
|
|
|
if !(o.ID == rel.OrganizationID) {
|
|
continue
|
|
}
|
|
|
|
rel.R.Organization = o
|
|
|
|
o.R.Proposedtreatmentareas = append(o.R.Proposedtreatmentareas, rel)
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// LoadQamosquitoinspections loads the organization's Qamosquitoinspections into the .R struct
|
|
func (o *Organization) LoadQamosquitoinspections(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if o == nil {
|
|
return nil
|
|
}
|
|
|
|
// Reset the relationship
|
|
o.R.Qamosquitoinspections = nil
|
|
|
|
related, err := o.Qamosquitoinspections(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = o
|
|
}
|
|
|
|
o.R.Qamosquitoinspections = related
|
|
return nil
|
|
}
|
|
|
|
// LoadQamosquitoinspections loads the organization's Qamosquitoinspections into the .R struct
|
|
func (os OrganizationSlice) LoadQamosquitoinspections(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if len(os) == 0 {
|
|
return nil
|
|
}
|
|
|
|
fieldseekerQamosquitoinspections, err := os.Qamosquitoinspections(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
o.R.Qamosquitoinspections = nil
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
for _, rel := range fieldseekerQamosquitoinspections {
|
|
|
|
if !(o.ID == rel.OrganizationID) {
|
|
continue
|
|
}
|
|
|
|
rel.R.Organization = o
|
|
|
|
o.R.Qamosquitoinspections = append(o.R.Qamosquitoinspections, rel)
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// LoadRodentlocations loads the organization's Rodentlocations into the .R struct
|
|
func (o *Organization) LoadRodentlocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if o == nil {
|
|
return nil
|
|
}
|
|
|
|
// Reset the relationship
|
|
o.R.Rodentlocations = nil
|
|
|
|
related, err := o.Rodentlocations(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = o
|
|
}
|
|
|
|
o.R.Rodentlocations = related
|
|
return nil
|
|
}
|
|
|
|
// LoadRodentlocations loads the organization's Rodentlocations into the .R struct
|
|
func (os OrganizationSlice) LoadRodentlocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if len(os) == 0 {
|
|
return nil
|
|
}
|
|
|
|
fieldseekerRodentlocations, err := os.Rodentlocations(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
o.R.Rodentlocations = nil
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
for _, rel := range fieldseekerRodentlocations {
|
|
|
|
if !(o.ID == rel.OrganizationID) {
|
|
continue
|
|
}
|
|
|
|
rel.R.Organization = o
|
|
|
|
o.R.Rodentlocations = append(o.R.Rodentlocations, rel)
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// LoadSamplecollections loads the organization's Samplecollections into the .R struct
|
|
func (o *Organization) LoadSamplecollections(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if o == nil {
|
|
return nil
|
|
}
|
|
|
|
// Reset the relationship
|
|
o.R.Samplecollections = nil
|
|
|
|
related, err := o.Samplecollections(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = o
|
|
}
|
|
|
|
o.R.Samplecollections = related
|
|
return nil
|
|
}
|
|
|
|
// LoadSamplecollections loads the organization's Samplecollections into the .R struct
|
|
func (os OrganizationSlice) LoadSamplecollections(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if len(os) == 0 {
|
|
return nil
|
|
}
|
|
|
|
fieldseekerSamplecollections, err := os.Samplecollections(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
o.R.Samplecollections = nil
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
for _, rel := range fieldseekerSamplecollections {
|
|
|
|
if !(o.ID == rel.OrganizationID) {
|
|
continue
|
|
}
|
|
|
|
rel.R.Organization = o
|
|
|
|
o.R.Samplecollections = append(o.R.Samplecollections, rel)
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// LoadSamplelocations loads the organization's Samplelocations into the .R struct
|
|
func (o *Organization) LoadSamplelocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if o == nil {
|
|
return nil
|
|
}
|
|
|
|
// Reset the relationship
|
|
o.R.Samplelocations = nil
|
|
|
|
related, err := o.Samplelocations(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = o
|
|
}
|
|
|
|
o.R.Samplelocations = related
|
|
return nil
|
|
}
|
|
|
|
// LoadSamplelocations loads the organization's Samplelocations into the .R struct
|
|
func (os OrganizationSlice) LoadSamplelocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if len(os) == 0 {
|
|
return nil
|
|
}
|
|
|
|
fieldseekerSamplelocations, err := os.Samplelocations(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
o.R.Samplelocations = nil
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
for _, rel := range fieldseekerSamplelocations {
|
|
|
|
if !(o.ID == rel.OrganizationID) {
|
|
continue
|
|
}
|
|
|
|
rel.R.Organization = o
|
|
|
|
o.R.Samplelocations = append(o.R.Samplelocations, rel)
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// LoadServicerequests loads the organization's Servicerequests into the .R struct
|
|
func (o *Organization) LoadServicerequests(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if o == nil {
|
|
return nil
|
|
}
|
|
|
|
// Reset the relationship
|
|
o.R.Servicerequests = nil
|
|
|
|
related, err := o.Servicerequests(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = o
|
|
}
|
|
|
|
o.R.Servicerequests = related
|
|
return nil
|
|
}
|
|
|
|
// LoadServicerequests loads the organization's Servicerequests into the .R struct
|
|
func (os OrganizationSlice) LoadServicerequests(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if len(os) == 0 {
|
|
return nil
|
|
}
|
|
|
|
fieldseekerServicerequests, err := os.Servicerequests(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
o.R.Servicerequests = nil
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
for _, rel := range fieldseekerServicerequests {
|
|
|
|
if !(o.ID == rel.OrganizationID) {
|
|
continue
|
|
}
|
|
|
|
rel.R.Organization = o
|
|
|
|
o.R.Servicerequests = append(o.R.Servicerequests, rel)
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// LoadSpeciesabundances loads the organization's Speciesabundances into the .R struct
|
|
func (o *Organization) LoadSpeciesabundances(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if o == nil {
|
|
return nil
|
|
}
|
|
|
|
// Reset the relationship
|
|
o.R.Speciesabundances = nil
|
|
|
|
related, err := o.Speciesabundances(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = o
|
|
}
|
|
|
|
o.R.Speciesabundances = related
|
|
return nil
|
|
}
|
|
|
|
// LoadSpeciesabundances loads the organization's Speciesabundances into the .R struct
|
|
func (os OrganizationSlice) LoadSpeciesabundances(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if len(os) == 0 {
|
|
return nil
|
|
}
|
|
|
|
fieldseekerSpeciesabundances, err := os.Speciesabundances(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
o.R.Speciesabundances = nil
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
for _, rel := range fieldseekerSpeciesabundances {
|
|
|
|
if !(o.ID == rel.OrganizationID) {
|
|
continue
|
|
}
|
|
|
|
rel.R.Organization = o
|
|
|
|
o.R.Speciesabundances = append(o.R.Speciesabundances, rel)
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// LoadStormdrains loads the organization's Stormdrains into the .R struct
|
|
func (o *Organization) LoadStormdrains(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if o == nil {
|
|
return nil
|
|
}
|
|
|
|
// Reset the relationship
|
|
o.R.Stormdrains = nil
|
|
|
|
related, err := o.Stormdrains(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = o
|
|
}
|
|
|
|
o.R.Stormdrains = related
|
|
return nil
|
|
}
|
|
|
|
// LoadStormdrains loads the organization's Stormdrains into the .R struct
|
|
func (os OrganizationSlice) LoadStormdrains(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if len(os) == 0 {
|
|
return nil
|
|
}
|
|
|
|
fieldseekerStormdrains, err := os.Stormdrains(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
o.R.Stormdrains = nil
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
for _, rel := range fieldseekerStormdrains {
|
|
|
|
if !(o.ID == rel.OrganizationID) {
|
|
continue
|
|
}
|
|
|
|
rel.R.Organization = o
|
|
|
|
o.R.Stormdrains = append(o.R.Stormdrains, rel)
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// LoadTimecards loads the organization's Timecards into the .R struct
|
|
func (o *Organization) LoadTimecards(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if o == nil {
|
|
return nil
|
|
}
|
|
|
|
// Reset the relationship
|
|
o.R.Timecards = nil
|
|
|
|
related, err := o.Timecards(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = o
|
|
}
|
|
|
|
o.R.Timecards = related
|
|
return nil
|
|
}
|
|
|
|
// LoadTimecards loads the organization's Timecards into the .R struct
|
|
func (os OrganizationSlice) LoadTimecards(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if len(os) == 0 {
|
|
return nil
|
|
}
|
|
|
|
fieldseekerTimecards, err := os.Timecards(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
o.R.Timecards = nil
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
for _, rel := range fieldseekerTimecards {
|
|
|
|
if !(o.ID == rel.OrganizationID) {
|
|
continue
|
|
}
|
|
|
|
rel.R.Organization = o
|
|
|
|
o.R.Timecards = append(o.R.Timecards, rel)
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// LoadTrapdata loads the organization's Trapdata into the .R struct
|
|
func (o *Organization) LoadTrapdata(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if o == nil {
|
|
return nil
|
|
}
|
|
|
|
// Reset the relationship
|
|
o.R.Trapdata = nil
|
|
|
|
related, err := o.Trapdata(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = o
|
|
}
|
|
|
|
o.R.Trapdata = related
|
|
return nil
|
|
}
|
|
|
|
// LoadTrapdata loads the organization's Trapdata into the .R struct
|
|
func (os OrganizationSlice) LoadTrapdata(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if len(os) == 0 {
|
|
return nil
|
|
}
|
|
|
|
fieldseekerTrapdata, err := os.Trapdata(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
o.R.Trapdata = nil
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
for _, rel := range fieldseekerTrapdata {
|
|
|
|
if !(o.ID == rel.OrganizationID) {
|
|
continue
|
|
}
|
|
|
|
rel.R.Organization = o
|
|
|
|
o.R.Trapdata = append(o.R.Trapdata, rel)
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// LoadTraplocations loads the organization's Traplocations into the .R struct
|
|
func (o *Organization) LoadTraplocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if o == nil {
|
|
return nil
|
|
}
|
|
|
|
// Reset the relationship
|
|
o.R.Traplocations = nil
|
|
|
|
related, err := o.Traplocations(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = o
|
|
}
|
|
|
|
o.R.Traplocations = related
|
|
return nil
|
|
}
|
|
|
|
// LoadTraplocations loads the organization's Traplocations into the .R struct
|
|
func (os OrganizationSlice) LoadTraplocations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if len(os) == 0 {
|
|
return nil
|
|
}
|
|
|
|
fieldseekerTraplocations, err := os.Traplocations(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
o.R.Traplocations = nil
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
for _, rel := range fieldseekerTraplocations {
|
|
|
|
if !(o.ID == rel.OrganizationID) {
|
|
continue
|
|
}
|
|
|
|
rel.R.Organization = o
|
|
|
|
o.R.Traplocations = append(o.R.Traplocations, rel)
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// LoadTreatments loads the organization's Treatments into the .R struct
|
|
func (o *Organization) LoadTreatments(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if o == nil {
|
|
return nil
|
|
}
|
|
|
|
// Reset the relationship
|
|
o.R.Treatments = nil
|
|
|
|
related, err := o.Treatments(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = o
|
|
}
|
|
|
|
o.R.Treatments = related
|
|
return nil
|
|
}
|
|
|
|
// LoadTreatments loads the organization's Treatments into the .R struct
|
|
func (os OrganizationSlice) LoadTreatments(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if len(os) == 0 {
|
|
return nil
|
|
}
|
|
|
|
fieldseekerTreatments, err := os.Treatments(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
o.R.Treatments = nil
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
for _, rel := range fieldseekerTreatments {
|
|
|
|
if !(o.ID == rel.OrganizationID) {
|
|
continue
|
|
}
|
|
|
|
rel.R.Organization = o
|
|
|
|
o.R.Treatments = append(o.R.Treatments, rel)
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// LoadTreatmentareas loads the organization's Treatmentareas into the .R struct
|
|
func (o *Organization) LoadTreatmentareas(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if o == nil {
|
|
return nil
|
|
}
|
|
|
|
// Reset the relationship
|
|
o.R.Treatmentareas = nil
|
|
|
|
related, err := o.Treatmentareas(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = o
|
|
}
|
|
|
|
o.R.Treatmentareas = related
|
|
return nil
|
|
}
|
|
|
|
// LoadTreatmentareas loads the organization's Treatmentareas into the .R struct
|
|
func (os OrganizationSlice) LoadTreatmentareas(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if len(os) == 0 {
|
|
return nil
|
|
}
|
|
|
|
fieldseekerTreatmentareas, err := os.Treatmentareas(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
o.R.Treatmentareas = nil
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
for _, rel := range fieldseekerTreatmentareas {
|
|
|
|
if !(o.ID == rel.OrganizationID) {
|
|
continue
|
|
}
|
|
|
|
rel.R.Organization = o
|
|
|
|
o.R.Treatmentareas = append(o.R.Treatmentareas, rel)
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// LoadZones loads the organization's Zones into the .R struct
|
|
func (o *Organization) LoadZones(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if o == nil {
|
|
return nil
|
|
}
|
|
|
|
// Reset the relationship
|
|
o.R.Zones = nil
|
|
|
|
related, err := o.Zones(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = o
|
|
}
|
|
|
|
o.R.Zones = related
|
|
return nil
|
|
}
|
|
|
|
// LoadZones loads the organization's Zones into the .R struct
|
|
func (os OrganizationSlice) LoadZones(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if len(os) == 0 {
|
|
return nil
|
|
}
|
|
|
|
fieldseekerZones, err := os.Zones(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
o.R.Zones = nil
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
for _, rel := range fieldseekerZones {
|
|
|
|
if !(o.ID == rel.OrganizationID) {
|
|
continue
|
|
}
|
|
|
|
rel.R.Organization = o
|
|
|
|
o.R.Zones = append(o.R.Zones, rel)
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// LoadZones2s loads the organization's Zones2s into the .R struct
|
|
func (o *Organization) LoadZones2s(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if o == nil {
|
|
return nil
|
|
}
|
|
|
|
// Reset the relationship
|
|
o.R.Zones2s = nil
|
|
|
|
related, err := o.Zones2s(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = o
|
|
}
|
|
|
|
o.R.Zones2s = related
|
|
return nil
|
|
}
|
|
|
|
// LoadZones2s loads the organization's Zones2s into the .R struct
|
|
func (os OrganizationSlice) LoadZones2s(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if len(os) == 0 {
|
|
return nil
|
|
}
|
|
|
|
fieldseekerZones2s, err := os.Zones2s(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
o.R.Zones2s = nil
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
for _, rel := range fieldseekerZones2s {
|
|
|
|
if !(o.ID == rel.OrganizationID) {
|
|
continue
|
|
}
|
|
|
|
rel.R.Organization = o
|
|
|
|
o.R.Zones2s = append(o.R.Zones2s, rel)
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// LoadFieldseekerSyncs loads the organization's FieldseekerSyncs into the .R struct
|
|
func (o *Organization) LoadFieldseekerSyncs(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if o == nil {
|
|
return nil
|
|
}
|
|
|
|
// Reset the relationship
|
|
o.R.FieldseekerSyncs = nil
|
|
|
|
related, err := o.FieldseekerSyncs(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = o
|
|
}
|
|
|
|
o.R.FieldseekerSyncs = related
|
|
return nil
|
|
}
|
|
|
|
// LoadFieldseekerSyncs loads the organization's FieldseekerSyncs into the .R struct
|
|
func (os OrganizationSlice) LoadFieldseekerSyncs(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if len(os) == 0 {
|
|
return nil
|
|
}
|
|
|
|
fieldseekerSyncs, err := os.FieldseekerSyncs(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
o.R.FieldseekerSyncs = nil
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
for _, rel := range fieldseekerSyncs {
|
|
|
|
if !(o.ID == rel.OrganizationID) {
|
|
continue
|
|
}
|
|
|
|
rel.R.Organization = o
|
|
|
|
o.R.FieldseekerSyncs = append(o.R.FieldseekerSyncs, rel)
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// LoadH3Aggregations loads the organization's H3Aggregations into the .R struct
|
|
func (o *Organization) LoadH3Aggregations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if o == nil {
|
|
return nil
|
|
}
|
|
|
|
// Reset the relationship
|
|
o.R.H3Aggregations = nil
|
|
|
|
related, err := o.H3Aggregations(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = o
|
|
}
|
|
|
|
o.R.H3Aggregations = related
|
|
return nil
|
|
}
|
|
|
|
// LoadH3Aggregations loads the organization's H3Aggregations into the .R struct
|
|
func (os OrganizationSlice) LoadH3Aggregations(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if len(os) == 0 {
|
|
return nil
|
|
}
|
|
|
|
h3Aggregations, err := os.H3Aggregations(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
o.R.H3Aggregations = nil
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
for _, rel := range h3Aggregations {
|
|
|
|
if !(o.ID == rel.OrganizationID) {
|
|
continue
|
|
}
|
|
|
|
rel.R.Organization = o
|
|
|
|
o.R.H3Aggregations = append(o.R.H3Aggregations, rel)
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// LoadNoteAudios loads the organization's NoteAudios into the .R struct
|
|
func (o *Organization) LoadNoteAudios(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if o == nil {
|
|
return nil
|
|
}
|
|
|
|
// Reset the relationship
|
|
o.R.NoteAudios = nil
|
|
|
|
related, err := o.NoteAudios(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = o
|
|
}
|
|
|
|
o.R.NoteAudios = related
|
|
return nil
|
|
}
|
|
|
|
// LoadNoteAudios loads the organization's NoteAudios into the .R struct
|
|
func (os OrganizationSlice) LoadNoteAudios(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if len(os) == 0 {
|
|
return nil
|
|
}
|
|
|
|
noteAudios, err := os.NoteAudios(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
o.R.NoteAudios = nil
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
for _, rel := range noteAudios {
|
|
|
|
if !(o.ID == rel.OrganizationID) {
|
|
continue
|
|
}
|
|
|
|
rel.R.Organization = o
|
|
|
|
o.R.NoteAudios = append(o.R.NoteAudios, rel)
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// LoadNoteImages loads the organization's NoteImages into the .R struct
|
|
func (o *Organization) LoadNoteImages(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if o == nil {
|
|
return nil
|
|
}
|
|
|
|
// Reset the relationship
|
|
o.R.NoteImages = nil
|
|
|
|
related, err := o.NoteImages(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = o
|
|
}
|
|
|
|
o.R.NoteImages = related
|
|
return nil
|
|
}
|
|
|
|
// LoadNoteImages loads the organization's NoteImages into the .R struct
|
|
func (os OrganizationSlice) LoadNoteImages(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if len(os) == 0 {
|
|
return nil
|
|
}
|
|
|
|
noteImages, err := os.NoteImages(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
o.R.NoteImages = nil
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
for _, rel := range noteImages {
|
|
|
|
if !(o.ID == rel.OrganizationID) {
|
|
continue
|
|
}
|
|
|
|
rel.R.Organization = o
|
|
|
|
o.R.NoteImages = append(o.R.NoteImages, rel)
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// LoadUser loads the organization's User into the .R struct
|
|
func (o *Organization) LoadUser(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if o == nil {
|
|
return nil
|
|
}
|
|
|
|
// Reset the relationship
|
|
o.R.User = nil
|
|
|
|
related, err := o.User(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, rel := range related {
|
|
rel.R.Organization = o
|
|
}
|
|
|
|
o.R.User = related
|
|
return nil
|
|
}
|
|
|
|
// LoadUser loads the organization's User into the .R struct
|
|
func (os OrganizationSlice) LoadUser(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
|
if len(os) == 0 {
|
|
return nil
|
|
}
|
|
|
|
users, err := os.User(mods...).All(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
o.R.User = nil
|
|
}
|
|
|
|
for _, o := range os {
|
|
if o == nil {
|
|
continue
|
|
}
|
|
|
|
for _, rel := range users {
|
|
|
|
if !rel.OrganizationID.IsValue() {
|
|
continue
|
|
}
|
|
if !(rel.OrganizationID.IsValue() && o.ID == rel.OrganizationID.MustGet()) {
|
|
continue
|
|
}
|
|
|
|
rel.R.Organization = o
|
|
|
|
o.R.User = append(o.R.User, rel)
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
type organizationJoins[Q dialect.Joinable] struct {
|
|
typ string
|
|
Containerrelates modAs[Q, fieldseekerContainerrelateColumns]
|
|
Fieldscoutinglogs modAs[Q, fieldseekerFieldscoutinglogColumns]
|
|
Habitatrelates modAs[Q, fieldseekerHabitatrelateColumns]
|
|
Inspectionsamples modAs[Q, fieldseekerInspectionsampleColumns]
|
|
Inspectionsampledetails modAs[Q, fieldseekerInspectionsampledetailColumns]
|
|
Linelocations modAs[Q, fieldseekerLinelocationColumns]
|
|
Locationtrackings modAs[Q, fieldseekerLocationtrackingColumns]
|
|
Mosquitoinspections modAs[Q, fieldseekerMosquitoinspectionColumns]
|
|
Pointlocations modAs[Q, fieldseekerPointlocationColumns]
|
|
Polygonlocations modAs[Q, fieldseekerPolygonlocationColumns]
|
|
Pools modAs[Q, fieldseekerPoolColumns]
|
|
Pooldetails modAs[Q, fieldseekerPooldetailColumns]
|
|
Proposedtreatmentareas modAs[Q, fieldseekerProposedtreatmentareaColumns]
|
|
Qamosquitoinspections modAs[Q, fieldseekerQamosquitoinspectionColumns]
|
|
Rodentlocations modAs[Q, fieldseekerRodentlocationColumns]
|
|
Samplecollections modAs[Q, fieldseekerSamplecollectionColumns]
|
|
Samplelocations modAs[Q, fieldseekerSamplelocationColumns]
|
|
Servicerequests modAs[Q, fieldseekerServicerequestColumns]
|
|
Speciesabundances modAs[Q, fieldseekerSpeciesabundanceColumns]
|
|
Stormdrains modAs[Q, fieldseekerStormdrainColumns]
|
|
Timecards modAs[Q, fieldseekerTimecardColumns]
|
|
Trapdata modAs[Q, fieldseekerTrapdatumColumns]
|
|
Traplocations modAs[Q, fieldseekerTraplocationColumns]
|
|
Treatments modAs[Q, fieldseekerTreatmentColumns]
|
|
Treatmentareas modAs[Q, fieldseekerTreatmentareaColumns]
|
|
Zones modAs[Q, fieldseekerZoneColumns]
|
|
Zones2s modAs[Q, fieldseekerZones2Columns]
|
|
FieldseekerSyncs modAs[Q, fieldseekerSyncColumns]
|
|
H3Aggregations modAs[Q, h3AggregationColumns]
|
|
NoteAudios modAs[Q, noteAudioColumns]
|
|
NoteImages modAs[Q, noteImageColumns]
|
|
User modAs[Q, userColumns]
|
|
}
|
|
|
|
func (j organizationJoins[Q]) aliasedAs(alias string) organizationJoins[Q] {
|
|
return buildOrganizationJoins[Q](buildOrganizationColumns(alias), j.typ)
|
|
}
|
|
|
|
func buildOrganizationJoins[Q dialect.Joinable](cols organizationColumns, typ string) organizationJoins[Q] {
|
|
return organizationJoins[Q]{
|
|
typ: typ,
|
|
Containerrelates: modAs[Q, fieldseekerContainerrelateColumns]{
|
|
c: FieldseekerContainerrelates.Columns,
|
|
f: func(to fieldseekerContainerrelateColumns) bob.Mod[Q] {
|
|
mods := make(mods.QueryMods[Q], 0, 1)
|
|
|
|
{
|
|
mods = append(mods, dialect.Join[Q](typ, FieldseekerContainerrelates.Name().As(to.Alias())).On(
|
|
to.OrganizationID.EQ(cols.ID),
|
|
))
|
|
}
|
|
|
|
return mods
|
|
},
|
|
},
|
|
Fieldscoutinglogs: modAs[Q, fieldseekerFieldscoutinglogColumns]{
|
|
c: FieldseekerFieldscoutinglogs.Columns,
|
|
f: func(to fieldseekerFieldscoutinglogColumns) bob.Mod[Q] {
|
|
mods := make(mods.QueryMods[Q], 0, 1)
|
|
|
|
{
|
|
mods = append(mods, dialect.Join[Q](typ, FieldseekerFieldscoutinglogs.Name().As(to.Alias())).On(
|
|
to.OrganizationID.EQ(cols.ID),
|
|
))
|
|
}
|
|
|
|
return mods
|
|
},
|
|
},
|
|
Habitatrelates: modAs[Q, fieldseekerHabitatrelateColumns]{
|
|
c: FieldseekerHabitatrelates.Columns,
|
|
f: func(to fieldseekerHabitatrelateColumns) bob.Mod[Q] {
|
|
mods := make(mods.QueryMods[Q], 0, 1)
|
|
|
|
{
|
|
mods = append(mods, dialect.Join[Q](typ, FieldseekerHabitatrelates.Name().As(to.Alias())).On(
|
|
to.OrganizationID.EQ(cols.ID),
|
|
))
|
|
}
|
|
|
|
return mods
|
|
},
|
|
},
|
|
Inspectionsamples: modAs[Q, fieldseekerInspectionsampleColumns]{
|
|
c: FieldseekerInspectionsamples.Columns,
|
|
f: func(to fieldseekerInspectionsampleColumns) bob.Mod[Q] {
|
|
mods := make(mods.QueryMods[Q], 0, 1)
|
|
|
|
{
|
|
mods = append(mods, dialect.Join[Q](typ, FieldseekerInspectionsamples.Name().As(to.Alias())).On(
|
|
to.OrganizationID.EQ(cols.ID),
|
|
))
|
|
}
|
|
|
|
return mods
|
|
},
|
|
},
|
|
Inspectionsampledetails: modAs[Q, fieldseekerInspectionsampledetailColumns]{
|
|
c: FieldseekerInspectionsampledetails.Columns,
|
|
f: func(to fieldseekerInspectionsampledetailColumns) bob.Mod[Q] {
|
|
mods := make(mods.QueryMods[Q], 0, 1)
|
|
|
|
{
|
|
mods = append(mods, dialect.Join[Q](typ, FieldseekerInspectionsampledetails.Name().As(to.Alias())).On(
|
|
to.OrganizationID.EQ(cols.ID),
|
|
))
|
|
}
|
|
|
|
return mods
|
|
},
|
|
},
|
|
Linelocations: modAs[Q, fieldseekerLinelocationColumns]{
|
|
c: FieldseekerLinelocations.Columns,
|
|
f: func(to fieldseekerLinelocationColumns) bob.Mod[Q] {
|
|
mods := make(mods.QueryMods[Q], 0, 1)
|
|
|
|
{
|
|
mods = append(mods, dialect.Join[Q](typ, FieldseekerLinelocations.Name().As(to.Alias())).On(
|
|
to.OrganizationID.EQ(cols.ID),
|
|
))
|
|
}
|
|
|
|
return mods
|
|
},
|
|
},
|
|
Locationtrackings: modAs[Q, fieldseekerLocationtrackingColumns]{
|
|
c: FieldseekerLocationtrackings.Columns,
|
|
f: func(to fieldseekerLocationtrackingColumns) bob.Mod[Q] {
|
|
mods := make(mods.QueryMods[Q], 0, 1)
|
|
|
|
{
|
|
mods = append(mods, dialect.Join[Q](typ, FieldseekerLocationtrackings.Name().As(to.Alias())).On(
|
|
to.OrganizationID.EQ(cols.ID),
|
|
))
|
|
}
|
|
|
|
return mods
|
|
},
|
|
},
|
|
Mosquitoinspections: modAs[Q, fieldseekerMosquitoinspectionColumns]{
|
|
c: FieldseekerMosquitoinspections.Columns,
|
|
f: func(to fieldseekerMosquitoinspectionColumns) bob.Mod[Q] {
|
|
mods := make(mods.QueryMods[Q], 0, 1)
|
|
|
|
{
|
|
mods = append(mods, dialect.Join[Q](typ, FieldseekerMosquitoinspections.Name().As(to.Alias())).On(
|
|
to.OrganizationID.EQ(cols.ID),
|
|
))
|
|
}
|
|
|
|
return mods
|
|
},
|
|
},
|
|
Pointlocations: modAs[Q, fieldseekerPointlocationColumns]{
|
|
c: FieldseekerPointlocations.Columns,
|
|
f: func(to fieldseekerPointlocationColumns) bob.Mod[Q] {
|
|
mods := make(mods.QueryMods[Q], 0, 1)
|
|
|
|
{
|
|
mods = append(mods, dialect.Join[Q](typ, FieldseekerPointlocations.Name().As(to.Alias())).On(
|
|
to.OrganizationID.EQ(cols.ID),
|
|
))
|
|
}
|
|
|
|
return mods
|
|
},
|
|
},
|
|
Polygonlocations: modAs[Q, fieldseekerPolygonlocationColumns]{
|
|
c: FieldseekerPolygonlocations.Columns,
|
|
f: func(to fieldseekerPolygonlocationColumns) bob.Mod[Q] {
|
|
mods := make(mods.QueryMods[Q], 0, 1)
|
|
|
|
{
|
|
mods = append(mods, dialect.Join[Q](typ, FieldseekerPolygonlocations.Name().As(to.Alias())).On(
|
|
to.OrganizationID.EQ(cols.ID),
|
|
))
|
|
}
|
|
|
|
return mods
|
|
},
|
|
},
|
|
Pools: modAs[Q, fieldseekerPoolColumns]{
|
|
c: FieldseekerPools.Columns,
|
|
f: func(to fieldseekerPoolColumns) bob.Mod[Q] {
|
|
mods := make(mods.QueryMods[Q], 0, 1)
|
|
|
|
{
|
|
mods = append(mods, dialect.Join[Q](typ, FieldseekerPools.Name().As(to.Alias())).On(
|
|
to.OrganizationID.EQ(cols.ID),
|
|
))
|
|
}
|
|
|
|
return mods
|
|
},
|
|
},
|
|
Pooldetails: modAs[Q, fieldseekerPooldetailColumns]{
|
|
c: FieldseekerPooldetails.Columns,
|
|
f: func(to fieldseekerPooldetailColumns) bob.Mod[Q] {
|
|
mods := make(mods.QueryMods[Q], 0, 1)
|
|
|
|
{
|
|
mods = append(mods, dialect.Join[Q](typ, FieldseekerPooldetails.Name().As(to.Alias())).On(
|
|
to.OrganizationID.EQ(cols.ID),
|
|
))
|
|
}
|
|
|
|
return mods
|
|
},
|
|
},
|
|
Proposedtreatmentareas: modAs[Q, fieldseekerProposedtreatmentareaColumns]{
|
|
c: FieldseekerProposedtreatmentareas.Columns,
|
|
f: func(to fieldseekerProposedtreatmentareaColumns) bob.Mod[Q] {
|
|
mods := make(mods.QueryMods[Q], 0, 1)
|
|
|
|
{
|
|
mods = append(mods, dialect.Join[Q](typ, FieldseekerProposedtreatmentareas.Name().As(to.Alias())).On(
|
|
to.OrganizationID.EQ(cols.ID),
|
|
))
|
|
}
|
|
|
|
return mods
|
|
},
|
|
},
|
|
Qamosquitoinspections: modAs[Q, fieldseekerQamosquitoinspectionColumns]{
|
|
c: FieldseekerQamosquitoinspections.Columns,
|
|
f: func(to fieldseekerQamosquitoinspectionColumns) bob.Mod[Q] {
|
|
mods := make(mods.QueryMods[Q], 0, 1)
|
|
|
|
{
|
|
mods = append(mods, dialect.Join[Q](typ, FieldseekerQamosquitoinspections.Name().As(to.Alias())).On(
|
|
to.OrganizationID.EQ(cols.ID),
|
|
))
|
|
}
|
|
|
|
return mods
|
|
},
|
|
},
|
|
Rodentlocations: modAs[Q, fieldseekerRodentlocationColumns]{
|
|
c: FieldseekerRodentlocations.Columns,
|
|
f: func(to fieldseekerRodentlocationColumns) bob.Mod[Q] {
|
|
mods := make(mods.QueryMods[Q], 0, 1)
|
|
|
|
{
|
|
mods = append(mods, dialect.Join[Q](typ, FieldseekerRodentlocations.Name().As(to.Alias())).On(
|
|
to.OrganizationID.EQ(cols.ID),
|
|
))
|
|
}
|
|
|
|
return mods
|
|
},
|
|
},
|
|
Samplecollections: modAs[Q, fieldseekerSamplecollectionColumns]{
|
|
c: FieldseekerSamplecollections.Columns,
|
|
f: func(to fieldseekerSamplecollectionColumns) bob.Mod[Q] {
|
|
mods := make(mods.QueryMods[Q], 0, 1)
|
|
|
|
{
|
|
mods = append(mods, dialect.Join[Q](typ, FieldseekerSamplecollections.Name().As(to.Alias())).On(
|
|
to.OrganizationID.EQ(cols.ID),
|
|
))
|
|
}
|
|
|
|
return mods
|
|
},
|
|
},
|
|
Samplelocations: modAs[Q, fieldseekerSamplelocationColumns]{
|
|
c: FieldseekerSamplelocations.Columns,
|
|
f: func(to fieldseekerSamplelocationColumns) bob.Mod[Q] {
|
|
mods := make(mods.QueryMods[Q], 0, 1)
|
|
|
|
{
|
|
mods = append(mods, dialect.Join[Q](typ, FieldseekerSamplelocations.Name().As(to.Alias())).On(
|
|
to.OrganizationID.EQ(cols.ID),
|
|
))
|
|
}
|
|
|
|
return mods
|
|
},
|
|
},
|
|
Servicerequests: modAs[Q, fieldseekerServicerequestColumns]{
|
|
c: FieldseekerServicerequests.Columns,
|
|
f: func(to fieldseekerServicerequestColumns) bob.Mod[Q] {
|
|
mods := make(mods.QueryMods[Q], 0, 1)
|
|
|
|
{
|
|
mods = append(mods, dialect.Join[Q](typ, FieldseekerServicerequests.Name().As(to.Alias())).On(
|
|
to.OrganizationID.EQ(cols.ID),
|
|
))
|
|
}
|
|
|
|
return mods
|
|
},
|
|
},
|
|
Speciesabundances: modAs[Q, fieldseekerSpeciesabundanceColumns]{
|
|
c: FieldseekerSpeciesabundances.Columns,
|
|
f: func(to fieldseekerSpeciesabundanceColumns) bob.Mod[Q] {
|
|
mods := make(mods.QueryMods[Q], 0, 1)
|
|
|
|
{
|
|
mods = append(mods, dialect.Join[Q](typ, FieldseekerSpeciesabundances.Name().As(to.Alias())).On(
|
|
to.OrganizationID.EQ(cols.ID),
|
|
))
|
|
}
|
|
|
|
return mods
|
|
},
|
|
},
|
|
Stormdrains: modAs[Q, fieldseekerStormdrainColumns]{
|
|
c: FieldseekerStormdrains.Columns,
|
|
f: func(to fieldseekerStormdrainColumns) bob.Mod[Q] {
|
|
mods := make(mods.QueryMods[Q], 0, 1)
|
|
|
|
{
|
|
mods = append(mods, dialect.Join[Q](typ, FieldseekerStormdrains.Name().As(to.Alias())).On(
|
|
to.OrganizationID.EQ(cols.ID),
|
|
))
|
|
}
|
|
|
|
return mods
|
|
},
|
|
},
|
|
Timecards: modAs[Q, fieldseekerTimecardColumns]{
|
|
c: FieldseekerTimecards.Columns,
|
|
f: func(to fieldseekerTimecardColumns) bob.Mod[Q] {
|
|
mods := make(mods.QueryMods[Q], 0, 1)
|
|
|
|
{
|
|
mods = append(mods, dialect.Join[Q](typ, FieldseekerTimecards.Name().As(to.Alias())).On(
|
|
to.OrganizationID.EQ(cols.ID),
|
|
))
|
|
}
|
|
|
|
return mods
|
|
},
|
|
},
|
|
Trapdata: modAs[Q, fieldseekerTrapdatumColumns]{
|
|
c: FieldseekerTrapdata.Columns,
|
|
f: func(to fieldseekerTrapdatumColumns) bob.Mod[Q] {
|
|
mods := make(mods.QueryMods[Q], 0, 1)
|
|
|
|
{
|
|
mods = append(mods, dialect.Join[Q](typ, FieldseekerTrapdata.Name().As(to.Alias())).On(
|
|
to.OrganizationID.EQ(cols.ID),
|
|
))
|
|
}
|
|
|
|
return mods
|
|
},
|
|
},
|
|
Traplocations: modAs[Q, fieldseekerTraplocationColumns]{
|
|
c: FieldseekerTraplocations.Columns,
|
|
f: func(to fieldseekerTraplocationColumns) bob.Mod[Q] {
|
|
mods := make(mods.QueryMods[Q], 0, 1)
|
|
|
|
{
|
|
mods = append(mods, dialect.Join[Q](typ, FieldseekerTraplocations.Name().As(to.Alias())).On(
|
|
to.OrganizationID.EQ(cols.ID),
|
|
))
|
|
}
|
|
|
|
return mods
|
|
},
|
|
},
|
|
Treatments: modAs[Q, fieldseekerTreatmentColumns]{
|
|
c: FieldseekerTreatments.Columns,
|
|
f: func(to fieldseekerTreatmentColumns) bob.Mod[Q] {
|
|
mods := make(mods.QueryMods[Q], 0, 1)
|
|
|
|
{
|
|
mods = append(mods, dialect.Join[Q](typ, FieldseekerTreatments.Name().As(to.Alias())).On(
|
|
to.OrganizationID.EQ(cols.ID),
|
|
))
|
|
}
|
|
|
|
return mods
|
|
},
|
|
},
|
|
Treatmentareas: modAs[Q, fieldseekerTreatmentareaColumns]{
|
|
c: FieldseekerTreatmentareas.Columns,
|
|
f: func(to fieldseekerTreatmentareaColumns) bob.Mod[Q] {
|
|
mods := make(mods.QueryMods[Q], 0, 1)
|
|
|
|
{
|
|
mods = append(mods, dialect.Join[Q](typ, FieldseekerTreatmentareas.Name().As(to.Alias())).On(
|
|
to.OrganizationID.EQ(cols.ID),
|
|
))
|
|
}
|
|
|
|
return mods
|
|
},
|
|
},
|
|
Zones: modAs[Q, fieldseekerZoneColumns]{
|
|
c: FieldseekerZones.Columns,
|
|
f: func(to fieldseekerZoneColumns) bob.Mod[Q] {
|
|
mods := make(mods.QueryMods[Q], 0, 1)
|
|
|
|
{
|
|
mods = append(mods, dialect.Join[Q](typ, FieldseekerZones.Name().As(to.Alias())).On(
|
|
to.OrganizationID.EQ(cols.ID),
|
|
))
|
|
}
|
|
|
|
return mods
|
|
},
|
|
},
|
|
Zones2s: modAs[Q, fieldseekerZones2Columns]{
|
|
c: FieldseekerZones2s.Columns,
|
|
f: func(to fieldseekerZones2Columns) bob.Mod[Q] {
|
|
mods := make(mods.QueryMods[Q], 0, 1)
|
|
|
|
{
|
|
mods = append(mods, dialect.Join[Q](typ, FieldseekerZones2s.Name().As(to.Alias())).On(
|
|
to.OrganizationID.EQ(cols.ID),
|
|
))
|
|
}
|
|
|
|
return mods
|
|
},
|
|
},
|
|
FieldseekerSyncs: modAs[Q, fieldseekerSyncColumns]{
|
|
c: FieldseekerSyncs.Columns,
|
|
f: func(to fieldseekerSyncColumns) bob.Mod[Q] {
|
|
mods := make(mods.QueryMods[Q], 0, 1)
|
|
|
|
{
|
|
mods = append(mods, dialect.Join[Q](typ, FieldseekerSyncs.Name().As(to.Alias())).On(
|
|
to.OrganizationID.EQ(cols.ID),
|
|
))
|
|
}
|
|
|
|
return mods
|
|
},
|
|
},
|
|
H3Aggregations: modAs[Q, h3AggregationColumns]{
|
|
c: H3Aggregations.Columns,
|
|
f: func(to h3AggregationColumns) bob.Mod[Q] {
|
|
mods := make(mods.QueryMods[Q], 0, 1)
|
|
|
|
{
|
|
mods = append(mods, dialect.Join[Q](typ, H3Aggregations.Name().As(to.Alias())).On(
|
|
to.OrganizationID.EQ(cols.ID),
|
|
))
|
|
}
|
|
|
|
return mods
|
|
},
|
|
},
|
|
NoteAudios: modAs[Q, noteAudioColumns]{
|
|
c: NoteAudios.Columns,
|
|
f: func(to noteAudioColumns) bob.Mod[Q] {
|
|
mods := make(mods.QueryMods[Q], 0, 1)
|
|
|
|
{
|
|
mods = append(mods, dialect.Join[Q](typ, NoteAudios.Name().As(to.Alias())).On(
|
|
to.OrganizationID.EQ(cols.ID),
|
|
))
|
|
}
|
|
|
|
return mods
|
|
},
|
|
},
|
|
NoteImages: modAs[Q, noteImageColumns]{
|
|
c: NoteImages.Columns,
|
|
f: func(to noteImageColumns) bob.Mod[Q] {
|
|
mods := make(mods.QueryMods[Q], 0, 1)
|
|
|
|
{
|
|
mods = append(mods, dialect.Join[Q](typ, NoteImages.Name().As(to.Alias())).On(
|
|
to.OrganizationID.EQ(cols.ID),
|
|
))
|
|
}
|
|
|
|
return mods
|
|
},
|
|
},
|
|
User: modAs[Q, userColumns]{
|
|
c: Users.Columns,
|
|
f: func(to userColumns) bob.Mod[Q] {
|
|
mods := make(mods.QueryMods[Q], 0, 1)
|
|
|
|
{
|
|
mods = append(mods, dialect.Join[Q](typ, Users.Name().As(to.Alias())).On(
|
|
to.OrganizationID.EQ(cols.ID),
|
|
))
|
|
}
|
|
|
|
return mods
|
|
},
|
|
},
|
|
}
|
|
}
|