3429 lines
109 KiB
Go
3429 lines
109 KiB
Go
// Code generated by BobGen psql v0.42.1. DO NOT EDIT.
|
|
// This file is meant to be re-generated in place and/or deleted at any time.
|
|
|
|
package factory
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
models "github.com/Gleipnir-Technology/nidus-sync/db/models"
|
|
"github.com/aarondl/opt/null"
|
|
"github.com/aarondl/opt/omit"
|
|
"github.com/aarondl/opt/omitnull"
|
|
"github.com/jaswdr/faker/v2"
|
|
"github.com/stephenafamo/bob"
|
|
)
|
|
|
|
type OrganizationMod interface {
|
|
Apply(context.Context, *OrganizationTemplate)
|
|
}
|
|
|
|
type OrganizationModFunc func(context.Context, *OrganizationTemplate)
|
|
|
|
func (f OrganizationModFunc) Apply(ctx context.Context, n *OrganizationTemplate) {
|
|
f(ctx, n)
|
|
}
|
|
|
|
type OrganizationModSlice []OrganizationMod
|
|
|
|
func (mods OrganizationModSlice) Apply(ctx context.Context, n *OrganizationTemplate) {
|
|
for _, f := range mods {
|
|
f.Apply(ctx, n)
|
|
}
|
|
}
|
|
|
|
// OrganizationTemplate is an object representing the database table.
|
|
// all columns are optional and should be set by mods
|
|
type OrganizationTemplate struct {
|
|
ID func() int32
|
|
Name func() string
|
|
ArcgisID func() null.Val[string]
|
|
ArcgisName func() null.Val[string]
|
|
FieldseekerURL func() null.Val[string]
|
|
ImportDistrictGid func() null.Val[int32]
|
|
Website func() null.Val[string]
|
|
|
|
r organizationR
|
|
f *Factory
|
|
|
|
alreadyPersisted bool
|
|
}
|
|
|
|
type organizationR struct {
|
|
Containerrelates []*organizationRContainerrelatesR
|
|
Fieldscoutinglogs []*organizationRFieldscoutinglogsR
|
|
Habitatrelates []*organizationRHabitatrelatesR
|
|
Inspectionsamples []*organizationRInspectionsamplesR
|
|
Inspectionsampledetails []*organizationRInspectionsampledetailsR
|
|
Linelocations []*organizationRLinelocationsR
|
|
Locationtrackings []*organizationRLocationtrackingsR
|
|
Mosquitoinspections []*organizationRMosquitoinspectionsR
|
|
Pointlocations []*organizationRPointlocationsR
|
|
Polygonlocations []*organizationRPolygonlocationsR
|
|
Pools []*organizationRPoolsR
|
|
Pooldetails []*organizationRPooldetailsR
|
|
Proposedtreatmentareas []*organizationRProposedtreatmentareasR
|
|
Qamosquitoinspections []*organizationRQamosquitoinspectionsR
|
|
Rodentlocations []*organizationRRodentlocationsR
|
|
Samplecollections []*organizationRSamplecollectionsR
|
|
Samplelocations []*organizationRSamplelocationsR
|
|
Servicerequests []*organizationRServicerequestsR
|
|
Speciesabundances []*organizationRSpeciesabundancesR
|
|
Stormdrains []*organizationRStormdrainsR
|
|
Timecards []*organizationRTimecardsR
|
|
Trapdata []*organizationRTrapdataR
|
|
Traplocations []*organizationRTraplocationsR
|
|
Treatments []*organizationRTreatmentsR
|
|
Treatmentareas []*organizationRTreatmentareasR
|
|
Zones []*organizationRZonesR
|
|
Zones2s []*organizationRZones2sR
|
|
FieldseekerSyncs []*organizationRFieldseekerSyncsR
|
|
H3Aggregations []*organizationRH3AggregationsR
|
|
NoteAudios []*organizationRNoteAudiosR
|
|
NoteImages []*organizationRNoteImagesR
|
|
ImportDistrictGidDistrict *organizationRImportDistrictGidDistrictR
|
|
User []*organizationRUserR
|
|
}
|
|
|
|
type organizationRContainerrelatesR struct {
|
|
number int
|
|
o *FieldseekerContainerrelateTemplate
|
|
}
|
|
type organizationRFieldscoutinglogsR struct {
|
|
number int
|
|
o *FieldseekerFieldscoutinglogTemplate
|
|
}
|
|
type organizationRHabitatrelatesR struct {
|
|
number int
|
|
o *FieldseekerHabitatrelateTemplate
|
|
}
|
|
type organizationRInspectionsamplesR struct {
|
|
number int
|
|
o *FieldseekerInspectionsampleTemplate
|
|
}
|
|
type organizationRInspectionsampledetailsR struct {
|
|
number int
|
|
o *FieldseekerInspectionsampledetailTemplate
|
|
}
|
|
type organizationRLinelocationsR struct {
|
|
number int
|
|
o *FieldseekerLinelocationTemplate
|
|
}
|
|
type organizationRLocationtrackingsR struct {
|
|
number int
|
|
o *FieldseekerLocationtrackingTemplate
|
|
}
|
|
type organizationRMosquitoinspectionsR struct {
|
|
number int
|
|
o *FieldseekerMosquitoinspectionTemplate
|
|
}
|
|
type organizationRPointlocationsR struct {
|
|
number int
|
|
o *FieldseekerPointlocationTemplate
|
|
}
|
|
type organizationRPolygonlocationsR struct {
|
|
number int
|
|
o *FieldseekerPolygonlocationTemplate
|
|
}
|
|
type organizationRPoolsR struct {
|
|
number int
|
|
o *FieldseekerPoolTemplate
|
|
}
|
|
type organizationRPooldetailsR struct {
|
|
number int
|
|
o *FieldseekerPooldetailTemplate
|
|
}
|
|
type organizationRProposedtreatmentareasR struct {
|
|
number int
|
|
o *FieldseekerProposedtreatmentareaTemplate
|
|
}
|
|
type organizationRQamosquitoinspectionsR struct {
|
|
number int
|
|
o *FieldseekerQamosquitoinspectionTemplate
|
|
}
|
|
type organizationRRodentlocationsR struct {
|
|
number int
|
|
o *FieldseekerRodentlocationTemplate
|
|
}
|
|
type organizationRSamplecollectionsR struct {
|
|
number int
|
|
o *FieldseekerSamplecollectionTemplate
|
|
}
|
|
type organizationRSamplelocationsR struct {
|
|
number int
|
|
o *FieldseekerSamplelocationTemplate
|
|
}
|
|
type organizationRServicerequestsR struct {
|
|
number int
|
|
o *FieldseekerServicerequestTemplate
|
|
}
|
|
type organizationRSpeciesabundancesR struct {
|
|
number int
|
|
o *FieldseekerSpeciesabundanceTemplate
|
|
}
|
|
type organizationRStormdrainsR struct {
|
|
number int
|
|
o *FieldseekerStormdrainTemplate
|
|
}
|
|
type organizationRTimecardsR struct {
|
|
number int
|
|
o *FieldseekerTimecardTemplate
|
|
}
|
|
type organizationRTrapdataR struct {
|
|
number int
|
|
o *FieldseekerTrapdatumTemplate
|
|
}
|
|
type organizationRTraplocationsR struct {
|
|
number int
|
|
o *FieldseekerTraplocationTemplate
|
|
}
|
|
type organizationRTreatmentsR struct {
|
|
number int
|
|
o *FieldseekerTreatmentTemplate
|
|
}
|
|
type organizationRTreatmentareasR struct {
|
|
number int
|
|
o *FieldseekerTreatmentareaTemplate
|
|
}
|
|
type organizationRZonesR struct {
|
|
number int
|
|
o *FieldseekerZoneTemplate
|
|
}
|
|
type organizationRZones2sR struct {
|
|
number int
|
|
o *FieldseekerZones2Template
|
|
}
|
|
type organizationRFieldseekerSyncsR struct {
|
|
number int
|
|
o *FieldseekerSyncTemplate
|
|
}
|
|
type organizationRH3AggregationsR struct {
|
|
number int
|
|
o *H3AggregationTemplate
|
|
}
|
|
type organizationRNoteAudiosR struct {
|
|
number int
|
|
o *NoteAudioTemplate
|
|
}
|
|
type organizationRNoteImagesR struct {
|
|
number int
|
|
o *NoteImageTemplate
|
|
}
|
|
type organizationRImportDistrictGidDistrictR struct {
|
|
o *ImportDistrictTemplate
|
|
}
|
|
type organizationRUserR struct {
|
|
number int
|
|
o *UserTemplate
|
|
}
|
|
|
|
// Apply mods to the OrganizationTemplate
|
|
func (o *OrganizationTemplate) Apply(ctx context.Context, mods ...OrganizationMod) {
|
|
for _, mod := range mods {
|
|
mod.Apply(ctx, o)
|
|
}
|
|
}
|
|
|
|
// setModelRels creates and sets the relationships on *models.Organization
|
|
// according to the relationships in the template. Nothing is inserted into the db
|
|
func (t OrganizationTemplate) setModelRels(o *models.Organization) {
|
|
if t.r.Containerrelates != nil {
|
|
rel := models.FieldseekerContainerrelateSlice{}
|
|
for _, r := range t.r.Containerrelates {
|
|
related := r.o.BuildMany(r.number)
|
|
for _, rel := range related {
|
|
rel.OrganizationID = o.ID // h2
|
|
rel.R.Organization = o
|
|
}
|
|
rel = append(rel, related...)
|
|
}
|
|
o.R.Containerrelates = rel
|
|
}
|
|
|
|
if t.r.Fieldscoutinglogs != nil {
|
|
rel := models.FieldseekerFieldscoutinglogSlice{}
|
|
for _, r := range t.r.Fieldscoutinglogs {
|
|
related := r.o.BuildMany(r.number)
|
|
for _, rel := range related {
|
|
rel.OrganizationID = o.ID // h2
|
|
rel.R.Organization = o
|
|
}
|
|
rel = append(rel, related...)
|
|
}
|
|
o.R.Fieldscoutinglogs = rel
|
|
}
|
|
|
|
if t.r.Habitatrelates != nil {
|
|
rel := models.FieldseekerHabitatrelateSlice{}
|
|
for _, r := range t.r.Habitatrelates {
|
|
related := r.o.BuildMany(r.number)
|
|
for _, rel := range related {
|
|
rel.OrganizationID = o.ID // h2
|
|
rel.R.Organization = o
|
|
}
|
|
rel = append(rel, related...)
|
|
}
|
|
o.R.Habitatrelates = rel
|
|
}
|
|
|
|
if t.r.Inspectionsamples != nil {
|
|
rel := models.FieldseekerInspectionsampleSlice{}
|
|
for _, r := range t.r.Inspectionsamples {
|
|
related := r.o.BuildMany(r.number)
|
|
for _, rel := range related {
|
|
rel.OrganizationID = o.ID // h2
|
|
rel.R.Organization = o
|
|
}
|
|
rel = append(rel, related...)
|
|
}
|
|
o.R.Inspectionsamples = rel
|
|
}
|
|
|
|
if t.r.Inspectionsampledetails != nil {
|
|
rel := models.FieldseekerInspectionsampledetailSlice{}
|
|
for _, r := range t.r.Inspectionsampledetails {
|
|
related := r.o.BuildMany(r.number)
|
|
for _, rel := range related {
|
|
rel.OrganizationID = o.ID // h2
|
|
rel.R.Organization = o
|
|
}
|
|
rel = append(rel, related...)
|
|
}
|
|
o.R.Inspectionsampledetails = rel
|
|
}
|
|
|
|
if t.r.Linelocations != nil {
|
|
rel := models.FieldseekerLinelocationSlice{}
|
|
for _, r := range t.r.Linelocations {
|
|
related := r.o.BuildMany(r.number)
|
|
for _, rel := range related {
|
|
rel.OrganizationID = o.ID // h2
|
|
rel.R.Organization = o
|
|
}
|
|
rel = append(rel, related...)
|
|
}
|
|
o.R.Linelocations = rel
|
|
}
|
|
|
|
if t.r.Locationtrackings != nil {
|
|
rel := models.FieldseekerLocationtrackingSlice{}
|
|
for _, r := range t.r.Locationtrackings {
|
|
related := r.o.BuildMany(r.number)
|
|
for _, rel := range related {
|
|
rel.OrganizationID = o.ID // h2
|
|
rel.R.Organization = o
|
|
}
|
|
rel = append(rel, related...)
|
|
}
|
|
o.R.Locationtrackings = rel
|
|
}
|
|
|
|
if t.r.Mosquitoinspections != nil {
|
|
rel := models.FieldseekerMosquitoinspectionSlice{}
|
|
for _, r := range t.r.Mosquitoinspections {
|
|
related := r.o.BuildMany(r.number)
|
|
for _, rel := range related {
|
|
rel.OrganizationID = o.ID // h2
|
|
rel.R.Organization = o
|
|
}
|
|
rel = append(rel, related...)
|
|
}
|
|
o.R.Mosquitoinspections = rel
|
|
}
|
|
|
|
if t.r.Pointlocations != nil {
|
|
rel := models.FieldseekerPointlocationSlice{}
|
|
for _, r := range t.r.Pointlocations {
|
|
related := r.o.BuildMany(r.number)
|
|
for _, rel := range related {
|
|
rel.OrganizationID = o.ID // h2
|
|
rel.R.Organization = o
|
|
}
|
|
rel = append(rel, related...)
|
|
}
|
|
o.R.Pointlocations = rel
|
|
}
|
|
|
|
if t.r.Polygonlocations != nil {
|
|
rel := models.FieldseekerPolygonlocationSlice{}
|
|
for _, r := range t.r.Polygonlocations {
|
|
related := r.o.BuildMany(r.number)
|
|
for _, rel := range related {
|
|
rel.OrganizationID = o.ID // h2
|
|
rel.R.Organization = o
|
|
}
|
|
rel = append(rel, related...)
|
|
}
|
|
o.R.Polygonlocations = rel
|
|
}
|
|
|
|
if t.r.Pools != nil {
|
|
rel := models.FieldseekerPoolSlice{}
|
|
for _, r := range t.r.Pools {
|
|
related := r.o.BuildMany(r.number)
|
|
for _, rel := range related {
|
|
rel.OrganizationID = o.ID // h2
|
|
rel.R.Organization = o
|
|
}
|
|
rel = append(rel, related...)
|
|
}
|
|
o.R.Pools = rel
|
|
}
|
|
|
|
if t.r.Pooldetails != nil {
|
|
rel := models.FieldseekerPooldetailSlice{}
|
|
for _, r := range t.r.Pooldetails {
|
|
related := r.o.BuildMany(r.number)
|
|
for _, rel := range related {
|
|
rel.OrganizationID = o.ID // h2
|
|
rel.R.Organization = o
|
|
}
|
|
rel = append(rel, related...)
|
|
}
|
|
o.R.Pooldetails = rel
|
|
}
|
|
|
|
if t.r.Proposedtreatmentareas != nil {
|
|
rel := models.FieldseekerProposedtreatmentareaSlice{}
|
|
for _, r := range t.r.Proposedtreatmentareas {
|
|
related := r.o.BuildMany(r.number)
|
|
for _, rel := range related {
|
|
rel.OrganizationID = o.ID // h2
|
|
rel.R.Organization = o
|
|
}
|
|
rel = append(rel, related...)
|
|
}
|
|
o.R.Proposedtreatmentareas = rel
|
|
}
|
|
|
|
if t.r.Qamosquitoinspections != nil {
|
|
rel := models.FieldseekerQamosquitoinspectionSlice{}
|
|
for _, r := range t.r.Qamosquitoinspections {
|
|
related := r.o.BuildMany(r.number)
|
|
for _, rel := range related {
|
|
rel.OrganizationID = o.ID // h2
|
|
rel.R.Organization = o
|
|
}
|
|
rel = append(rel, related...)
|
|
}
|
|
o.R.Qamosquitoinspections = rel
|
|
}
|
|
|
|
if t.r.Rodentlocations != nil {
|
|
rel := models.FieldseekerRodentlocationSlice{}
|
|
for _, r := range t.r.Rodentlocations {
|
|
related := r.o.BuildMany(r.number)
|
|
for _, rel := range related {
|
|
rel.OrganizationID = o.ID // h2
|
|
rel.R.Organization = o
|
|
}
|
|
rel = append(rel, related...)
|
|
}
|
|
o.R.Rodentlocations = rel
|
|
}
|
|
|
|
if t.r.Samplecollections != nil {
|
|
rel := models.FieldseekerSamplecollectionSlice{}
|
|
for _, r := range t.r.Samplecollections {
|
|
related := r.o.BuildMany(r.number)
|
|
for _, rel := range related {
|
|
rel.OrganizationID = o.ID // h2
|
|
rel.R.Organization = o
|
|
}
|
|
rel = append(rel, related...)
|
|
}
|
|
o.R.Samplecollections = rel
|
|
}
|
|
|
|
if t.r.Samplelocations != nil {
|
|
rel := models.FieldseekerSamplelocationSlice{}
|
|
for _, r := range t.r.Samplelocations {
|
|
related := r.o.BuildMany(r.number)
|
|
for _, rel := range related {
|
|
rel.OrganizationID = o.ID // h2
|
|
rel.R.Organization = o
|
|
}
|
|
rel = append(rel, related...)
|
|
}
|
|
o.R.Samplelocations = rel
|
|
}
|
|
|
|
if t.r.Servicerequests != nil {
|
|
rel := models.FieldseekerServicerequestSlice{}
|
|
for _, r := range t.r.Servicerequests {
|
|
related := r.o.BuildMany(r.number)
|
|
for _, rel := range related {
|
|
rel.OrganizationID = o.ID // h2
|
|
rel.R.Organization = o
|
|
}
|
|
rel = append(rel, related...)
|
|
}
|
|
o.R.Servicerequests = rel
|
|
}
|
|
|
|
if t.r.Speciesabundances != nil {
|
|
rel := models.FieldseekerSpeciesabundanceSlice{}
|
|
for _, r := range t.r.Speciesabundances {
|
|
related := r.o.BuildMany(r.number)
|
|
for _, rel := range related {
|
|
rel.OrganizationID = o.ID // h2
|
|
rel.R.Organization = o
|
|
}
|
|
rel = append(rel, related...)
|
|
}
|
|
o.R.Speciesabundances = rel
|
|
}
|
|
|
|
if t.r.Stormdrains != nil {
|
|
rel := models.FieldseekerStormdrainSlice{}
|
|
for _, r := range t.r.Stormdrains {
|
|
related := r.o.BuildMany(r.number)
|
|
for _, rel := range related {
|
|
rel.OrganizationID = o.ID // h2
|
|
rel.R.Organization = o
|
|
}
|
|
rel = append(rel, related...)
|
|
}
|
|
o.R.Stormdrains = rel
|
|
}
|
|
|
|
if t.r.Timecards != nil {
|
|
rel := models.FieldseekerTimecardSlice{}
|
|
for _, r := range t.r.Timecards {
|
|
related := r.o.BuildMany(r.number)
|
|
for _, rel := range related {
|
|
rel.OrganizationID = o.ID // h2
|
|
rel.R.Organization = o
|
|
}
|
|
rel = append(rel, related...)
|
|
}
|
|
o.R.Timecards = rel
|
|
}
|
|
|
|
if t.r.Trapdata != nil {
|
|
rel := models.FieldseekerTrapdatumSlice{}
|
|
for _, r := range t.r.Trapdata {
|
|
related := r.o.BuildMany(r.number)
|
|
for _, rel := range related {
|
|
rel.OrganizationID = o.ID // h2
|
|
rel.R.Organization = o
|
|
}
|
|
rel = append(rel, related...)
|
|
}
|
|
o.R.Trapdata = rel
|
|
}
|
|
|
|
if t.r.Traplocations != nil {
|
|
rel := models.FieldseekerTraplocationSlice{}
|
|
for _, r := range t.r.Traplocations {
|
|
related := r.o.BuildMany(r.number)
|
|
for _, rel := range related {
|
|
rel.OrganizationID = o.ID // h2
|
|
rel.R.Organization = o
|
|
}
|
|
rel = append(rel, related...)
|
|
}
|
|
o.R.Traplocations = rel
|
|
}
|
|
|
|
if t.r.Treatments != nil {
|
|
rel := models.FieldseekerTreatmentSlice{}
|
|
for _, r := range t.r.Treatments {
|
|
related := r.o.BuildMany(r.number)
|
|
for _, rel := range related {
|
|
rel.OrganizationID = o.ID // h2
|
|
rel.R.Organization = o
|
|
}
|
|
rel = append(rel, related...)
|
|
}
|
|
o.R.Treatments = rel
|
|
}
|
|
|
|
if t.r.Treatmentareas != nil {
|
|
rel := models.FieldseekerTreatmentareaSlice{}
|
|
for _, r := range t.r.Treatmentareas {
|
|
related := r.o.BuildMany(r.number)
|
|
for _, rel := range related {
|
|
rel.OrganizationID = o.ID // h2
|
|
rel.R.Organization = o
|
|
}
|
|
rel = append(rel, related...)
|
|
}
|
|
o.R.Treatmentareas = rel
|
|
}
|
|
|
|
if t.r.Zones != nil {
|
|
rel := models.FieldseekerZoneSlice{}
|
|
for _, r := range t.r.Zones {
|
|
related := r.o.BuildMany(r.number)
|
|
for _, rel := range related {
|
|
rel.OrganizationID = o.ID // h2
|
|
rel.R.Organization = o
|
|
}
|
|
rel = append(rel, related...)
|
|
}
|
|
o.R.Zones = rel
|
|
}
|
|
|
|
if t.r.Zones2s != nil {
|
|
rel := models.FieldseekerZones2Slice{}
|
|
for _, r := range t.r.Zones2s {
|
|
related := r.o.BuildMany(r.number)
|
|
for _, rel := range related {
|
|
rel.OrganizationID = o.ID // h2
|
|
rel.R.Organization = o
|
|
}
|
|
rel = append(rel, related...)
|
|
}
|
|
o.R.Zones2s = rel
|
|
}
|
|
|
|
if t.r.FieldseekerSyncs != nil {
|
|
rel := models.FieldseekerSyncSlice{}
|
|
for _, r := range t.r.FieldseekerSyncs {
|
|
related := r.o.BuildMany(r.number)
|
|
for _, rel := range related {
|
|
rel.OrganizationID = o.ID // h2
|
|
rel.R.Organization = o
|
|
}
|
|
rel = append(rel, related...)
|
|
}
|
|
o.R.FieldseekerSyncs = rel
|
|
}
|
|
|
|
if t.r.H3Aggregations != nil {
|
|
rel := models.H3AggregationSlice{}
|
|
for _, r := range t.r.H3Aggregations {
|
|
related := r.o.BuildMany(r.number)
|
|
for _, rel := range related {
|
|
rel.OrganizationID = o.ID // h2
|
|
rel.R.Organization = o
|
|
}
|
|
rel = append(rel, related...)
|
|
}
|
|
o.R.H3Aggregations = rel
|
|
}
|
|
|
|
if t.r.NoteAudios != nil {
|
|
rel := models.NoteAudioSlice{}
|
|
for _, r := range t.r.NoteAudios {
|
|
related := r.o.BuildMany(r.number)
|
|
for _, rel := range related {
|
|
rel.OrganizationID = o.ID // h2
|
|
rel.R.Organization = o
|
|
}
|
|
rel = append(rel, related...)
|
|
}
|
|
o.R.NoteAudios = rel
|
|
}
|
|
|
|
if t.r.NoteImages != nil {
|
|
rel := models.NoteImageSlice{}
|
|
for _, r := range t.r.NoteImages {
|
|
related := r.o.BuildMany(r.number)
|
|
for _, rel := range related {
|
|
rel.OrganizationID = o.ID // h2
|
|
rel.R.Organization = o
|
|
}
|
|
rel = append(rel, related...)
|
|
}
|
|
o.R.NoteImages = rel
|
|
}
|
|
|
|
if t.r.ImportDistrictGidDistrict != nil {
|
|
rel := t.r.ImportDistrictGidDistrict.o.Build()
|
|
rel.R.ImportDistrictGidOrganization = o
|
|
o.ImportDistrictGid = null.From(rel.Gid) // h2
|
|
o.R.ImportDistrictGidDistrict = rel
|
|
}
|
|
|
|
if t.r.User != nil {
|
|
rel := models.UserSlice{}
|
|
for _, r := range t.r.User {
|
|
related := r.o.BuildMany(r.number)
|
|
for _, rel := range related {
|
|
rel.OrganizationID = o.ID // h2
|
|
rel.R.Organization = o
|
|
}
|
|
rel = append(rel, related...)
|
|
}
|
|
o.R.User = rel
|
|
}
|
|
}
|
|
|
|
// BuildSetter returns an *models.OrganizationSetter
|
|
// this does nothing with the relationship templates
|
|
func (o OrganizationTemplate) BuildSetter() *models.OrganizationSetter {
|
|
m := &models.OrganizationSetter{}
|
|
|
|
if o.ID != nil {
|
|
val := o.ID()
|
|
m.ID = omit.From(val)
|
|
}
|
|
if o.Name != nil {
|
|
val := o.Name()
|
|
m.Name = omit.From(val)
|
|
}
|
|
if o.ArcgisID != nil {
|
|
val := o.ArcgisID()
|
|
m.ArcgisID = omitnull.FromNull(val)
|
|
}
|
|
if o.ArcgisName != nil {
|
|
val := o.ArcgisName()
|
|
m.ArcgisName = omitnull.FromNull(val)
|
|
}
|
|
if o.FieldseekerURL != nil {
|
|
val := o.FieldseekerURL()
|
|
m.FieldseekerURL = omitnull.FromNull(val)
|
|
}
|
|
if o.ImportDistrictGid != nil {
|
|
val := o.ImportDistrictGid()
|
|
m.ImportDistrictGid = omitnull.FromNull(val)
|
|
}
|
|
if o.Website != nil {
|
|
val := o.Website()
|
|
m.Website = omitnull.FromNull(val)
|
|
}
|
|
|
|
return m
|
|
}
|
|
|
|
// BuildManySetter returns an []*models.OrganizationSetter
|
|
// this does nothing with the relationship templates
|
|
func (o OrganizationTemplate) BuildManySetter(number int) []*models.OrganizationSetter {
|
|
m := make([]*models.OrganizationSetter, number)
|
|
|
|
for i := range m {
|
|
m[i] = o.BuildSetter()
|
|
}
|
|
|
|
return m
|
|
}
|
|
|
|
// Build returns an *models.Organization
|
|
// Related objects are also created and placed in the .R field
|
|
// NOTE: Objects are not inserted into the database. Use OrganizationTemplate.Create
|
|
func (o OrganizationTemplate) Build() *models.Organization {
|
|
m := &models.Organization{}
|
|
|
|
if o.ID != nil {
|
|
m.ID = o.ID()
|
|
}
|
|
if o.Name != nil {
|
|
m.Name = o.Name()
|
|
}
|
|
if o.ArcgisID != nil {
|
|
m.ArcgisID = o.ArcgisID()
|
|
}
|
|
if o.ArcgisName != nil {
|
|
m.ArcgisName = o.ArcgisName()
|
|
}
|
|
if o.FieldseekerURL != nil {
|
|
m.FieldseekerURL = o.FieldseekerURL()
|
|
}
|
|
if o.ImportDistrictGid != nil {
|
|
m.ImportDistrictGid = o.ImportDistrictGid()
|
|
}
|
|
if o.Website != nil {
|
|
m.Website = o.Website()
|
|
}
|
|
|
|
o.setModelRels(m)
|
|
|
|
return m
|
|
}
|
|
|
|
// BuildMany returns an models.OrganizationSlice
|
|
// Related objects are also created and placed in the .R field
|
|
// NOTE: Objects are not inserted into the database. Use OrganizationTemplate.CreateMany
|
|
func (o OrganizationTemplate) BuildMany(number int) models.OrganizationSlice {
|
|
m := make(models.OrganizationSlice, number)
|
|
|
|
for i := range m {
|
|
m[i] = o.Build()
|
|
}
|
|
|
|
return m
|
|
}
|
|
|
|
func ensureCreatableOrganization(m *models.OrganizationSetter) {
|
|
if !(m.Name.IsValue()) {
|
|
val := random_string(nil)
|
|
m.Name = omit.From(val)
|
|
}
|
|
}
|
|
|
|
// insertOptRels creates and inserts any optional the relationships on *models.Organization
|
|
// according to the relationships in the template.
|
|
// any required relationship should have already exist on the model
|
|
func (o *OrganizationTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.Organization) error {
|
|
var err error
|
|
|
|
isContainerrelatesDone, _ := organizationRelContainerrelatesCtx.Value(ctx)
|
|
if !isContainerrelatesDone && o.r.Containerrelates != nil {
|
|
ctx = organizationRelContainerrelatesCtx.WithValue(ctx, true)
|
|
for _, r := range o.r.Containerrelates {
|
|
if r.o.alreadyPersisted {
|
|
m.R.Containerrelates = append(m.R.Containerrelates, r.o.Build())
|
|
} else {
|
|
rel0, err := r.o.CreateMany(ctx, exec, r.number)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
err = m.AttachContainerrelates(ctx, exec, rel0...)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
isFieldscoutinglogsDone, _ := organizationRelFieldscoutinglogsCtx.Value(ctx)
|
|
if !isFieldscoutinglogsDone && o.r.Fieldscoutinglogs != nil {
|
|
ctx = organizationRelFieldscoutinglogsCtx.WithValue(ctx, true)
|
|
for _, r := range o.r.Fieldscoutinglogs {
|
|
if r.o.alreadyPersisted {
|
|
m.R.Fieldscoutinglogs = append(m.R.Fieldscoutinglogs, r.o.Build())
|
|
} else {
|
|
rel1, err := r.o.CreateMany(ctx, exec, r.number)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
err = m.AttachFieldscoutinglogs(ctx, exec, rel1...)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
isHabitatrelatesDone, _ := organizationRelHabitatrelatesCtx.Value(ctx)
|
|
if !isHabitatrelatesDone && o.r.Habitatrelates != nil {
|
|
ctx = organizationRelHabitatrelatesCtx.WithValue(ctx, true)
|
|
for _, r := range o.r.Habitatrelates {
|
|
if r.o.alreadyPersisted {
|
|
m.R.Habitatrelates = append(m.R.Habitatrelates, r.o.Build())
|
|
} else {
|
|
rel2, err := r.o.CreateMany(ctx, exec, r.number)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
err = m.AttachHabitatrelates(ctx, exec, rel2...)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
isInspectionsamplesDone, _ := organizationRelInspectionsamplesCtx.Value(ctx)
|
|
if !isInspectionsamplesDone && o.r.Inspectionsamples != nil {
|
|
ctx = organizationRelInspectionsamplesCtx.WithValue(ctx, true)
|
|
for _, r := range o.r.Inspectionsamples {
|
|
if r.o.alreadyPersisted {
|
|
m.R.Inspectionsamples = append(m.R.Inspectionsamples, r.o.Build())
|
|
} else {
|
|
rel3, err := r.o.CreateMany(ctx, exec, r.number)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
err = m.AttachInspectionsamples(ctx, exec, rel3...)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
isInspectionsampledetailsDone, _ := organizationRelInspectionsampledetailsCtx.Value(ctx)
|
|
if !isInspectionsampledetailsDone && o.r.Inspectionsampledetails != nil {
|
|
ctx = organizationRelInspectionsampledetailsCtx.WithValue(ctx, true)
|
|
for _, r := range o.r.Inspectionsampledetails {
|
|
if r.o.alreadyPersisted {
|
|
m.R.Inspectionsampledetails = append(m.R.Inspectionsampledetails, r.o.Build())
|
|
} else {
|
|
rel4, err := r.o.CreateMany(ctx, exec, r.number)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
err = m.AttachInspectionsampledetails(ctx, exec, rel4...)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
isLinelocationsDone, _ := organizationRelLinelocationsCtx.Value(ctx)
|
|
if !isLinelocationsDone && o.r.Linelocations != nil {
|
|
ctx = organizationRelLinelocationsCtx.WithValue(ctx, true)
|
|
for _, r := range o.r.Linelocations {
|
|
if r.o.alreadyPersisted {
|
|
m.R.Linelocations = append(m.R.Linelocations, r.o.Build())
|
|
} else {
|
|
rel5, err := r.o.CreateMany(ctx, exec, r.number)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
err = m.AttachLinelocations(ctx, exec, rel5...)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
isLocationtrackingsDone, _ := organizationRelLocationtrackingsCtx.Value(ctx)
|
|
if !isLocationtrackingsDone && o.r.Locationtrackings != nil {
|
|
ctx = organizationRelLocationtrackingsCtx.WithValue(ctx, true)
|
|
for _, r := range o.r.Locationtrackings {
|
|
if r.o.alreadyPersisted {
|
|
m.R.Locationtrackings = append(m.R.Locationtrackings, r.o.Build())
|
|
} else {
|
|
rel6, err := r.o.CreateMany(ctx, exec, r.number)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
err = m.AttachLocationtrackings(ctx, exec, rel6...)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
isMosquitoinspectionsDone, _ := organizationRelMosquitoinspectionsCtx.Value(ctx)
|
|
if !isMosquitoinspectionsDone && o.r.Mosquitoinspections != nil {
|
|
ctx = organizationRelMosquitoinspectionsCtx.WithValue(ctx, true)
|
|
for _, r := range o.r.Mosquitoinspections {
|
|
if r.o.alreadyPersisted {
|
|
m.R.Mosquitoinspections = append(m.R.Mosquitoinspections, r.o.Build())
|
|
} else {
|
|
rel7, err := r.o.CreateMany(ctx, exec, r.number)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
err = m.AttachMosquitoinspections(ctx, exec, rel7...)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
isPointlocationsDone, _ := organizationRelPointlocationsCtx.Value(ctx)
|
|
if !isPointlocationsDone && o.r.Pointlocations != nil {
|
|
ctx = organizationRelPointlocationsCtx.WithValue(ctx, true)
|
|
for _, r := range o.r.Pointlocations {
|
|
if r.o.alreadyPersisted {
|
|
m.R.Pointlocations = append(m.R.Pointlocations, r.o.Build())
|
|
} else {
|
|
rel8, err := r.o.CreateMany(ctx, exec, r.number)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
err = m.AttachPointlocations(ctx, exec, rel8...)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
isPolygonlocationsDone, _ := organizationRelPolygonlocationsCtx.Value(ctx)
|
|
if !isPolygonlocationsDone && o.r.Polygonlocations != nil {
|
|
ctx = organizationRelPolygonlocationsCtx.WithValue(ctx, true)
|
|
for _, r := range o.r.Polygonlocations {
|
|
if r.o.alreadyPersisted {
|
|
m.R.Polygonlocations = append(m.R.Polygonlocations, r.o.Build())
|
|
} else {
|
|
rel9, err := r.o.CreateMany(ctx, exec, r.number)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
err = m.AttachPolygonlocations(ctx, exec, rel9...)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
isPoolsDone, _ := organizationRelPoolsCtx.Value(ctx)
|
|
if !isPoolsDone && o.r.Pools != nil {
|
|
ctx = organizationRelPoolsCtx.WithValue(ctx, true)
|
|
for _, r := range o.r.Pools {
|
|
if r.o.alreadyPersisted {
|
|
m.R.Pools = append(m.R.Pools, r.o.Build())
|
|
} else {
|
|
rel10, err := r.o.CreateMany(ctx, exec, r.number)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
err = m.AttachPools(ctx, exec, rel10...)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
isPooldetailsDone, _ := organizationRelPooldetailsCtx.Value(ctx)
|
|
if !isPooldetailsDone && o.r.Pooldetails != nil {
|
|
ctx = organizationRelPooldetailsCtx.WithValue(ctx, true)
|
|
for _, r := range o.r.Pooldetails {
|
|
if r.o.alreadyPersisted {
|
|
m.R.Pooldetails = append(m.R.Pooldetails, r.o.Build())
|
|
} else {
|
|
rel11, err := r.o.CreateMany(ctx, exec, r.number)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
err = m.AttachPooldetails(ctx, exec, rel11...)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
isProposedtreatmentareasDone, _ := organizationRelProposedtreatmentareasCtx.Value(ctx)
|
|
if !isProposedtreatmentareasDone && o.r.Proposedtreatmentareas != nil {
|
|
ctx = organizationRelProposedtreatmentareasCtx.WithValue(ctx, true)
|
|
for _, r := range o.r.Proposedtreatmentareas {
|
|
if r.o.alreadyPersisted {
|
|
m.R.Proposedtreatmentareas = append(m.R.Proposedtreatmentareas, r.o.Build())
|
|
} else {
|
|
rel12, err := r.o.CreateMany(ctx, exec, r.number)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
err = m.AttachProposedtreatmentareas(ctx, exec, rel12...)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
isQamosquitoinspectionsDone, _ := organizationRelQamosquitoinspectionsCtx.Value(ctx)
|
|
if !isQamosquitoinspectionsDone && o.r.Qamosquitoinspections != nil {
|
|
ctx = organizationRelQamosquitoinspectionsCtx.WithValue(ctx, true)
|
|
for _, r := range o.r.Qamosquitoinspections {
|
|
if r.o.alreadyPersisted {
|
|
m.R.Qamosquitoinspections = append(m.R.Qamosquitoinspections, r.o.Build())
|
|
} else {
|
|
rel13, err := r.o.CreateMany(ctx, exec, r.number)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
err = m.AttachQamosquitoinspections(ctx, exec, rel13...)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
isRodentlocationsDone, _ := organizationRelRodentlocationsCtx.Value(ctx)
|
|
if !isRodentlocationsDone && o.r.Rodentlocations != nil {
|
|
ctx = organizationRelRodentlocationsCtx.WithValue(ctx, true)
|
|
for _, r := range o.r.Rodentlocations {
|
|
if r.o.alreadyPersisted {
|
|
m.R.Rodentlocations = append(m.R.Rodentlocations, r.o.Build())
|
|
} else {
|
|
rel14, err := r.o.CreateMany(ctx, exec, r.number)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
err = m.AttachRodentlocations(ctx, exec, rel14...)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
isSamplecollectionsDone, _ := organizationRelSamplecollectionsCtx.Value(ctx)
|
|
if !isSamplecollectionsDone && o.r.Samplecollections != nil {
|
|
ctx = organizationRelSamplecollectionsCtx.WithValue(ctx, true)
|
|
for _, r := range o.r.Samplecollections {
|
|
if r.o.alreadyPersisted {
|
|
m.R.Samplecollections = append(m.R.Samplecollections, r.o.Build())
|
|
} else {
|
|
rel15, err := r.o.CreateMany(ctx, exec, r.number)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
err = m.AttachSamplecollections(ctx, exec, rel15...)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
isSamplelocationsDone, _ := organizationRelSamplelocationsCtx.Value(ctx)
|
|
if !isSamplelocationsDone && o.r.Samplelocations != nil {
|
|
ctx = organizationRelSamplelocationsCtx.WithValue(ctx, true)
|
|
for _, r := range o.r.Samplelocations {
|
|
if r.o.alreadyPersisted {
|
|
m.R.Samplelocations = append(m.R.Samplelocations, r.o.Build())
|
|
} else {
|
|
rel16, err := r.o.CreateMany(ctx, exec, r.number)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
err = m.AttachSamplelocations(ctx, exec, rel16...)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
isServicerequestsDone, _ := organizationRelServicerequestsCtx.Value(ctx)
|
|
if !isServicerequestsDone && o.r.Servicerequests != nil {
|
|
ctx = organizationRelServicerequestsCtx.WithValue(ctx, true)
|
|
for _, r := range o.r.Servicerequests {
|
|
if r.o.alreadyPersisted {
|
|
m.R.Servicerequests = append(m.R.Servicerequests, r.o.Build())
|
|
} else {
|
|
rel17, err := r.o.CreateMany(ctx, exec, r.number)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
err = m.AttachServicerequests(ctx, exec, rel17...)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
isSpeciesabundancesDone, _ := organizationRelSpeciesabundancesCtx.Value(ctx)
|
|
if !isSpeciesabundancesDone && o.r.Speciesabundances != nil {
|
|
ctx = organizationRelSpeciesabundancesCtx.WithValue(ctx, true)
|
|
for _, r := range o.r.Speciesabundances {
|
|
if r.o.alreadyPersisted {
|
|
m.R.Speciesabundances = append(m.R.Speciesabundances, r.o.Build())
|
|
} else {
|
|
rel18, err := r.o.CreateMany(ctx, exec, r.number)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
err = m.AttachSpeciesabundances(ctx, exec, rel18...)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
isStormdrainsDone, _ := organizationRelStormdrainsCtx.Value(ctx)
|
|
if !isStormdrainsDone && o.r.Stormdrains != nil {
|
|
ctx = organizationRelStormdrainsCtx.WithValue(ctx, true)
|
|
for _, r := range o.r.Stormdrains {
|
|
if r.o.alreadyPersisted {
|
|
m.R.Stormdrains = append(m.R.Stormdrains, r.o.Build())
|
|
} else {
|
|
rel19, err := r.o.CreateMany(ctx, exec, r.number)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
err = m.AttachStormdrains(ctx, exec, rel19...)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
isTimecardsDone, _ := organizationRelTimecardsCtx.Value(ctx)
|
|
if !isTimecardsDone && o.r.Timecards != nil {
|
|
ctx = organizationRelTimecardsCtx.WithValue(ctx, true)
|
|
for _, r := range o.r.Timecards {
|
|
if r.o.alreadyPersisted {
|
|
m.R.Timecards = append(m.R.Timecards, r.o.Build())
|
|
} else {
|
|
rel20, err := r.o.CreateMany(ctx, exec, r.number)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
err = m.AttachTimecards(ctx, exec, rel20...)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
isTrapdataDone, _ := organizationRelTrapdataCtx.Value(ctx)
|
|
if !isTrapdataDone && o.r.Trapdata != nil {
|
|
ctx = organizationRelTrapdataCtx.WithValue(ctx, true)
|
|
for _, r := range o.r.Trapdata {
|
|
if r.o.alreadyPersisted {
|
|
m.R.Trapdata = append(m.R.Trapdata, r.o.Build())
|
|
} else {
|
|
rel21, err := r.o.CreateMany(ctx, exec, r.number)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
err = m.AttachTrapdata(ctx, exec, rel21...)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
isTraplocationsDone, _ := organizationRelTraplocationsCtx.Value(ctx)
|
|
if !isTraplocationsDone && o.r.Traplocations != nil {
|
|
ctx = organizationRelTraplocationsCtx.WithValue(ctx, true)
|
|
for _, r := range o.r.Traplocations {
|
|
if r.o.alreadyPersisted {
|
|
m.R.Traplocations = append(m.R.Traplocations, r.o.Build())
|
|
} else {
|
|
rel22, err := r.o.CreateMany(ctx, exec, r.number)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
err = m.AttachTraplocations(ctx, exec, rel22...)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
isTreatmentsDone, _ := organizationRelTreatmentsCtx.Value(ctx)
|
|
if !isTreatmentsDone && o.r.Treatments != nil {
|
|
ctx = organizationRelTreatmentsCtx.WithValue(ctx, true)
|
|
for _, r := range o.r.Treatments {
|
|
if r.o.alreadyPersisted {
|
|
m.R.Treatments = append(m.R.Treatments, r.o.Build())
|
|
} else {
|
|
rel23, err := r.o.CreateMany(ctx, exec, r.number)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
err = m.AttachTreatments(ctx, exec, rel23...)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
isTreatmentareasDone, _ := organizationRelTreatmentareasCtx.Value(ctx)
|
|
if !isTreatmentareasDone && o.r.Treatmentareas != nil {
|
|
ctx = organizationRelTreatmentareasCtx.WithValue(ctx, true)
|
|
for _, r := range o.r.Treatmentareas {
|
|
if r.o.alreadyPersisted {
|
|
m.R.Treatmentareas = append(m.R.Treatmentareas, r.o.Build())
|
|
} else {
|
|
rel24, err := r.o.CreateMany(ctx, exec, r.number)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
err = m.AttachTreatmentareas(ctx, exec, rel24...)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
isZonesDone, _ := organizationRelZonesCtx.Value(ctx)
|
|
if !isZonesDone && o.r.Zones != nil {
|
|
ctx = organizationRelZonesCtx.WithValue(ctx, true)
|
|
for _, r := range o.r.Zones {
|
|
if r.o.alreadyPersisted {
|
|
m.R.Zones = append(m.R.Zones, r.o.Build())
|
|
} else {
|
|
rel25, err := r.o.CreateMany(ctx, exec, r.number)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
err = m.AttachZones(ctx, exec, rel25...)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
isZones2sDone, _ := organizationRelZones2sCtx.Value(ctx)
|
|
if !isZones2sDone && o.r.Zones2s != nil {
|
|
ctx = organizationRelZones2sCtx.WithValue(ctx, true)
|
|
for _, r := range o.r.Zones2s {
|
|
if r.o.alreadyPersisted {
|
|
m.R.Zones2s = append(m.R.Zones2s, r.o.Build())
|
|
} else {
|
|
rel26, err := r.o.CreateMany(ctx, exec, r.number)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
err = m.AttachZones2s(ctx, exec, rel26...)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
isFieldseekerSyncsDone, _ := organizationRelFieldseekerSyncsCtx.Value(ctx)
|
|
if !isFieldseekerSyncsDone && o.r.FieldseekerSyncs != nil {
|
|
ctx = organizationRelFieldseekerSyncsCtx.WithValue(ctx, true)
|
|
for _, r := range o.r.FieldseekerSyncs {
|
|
if r.o.alreadyPersisted {
|
|
m.R.FieldseekerSyncs = append(m.R.FieldseekerSyncs, r.o.Build())
|
|
} else {
|
|
rel27, err := r.o.CreateMany(ctx, exec, r.number)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
err = m.AttachFieldseekerSyncs(ctx, exec, rel27...)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
isH3AggregationsDone, _ := organizationRelH3AggregationsCtx.Value(ctx)
|
|
if !isH3AggregationsDone && o.r.H3Aggregations != nil {
|
|
ctx = organizationRelH3AggregationsCtx.WithValue(ctx, true)
|
|
for _, r := range o.r.H3Aggregations {
|
|
if r.o.alreadyPersisted {
|
|
m.R.H3Aggregations = append(m.R.H3Aggregations, r.o.Build())
|
|
} else {
|
|
rel28, err := r.o.CreateMany(ctx, exec, r.number)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
err = m.AttachH3Aggregations(ctx, exec, rel28...)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
isNoteAudiosDone, _ := organizationRelNoteAudiosCtx.Value(ctx)
|
|
if !isNoteAudiosDone && o.r.NoteAudios != nil {
|
|
ctx = organizationRelNoteAudiosCtx.WithValue(ctx, true)
|
|
for _, r := range o.r.NoteAudios {
|
|
if r.o.alreadyPersisted {
|
|
m.R.NoteAudios = append(m.R.NoteAudios, r.o.Build())
|
|
} else {
|
|
rel29, err := r.o.CreateMany(ctx, exec, r.number)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
err = m.AttachNoteAudios(ctx, exec, rel29...)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
isNoteImagesDone, _ := organizationRelNoteImagesCtx.Value(ctx)
|
|
if !isNoteImagesDone && o.r.NoteImages != nil {
|
|
ctx = organizationRelNoteImagesCtx.WithValue(ctx, true)
|
|
for _, r := range o.r.NoteImages {
|
|
if r.o.alreadyPersisted {
|
|
m.R.NoteImages = append(m.R.NoteImages, r.o.Build())
|
|
} else {
|
|
rel30, err := r.o.CreateMany(ctx, exec, r.number)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
err = m.AttachNoteImages(ctx, exec, rel30...)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
isImportDistrictGidDistrictDone, _ := organizationRelImportDistrictGidDistrictCtx.Value(ctx)
|
|
if !isImportDistrictGidDistrictDone && o.r.ImportDistrictGidDistrict != nil {
|
|
ctx = organizationRelImportDistrictGidDistrictCtx.WithValue(ctx, true)
|
|
if o.r.ImportDistrictGidDistrict.o.alreadyPersisted {
|
|
m.R.ImportDistrictGidDistrict = o.r.ImportDistrictGidDistrict.o.Build()
|
|
} else {
|
|
var rel31 *models.ImportDistrict
|
|
rel31, err = o.r.ImportDistrictGidDistrict.o.Create(ctx, exec)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
err = m.AttachImportDistrictGidDistrict(ctx, exec, rel31)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
isUserDone, _ := organizationRelUserCtx.Value(ctx)
|
|
if !isUserDone && o.r.User != nil {
|
|
ctx = organizationRelUserCtx.WithValue(ctx, true)
|
|
for _, r := range o.r.User {
|
|
if r.o.alreadyPersisted {
|
|
m.R.User = append(m.R.User, r.o.Build())
|
|
} else {
|
|
rel32, err := r.o.CreateMany(ctx, exec, r.number)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
err = m.AttachUser(ctx, exec, rel32...)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return err
|
|
}
|
|
|
|
// Create builds a organization and inserts it into the database
|
|
// Relations objects are also inserted and placed in the .R field
|
|
func (o *OrganizationTemplate) Create(ctx context.Context, exec bob.Executor) (*models.Organization, error) {
|
|
var err error
|
|
opt := o.BuildSetter()
|
|
ensureCreatableOrganization(opt)
|
|
|
|
m, err := models.Organizations.Insert(opt).One(ctx, exec)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
if err := o.insertOptRels(ctx, exec, m); err != nil {
|
|
return nil, err
|
|
}
|
|
return m, err
|
|
}
|
|
|
|
// MustCreate builds a organization and inserts it into the database
|
|
// Relations objects are also inserted and placed in the .R field
|
|
// panics if an error occurs
|
|
func (o *OrganizationTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.Organization {
|
|
m, err := o.Create(ctx, exec)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return m
|
|
}
|
|
|
|
// CreateOrFail builds a organization and inserts it into the database
|
|
// Relations objects are also inserted and placed in the .R field
|
|
// It calls `tb.Fatal(err)` on the test/benchmark if an error occurs
|
|
func (o *OrganizationTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.Organization {
|
|
tb.Helper()
|
|
m, err := o.Create(ctx, exec)
|
|
if err != nil {
|
|
tb.Fatal(err)
|
|
return nil
|
|
}
|
|
return m
|
|
}
|
|
|
|
// CreateMany builds multiple organizations and inserts them into the database
|
|
// Relations objects are also inserted and placed in the .R field
|
|
func (o OrganizationTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.OrganizationSlice, error) {
|
|
var err error
|
|
m := make(models.OrganizationSlice, number)
|
|
|
|
for i := range m {
|
|
m[i], err = o.Create(ctx, exec)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
}
|
|
|
|
return m, nil
|
|
}
|
|
|
|
// MustCreateMany builds multiple organizations and inserts them into the database
|
|
// Relations objects are also inserted and placed in the .R field
|
|
// panics if an error occurs
|
|
func (o OrganizationTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.OrganizationSlice {
|
|
m, err := o.CreateMany(ctx, exec, number)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return m
|
|
}
|
|
|
|
// CreateManyOrFail builds multiple organizations and inserts them into the database
|
|
// Relations objects are also inserted and placed in the .R field
|
|
// It calls `tb.Fatal(err)` on the test/benchmark if an error occurs
|
|
func (o OrganizationTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.OrganizationSlice {
|
|
tb.Helper()
|
|
m, err := o.CreateMany(ctx, exec, number)
|
|
if err != nil {
|
|
tb.Fatal(err)
|
|
return nil
|
|
}
|
|
return m
|
|
}
|
|
|
|
// Organization has methods that act as mods for the OrganizationTemplate
|
|
var OrganizationMods organizationMods
|
|
|
|
type organizationMods struct{}
|
|
|
|
func (m organizationMods) RandomizeAllColumns(f *faker.Faker) OrganizationMod {
|
|
return OrganizationModSlice{
|
|
OrganizationMods.RandomID(f),
|
|
OrganizationMods.RandomName(f),
|
|
OrganizationMods.RandomArcgisID(f),
|
|
OrganizationMods.RandomArcgisName(f),
|
|
OrganizationMods.RandomFieldseekerURL(f),
|
|
OrganizationMods.RandomImportDistrictGid(f),
|
|
OrganizationMods.RandomWebsite(f),
|
|
}
|
|
}
|
|
|
|
// Set the model columns to this value
|
|
func (m organizationMods) ID(val int32) OrganizationMod {
|
|
return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) {
|
|
o.ID = func() int32 { return val }
|
|
})
|
|
}
|
|
|
|
// Set the Column from the function
|
|
func (m organizationMods) IDFunc(f func() int32) OrganizationMod {
|
|
return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) {
|
|
o.ID = f
|
|
})
|
|
}
|
|
|
|
// Clear any values for the column
|
|
func (m organizationMods) UnsetID() OrganizationMod {
|
|
return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) {
|
|
o.ID = nil
|
|
})
|
|
}
|
|
|
|
// Generates a random value for the column using the given faker
|
|
// if faker is nil, a default faker is used
|
|
func (m organizationMods) RandomID(f *faker.Faker) OrganizationMod {
|
|
return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) {
|
|
o.ID = func() int32 {
|
|
return random_int32(f)
|
|
}
|
|
})
|
|
}
|
|
|
|
// Set the model columns to this value
|
|
func (m organizationMods) Name(val string) OrganizationMod {
|
|
return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) {
|
|
o.Name = func() string { return val }
|
|
})
|
|
}
|
|
|
|
// Set the Column from the function
|
|
func (m organizationMods) NameFunc(f func() string) OrganizationMod {
|
|
return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) {
|
|
o.Name = f
|
|
})
|
|
}
|
|
|
|
// Clear any values for the column
|
|
func (m organizationMods) UnsetName() OrganizationMod {
|
|
return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) {
|
|
o.Name = nil
|
|
})
|
|
}
|
|
|
|
// Generates a random value for the column using the given faker
|
|
// if faker is nil, a default faker is used
|
|
func (m organizationMods) RandomName(f *faker.Faker) OrganizationMod {
|
|
return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) {
|
|
o.Name = func() string {
|
|
return random_string(f)
|
|
}
|
|
})
|
|
}
|
|
|
|
// Set the model columns to this value
|
|
func (m organizationMods) ArcgisID(val null.Val[string]) OrganizationMod {
|
|
return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) {
|
|
o.ArcgisID = func() null.Val[string] { return val }
|
|
})
|
|
}
|
|
|
|
// Set the Column from the function
|
|
func (m organizationMods) ArcgisIDFunc(f func() null.Val[string]) OrganizationMod {
|
|
return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) {
|
|
o.ArcgisID = f
|
|
})
|
|
}
|
|
|
|
// Clear any values for the column
|
|
func (m organizationMods) UnsetArcgisID() OrganizationMod {
|
|
return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) {
|
|
o.ArcgisID = nil
|
|
})
|
|
}
|
|
|
|
// Generates a random value for the column using the given faker
|
|
// if faker is nil, a default faker is used
|
|
// The generated value is sometimes null
|
|
func (m organizationMods) RandomArcgisID(f *faker.Faker) OrganizationMod {
|
|
return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) {
|
|
o.ArcgisID = func() null.Val[string] {
|
|
if f == nil {
|
|
f = &defaultFaker
|
|
}
|
|
|
|
val := random_string(f)
|
|
return null.From(val)
|
|
}
|
|
})
|
|
}
|
|
|
|
// Generates a random value for the column using the given faker
|
|
// if faker is nil, a default faker is used
|
|
// The generated value is never null
|
|
func (m organizationMods) RandomArcgisIDNotNull(f *faker.Faker) OrganizationMod {
|
|
return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) {
|
|
o.ArcgisID = func() null.Val[string] {
|
|
if f == nil {
|
|
f = &defaultFaker
|
|
}
|
|
|
|
val := random_string(f)
|
|
return null.From(val)
|
|
}
|
|
})
|
|
}
|
|
|
|
// Set the model columns to this value
|
|
func (m organizationMods) ArcgisName(val null.Val[string]) OrganizationMod {
|
|
return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) {
|
|
o.ArcgisName = func() null.Val[string] { return val }
|
|
})
|
|
}
|
|
|
|
// Set the Column from the function
|
|
func (m organizationMods) ArcgisNameFunc(f func() null.Val[string]) OrganizationMod {
|
|
return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) {
|
|
o.ArcgisName = f
|
|
})
|
|
}
|
|
|
|
// Clear any values for the column
|
|
func (m organizationMods) UnsetArcgisName() OrganizationMod {
|
|
return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) {
|
|
o.ArcgisName = nil
|
|
})
|
|
}
|
|
|
|
// Generates a random value for the column using the given faker
|
|
// if faker is nil, a default faker is used
|
|
// The generated value is sometimes null
|
|
func (m organizationMods) RandomArcgisName(f *faker.Faker) OrganizationMod {
|
|
return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) {
|
|
o.ArcgisName = func() null.Val[string] {
|
|
if f == nil {
|
|
f = &defaultFaker
|
|
}
|
|
|
|
val := random_string(f)
|
|
return null.From(val)
|
|
}
|
|
})
|
|
}
|
|
|
|
// Generates a random value for the column using the given faker
|
|
// if faker is nil, a default faker is used
|
|
// The generated value is never null
|
|
func (m organizationMods) RandomArcgisNameNotNull(f *faker.Faker) OrganizationMod {
|
|
return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) {
|
|
o.ArcgisName = func() null.Val[string] {
|
|
if f == nil {
|
|
f = &defaultFaker
|
|
}
|
|
|
|
val := random_string(f)
|
|
return null.From(val)
|
|
}
|
|
})
|
|
}
|
|
|
|
// Set the model columns to this value
|
|
func (m organizationMods) FieldseekerURL(val null.Val[string]) OrganizationMod {
|
|
return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) {
|
|
o.FieldseekerURL = func() null.Val[string] { return val }
|
|
})
|
|
}
|
|
|
|
// Set the Column from the function
|
|
func (m organizationMods) FieldseekerURLFunc(f func() null.Val[string]) OrganizationMod {
|
|
return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) {
|
|
o.FieldseekerURL = f
|
|
})
|
|
}
|
|
|
|
// Clear any values for the column
|
|
func (m organizationMods) UnsetFieldseekerURL() OrganizationMod {
|
|
return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) {
|
|
o.FieldseekerURL = nil
|
|
})
|
|
}
|
|
|
|
// Generates a random value for the column using the given faker
|
|
// if faker is nil, a default faker is used
|
|
// The generated value is sometimes null
|
|
func (m organizationMods) RandomFieldseekerURL(f *faker.Faker) OrganizationMod {
|
|
return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) {
|
|
o.FieldseekerURL = func() null.Val[string] {
|
|
if f == nil {
|
|
f = &defaultFaker
|
|
}
|
|
|
|
val := random_string(f)
|
|
return null.From(val)
|
|
}
|
|
})
|
|
}
|
|
|
|
// Generates a random value for the column using the given faker
|
|
// if faker is nil, a default faker is used
|
|
// The generated value is never null
|
|
func (m organizationMods) RandomFieldseekerURLNotNull(f *faker.Faker) OrganizationMod {
|
|
return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) {
|
|
o.FieldseekerURL = func() null.Val[string] {
|
|
if f == nil {
|
|
f = &defaultFaker
|
|
}
|
|
|
|
val := random_string(f)
|
|
return null.From(val)
|
|
}
|
|
})
|
|
}
|
|
|
|
// Set the model columns to this value
|
|
func (m organizationMods) ImportDistrictGid(val null.Val[int32]) OrganizationMod {
|
|
return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) {
|
|
o.ImportDistrictGid = func() null.Val[int32] { return val }
|
|
})
|
|
}
|
|
|
|
// Set the Column from the function
|
|
func (m organizationMods) ImportDistrictGidFunc(f func() null.Val[int32]) OrganizationMod {
|
|
return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) {
|
|
o.ImportDistrictGid = f
|
|
})
|
|
}
|
|
|
|
// Clear any values for the column
|
|
func (m organizationMods) UnsetImportDistrictGid() OrganizationMod {
|
|
return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) {
|
|
o.ImportDistrictGid = nil
|
|
})
|
|
}
|
|
|
|
// Generates a random value for the column using the given faker
|
|
// if faker is nil, a default faker is used
|
|
// The generated value is sometimes null
|
|
func (m organizationMods) RandomImportDistrictGid(f *faker.Faker) OrganizationMod {
|
|
return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) {
|
|
o.ImportDistrictGid = func() null.Val[int32] {
|
|
if f == nil {
|
|
f = &defaultFaker
|
|
}
|
|
|
|
val := random_int32(f)
|
|
return null.From(val)
|
|
}
|
|
})
|
|
}
|
|
|
|
// Generates a random value for the column using the given faker
|
|
// if faker is nil, a default faker is used
|
|
// The generated value is never null
|
|
func (m organizationMods) RandomImportDistrictGidNotNull(f *faker.Faker) OrganizationMod {
|
|
return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) {
|
|
o.ImportDistrictGid = func() null.Val[int32] {
|
|
if f == nil {
|
|
f = &defaultFaker
|
|
}
|
|
|
|
val := random_int32(f)
|
|
return null.From(val)
|
|
}
|
|
})
|
|
}
|
|
|
|
// Set the model columns to this value
|
|
func (m organizationMods) Website(val null.Val[string]) OrganizationMod {
|
|
return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) {
|
|
o.Website = func() null.Val[string] { return val }
|
|
})
|
|
}
|
|
|
|
// Set the Column from the function
|
|
func (m organizationMods) WebsiteFunc(f func() null.Val[string]) OrganizationMod {
|
|
return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) {
|
|
o.Website = f
|
|
})
|
|
}
|
|
|
|
// Clear any values for the column
|
|
func (m organizationMods) UnsetWebsite() OrganizationMod {
|
|
return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) {
|
|
o.Website = nil
|
|
})
|
|
}
|
|
|
|
// Generates a random value for the column using the given faker
|
|
// if faker is nil, a default faker is used
|
|
// The generated value is sometimes null
|
|
func (m organizationMods) RandomWebsite(f *faker.Faker) OrganizationMod {
|
|
return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) {
|
|
o.Website = func() null.Val[string] {
|
|
if f == nil {
|
|
f = &defaultFaker
|
|
}
|
|
|
|
val := random_string(f)
|
|
return null.From(val)
|
|
}
|
|
})
|
|
}
|
|
|
|
// Generates a random value for the column using the given faker
|
|
// if faker is nil, a default faker is used
|
|
// The generated value is never null
|
|
func (m organizationMods) RandomWebsiteNotNull(f *faker.Faker) OrganizationMod {
|
|
return OrganizationModFunc(func(_ context.Context, o *OrganizationTemplate) {
|
|
o.Website = func() null.Val[string] {
|
|
if f == nil {
|
|
f = &defaultFaker
|
|
}
|
|
|
|
val := random_string(f)
|
|
return null.From(val)
|
|
}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithParentsCascading() OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
if isDone, _ := organizationWithParentsCascadingCtx.Value(ctx); isDone {
|
|
return
|
|
}
|
|
ctx = organizationWithParentsCascadingCtx.WithValue(ctx, true)
|
|
{
|
|
|
|
related := o.f.NewImportDistrictWithContext(ctx, ImportDistrictMods.WithParentsCascading())
|
|
m.WithImportDistrictGidDistrict(related).Apply(ctx, o)
|
|
}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithImportDistrictGidDistrict(rel *ImportDistrictTemplate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.ImportDistrictGidDistrict = &organizationRImportDistrictGidDistrictR{
|
|
o: rel,
|
|
}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithNewImportDistrictGidDistrict(mods ...ImportDistrictMod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewImportDistrictWithContext(ctx, mods...)
|
|
|
|
m.WithImportDistrictGidDistrict(related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithExistingImportDistrictGidDistrict(em *models.ImportDistrict) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.ImportDistrictGidDistrict = &organizationRImportDistrictGidDistrictR{
|
|
o: o.f.FromExistingImportDistrict(em),
|
|
}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithoutImportDistrictGidDistrict() OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.ImportDistrictGidDistrict = nil
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithContainerrelates(number int, related *FieldseekerContainerrelateTemplate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Containerrelates = []*organizationRContainerrelatesR{{
|
|
number: number,
|
|
o: related,
|
|
}}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithNewContainerrelates(number int, mods ...FieldseekerContainerrelateMod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewFieldseekerContainerrelateWithContext(ctx, mods...)
|
|
m.WithContainerrelates(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddContainerrelates(number int, related *FieldseekerContainerrelateTemplate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Containerrelates = append(o.r.Containerrelates, &organizationRContainerrelatesR{
|
|
number: number,
|
|
o: related,
|
|
})
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddNewContainerrelates(number int, mods ...FieldseekerContainerrelateMod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewFieldseekerContainerrelateWithContext(ctx, mods...)
|
|
m.AddContainerrelates(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddExistingContainerrelates(existingModels ...*models.FieldseekerContainerrelate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
for _, em := range existingModels {
|
|
o.r.Containerrelates = append(o.r.Containerrelates, &organizationRContainerrelatesR{
|
|
o: o.f.FromExistingFieldseekerContainerrelate(em),
|
|
})
|
|
}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithoutContainerrelates() OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Containerrelates = nil
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithFieldscoutinglogs(number int, related *FieldseekerFieldscoutinglogTemplate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Fieldscoutinglogs = []*organizationRFieldscoutinglogsR{{
|
|
number: number,
|
|
o: related,
|
|
}}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithNewFieldscoutinglogs(number int, mods ...FieldseekerFieldscoutinglogMod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewFieldseekerFieldscoutinglogWithContext(ctx, mods...)
|
|
m.WithFieldscoutinglogs(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddFieldscoutinglogs(number int, related *FieldseekerFieldscoutinglogTemplate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Fieldscoutinglogs = append(o.r.Fieldscoutinglogs, &organizationRFieldscoutinglogsR{
|
|
number: number,
|
|
o: related,
|
|
})
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddNewFieldscoutinglogs(number int, mods ...FieldseekerFieldscoutinglogMod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewFieldseekerFieldscoutinglogWithContext(ctx, mods...)
|
|
m.AddFieldscoutinglogs(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddExistingFieldscoutinglogs(existingModels ...*models.FieldseekerFieldscoutinglog) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
for _, em := range existingModels {
|
|
o.r.Fieldscoutinglogs = append(o.r.Fieldscoutinglogs, &organizationRFieldscoutinglogsR{
|
|
o: o.f.FromExistingFieldseekerFieldscoutinglog(em),
|
|
})
|
|
}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithoutFieldscoutinglogs() OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Fieldscoutinglogs = nil
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithHabitatrelates(number int, related *FieldseekerHabitatrelateTemplate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Habitatrelates = []*organizationRHabitatrelatesR{{
|
|
number: number,
|
|
o: related,
|
|
}}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithNewHabitatrelates(number int, mods ...FieldseekerHabitatrelateMod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewFieldseekerHabitatrelateWithContext(ctx, mods...)
|
|
m.WithHabitatrelates(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddHabitatrelates(number int, related *FieldseekerHabitatrelateTemplate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Habitatrelates = append(o.r.Habitatrelates, &organizationRHabitatrelatesR{
|
|
number: number,
|
|
o: related,
|
|
})
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddNewHabitatrelates(number int, mods ...FieldseekerHabitatrelateMod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewFieldseekerHabitatrelateWithContext(ctx, mods...)
|
|
m.AddHabitatrelates(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddExistingHabitatrelates(existingModels ...*models.FieldseekerHabitatrelate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
for _, em := range existingModels {
|
|
o.r.Habitatrelates = append(o.r.Habitatrelates, &organizationRHabitatrelatesR{
|
|
o: o.f.FromExistingFieldseekerHabitatrelate(em),
|
|
})
|
|
}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithoutHabitatrelates() OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Habitatrelates = nil
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithInspectionsamples(number int, related *FieldseekerInspectionsampleTemplate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Inspectionsamples = []*organizationRInspectionsamplesR{{
|
|
number: number,
|
|
o: related,
|
|
}}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithNewInspectionsamples(number int, mods ...FieldseekerInspectionsampleMod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewFieldseekerInspectionsampleWithContext(ctx, mods...)
|
|
m.WithInspectionsamples(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddInspectionsamples(number int, related *FieldseekerInspectionsampleTemplate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Inspectionsamples = append(o.r.Inspectionsamples, &organizationRInspectionsamplesR{
|
|
number: number,
|
|
o: related,
|
|
})
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddNewInspectionsamples(number int, mods ...FieldseekerInspectionsampleMod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewFieldseekerInspectionsampleWithContext(ctx, mods...)
|
|
m.AddInspectionsamples(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddExistingInspectionsamples(existingModels ...*models.FieldseekerInspectionsample) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
for _, em := range existingModels {
|
|
o.r.Inspectionsamples = append(o.r.Inspectionsamples, &organizationRInspectionsamplesR{
|
|
o: o.f.FromExistingFieldseekerInspectionsample(em),
|
|
})
|
|
}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithoutInspectionsamples() OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Inspectionsamples = nil
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithInspectionsampledetails(number int, related *FieldseekerInspectionsampledetailTemplate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Inspectionsampledetails = []*organizationRInspectionsampledetailsR{{
|
|
number: number,
|
|
o: related,
|
|
}}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithNewInspectionsampledetails(number int, mods ...FieldseekerInspectionsampledetailMod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewFieldseekerInspectionsampledetailWithContext(ctx, mods...)
|
|
m.WithInspectionsampledetails(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddInspectionsampledetails(number int, related *FieldseekerInspectionsampledetailTemplate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Inspectionsampledetails = append(o.r.Inspectionsampledetails, &organizationRInspectionsampledetailsR{
|
|
number: number,
|
|
o: related,
|
|
})
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddNewInspectionsampledetails(number int, mods ...FieldseekerInspectionsampledetailMod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewFieldseekerInspectionsampledetailWithContext(ctx, mods...)
|
|
m.AddInspectionsampledetails(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddExistingInspectionsampledetails(existingModels ...*models.FieldseekerInspectionsampledetail) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
for _, em := range existingModels {
|
|
o.r.Inspectionsampledetails = append(o.r.Inspectionsampledetails, &organizationRInspectionsampledetailsR{
|
|
o: o.f.FromExistingFieldseekerInspectionsampledetail(em),
|
|
})
|
|
}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithoutInspectionsampledetails() OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Inspectionsampledetails = nil
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithLinelocations(number int, related *FieldseekerLinelocationTemplate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Linelocations = []*organizationRLinelocationsR{{
|
|
number: number,
|
|
o: related,
|
|
}}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithNewLinelocations(number int, mods ...FieldseekerLinelocationMod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewFieldseekerLinelocationWithContext(ctx, mods...)
|
|
m.WithLinelocations(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddLinelocations(number int, related *FieldseekerLinelocationTemplate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Linelocations = append(o.r.Linelocations, &organizationRLinelocationsR{
|
|
number: number,
|
|
o: related,
|
|
})
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddNewLinelocations(number int, mods ...FieldseekerLinelocationMod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewFieldseekerLinelocationWithContext(ctx, mods...)
|
|
m.AddLinelocations(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddExistingLinelocations(existingModels ...*models.FieldseekerLinelocation) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
for _, em := range existingModels {
|
|
o.r.Linelocations = append(o.r.Linelocations, &organizationRLinelocationsR{
|
|
o: o.f.FromExistingFieldseekerLinelocation(em),
|
|
})
|
|
}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithoutLinelocations() OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Linelocations = nil
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithLocationtrackings(number int, related *FieldseekerLocationtrackingTemplate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Locationtrackings = []*organizationRLocationtrackingsR{{
|
|
number: number,
|
|
o: related,
|
|
}}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithNewLocationtrackings(number int, mods ...FieldseekerLocationtrackingMod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewFieldseekerLocationtrackingWithContext(ctx, mods...)
|
|
m.WithLocationtrackings(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddLocationtrackings(number int, related *FieldseekerLocationtrackingTemplate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Locationtrackings = append(o.r.Locationtrackings, &organizationRLocationtrackingsR{
|
|
number: number,
|
|
o: related,
|
|
})
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddNewLocationtrackings(number int, mods ...FieldseekerLocationtrackingMod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewFieldseekerLocationtrackingWithContext(ctx, mods...)
|
|
m.AddLocationtrackings(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddExistingLocationtrackings(existingModels ...*models.FieldseekerLocationtracking) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
for _, em := range existingModels {
|
|
o.r.Locationtrackings = append(o.r.Locationtrackings, &organizationRLocationtrackingsR{
|
|
o: o.f.FromExistingFieldseekerLocationtracking(em),
|
|
})
|
|
}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithoutLocationtrackings() OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Locationtrackings = nil
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithMosquitoinspections(number int, related *FieldseekerMosquitoinspectionTemplate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Mosquitoinspections = []*organizationRMosquitoinspectionsR{{
|
|
number: number,
|
|
o: related,
|
|
}}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithNewMosquitoinspections(number int, mods ...FieldseekerMosquitoinspectionMod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewFieldseekerMosquitoinspectionWithContext(ctx, mods...)
|
|
m.WithMosquitoinspections(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddMosquitoinspections(number int, related *FieldseekerMosquitoinspectionTemplate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Mosquitoinspections = append(o.r.Mosquitoinspections, &organizationRMosquitoinspectionsR{
|
|
number: number,
|
|
o: related,
|
|
})
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddNewMosquitoinspections(number int, mods ...FieldseekerMosquitoinspectionMod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewFieldseekerMosquitoinspectionWithContext(ctx, mods...)
|
|
m.AddMosquitoinspections(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddExistingMosquitoinspections(existingModels ...*models.FieldseekerMosquitoinspection) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
for _, em := range existingModels {
|
|
o.r.Mosquitoinspections = append(o.r.Mosquitoinspections, &organizationRMosquitoinspectionsR{
|
|
o: o.f.FromExistingFieldseekerMosquitoinspection(em),
|
|
})
|
|
}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithoutMosquitoinspections() OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Mosquitoinspections = nil
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithPointlocations(number int, related *FieldseekerPointlocationTemplate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Pointlocations = []*organizationRPointlocationsR{{
|
|
number: number,
|
|
o: related,
|
|
}}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithNewPointlocations(number int, mods ...FieldseekerPointlocationMod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewFieldseekerPointlocationWithContext(ctx, mods...)
|
|
m.WithPointlocations(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddPointlocations(number int, related *FieldseekerPointlocationTemplate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Pointlocations = append(o.r.Pointlocations, &organizationRPointlocationsR{
|
|
number: number,
|
|
o: related,
|
|
})
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddNewPointlocations(number int, mods ...FieldseekerPointlocationMod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewFieldseekerPointlocationWithContext(ctx, mods...)
|
|
m.AddPointlocations(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddExistingPointlocations(existingModels ...*models.FieldseekerPointlocation) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
for _, em := range existingModels {
|
|
o.r.Pointlocations = append(o.r.Pointlocations, &organizationRPointlocationsR{
|
|
o: o.f.FromExistingFieldseekerPointlocation(em),
|
|
})
|
|
}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithoutPointlocations() OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Pointlocations = nil
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithPolygonlocations(number int, related *FieldseekerPolygonlocationTemplate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Polygonlocations = []*organizationRPolygonlocationsR{{
|
|
number: number,
|
|
o: related,
|
|
}}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithNewPolygonlocations(number int, mods ...FieldseekerPolygonlocationMod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewFieldseekerPolygonlocationWithContext(ctx, mods...)
|
|
m.WithPolygonlocations(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddPolygonlocations(number int, related *FieldseekerPolygonlocationTemplate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Polygonlocations = append(o.r.Polygonlocations, &organizationRPolygonlocationsR{
|
|
number: number,
|
|
o: related,
|
|
})
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddNewPolygonlocations(number int, mods ...FieldseekerPolygonlocationMod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewFieldseekerPolygonlocationWithContext(ctx, mods...)
|
|
m.AddPolygonlocations(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddExistingPolygonlocations(existingModels ...*models.FieldseekerPolygonlocation) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
for _, em := range existingModels {
|
|
o.r.Polygonlocations = append(o.r.Polygonlocations, &organizationRPolygonlocationsR{
|
|
o: o.f.FromExistingFieldseekerPolygonlocation(em),
|
|
})
|
|
}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithoutPolygonlocations() OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Polygonlocations = nil
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithPools(number int, related *FieldseekerPoolTemplate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Pools = []*organizationRPoolsR{{
|
|
number: number,
|
|
o: related,
|
|
}}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithNewPools(number int, mods ...FieldseekerPoolMod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewFieldseekerPoolWithContext(ctx, mods...)
|
|
m.WithPools(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddPools(number int, related *FieldseekerPoolTemplate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Pools = append(o.r.Pools, &organizationRPoolsR{
|
|
number: number,
|
|
o: related,
|
|
})
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddNewPools(number int, mods ...FieldseekerPoolMod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewFieldseekerPoolWithContext(ctx, mods...)
|
|
m.AddPools(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddExistingPools(existingModels ...*models.FieldseekerPool) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
for _, em := range existingModels {
|
|
o.r.Pools = append(o.r.Pools, &organizationRPoolsR{
|
|
o: o.f.FromExistingFieldseekerPool(em),
|
|
})
|
|
}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithoutPools() OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Pools = nil
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithPooldetails(number int, related *FieldseekerPooldetailTemplate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Pooldetails = []*organizationRPooldetailsR{{
|
|
number: number,
|
|
o: related,
|
|
}}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithNewPooldetails(number int, mods ...FieldseekerPooldetailMod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewFieldseekerPooldetailWithContext(ctx, mods...)
|
|
m.WithPooldetails(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddPooldetails(number int, related *FieldseekerPooldetailTemplate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Pooldetails = append(o.r.Pooldetails, &organizationRPooldetailsR{
|
|
number: number,
|
|
o: related,
|
|
})
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddNewPooldetails(number int, mods ...FieldseekerPooldetailMod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewFieldseekerPooldetailWithContext(ctx, mods...)
|
|
m.AddPooldetails(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddExistingPooldetails(existingModels ...*models.FieldseekerPooldetail) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
for _, em := range existingModels {
|
|
o.r.Pooldetails = append(o.r.Pooldetails, &organizationRPooldetailsR{
|
|
o: o.f.FromExistingFieldseekerPooldetail(em),
|
|
})
|
|
}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithoutPooldetails() OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Pooldetails = nil
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithProposedtreatmentareas(number int, related *FieldseekerProposedtreatmentareaTemplate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Proposedtreatmentareas = []*organizationRProposedtreatmentareasR{{
|
|
number: number,
|
|
o: related,
|
|
}}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithNewProposedtreatmentareas(number int, mods ...FieldseekerProposedtreatmentareaMod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewFieldseekerProposedtreatmentareaWithContext(ctx, mods...)
|
|
m.WithProposedtreatmentareas(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddProposedtreatmentareas(number int, related *FieldseekerProposedtreatmentareaTemplate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Proposedtreatmentareas = append(o.r.Proposedtreatmentareas, &organizationRProposedtreatmentareasR{
|
|
number: number,
|
|
o: related,
|
|
})
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddNewProposedtreatmentareas(number int, mods ...FieldseekerProposedtreatmentareaMod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewFieldseekerProposedtreatmentareaWithContext(ctx, mods...)
|
|
m.AddProposedtreatmentareas(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddExistingProposedtreatmentareas(existingModels ...*models.FieldseekerProposedtreatmentarea) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
for _, em := range existingModels {
|
|
o.r.Proposedtreatmentareas = append(o.r.Proposedtreatmentareas, &organizationRProposedtreatmentareasR{
|
|
o: o.f.FromExistingFieldseekerProposedtreatmentarea(em),
|
|
})
|
|
}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithoutProposedtreatmentareas() OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Proposedtreatmentareas = nil
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithQamosquitoinspections(number int, related *FieldseekerQamosquitoinspectionTemplate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Qamosquitoinspections = []*organizationRQamosquitoinspectionsR{{
|
|
number: number,
|
|
o: related,
|
|
}}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithNewQamosquitoinspections(number int, mods ...FieldseekerQamosquitoinspectionMod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewFieldseekerQamosquitoinspectionWithContext(ctx, mods...)
|
|
m.WithQamosquitoinspections(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddQamosquitoinspections(number int, related *FieldseekerQamosquitoinspectionTemplate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Qamosquitoinspections = append(o.r.Qamosquitoinspections, &organizationRQamosquitoinspectionsR{
|
|
number: number,
|
|
o: related,
|
|
})
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddNewQamosquitoinspections(number int, mods ...FieldseekerQamosquitoinspectionMod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewFieldseekerQamosquitoinspectionWithContext(ctx, mods...)
|
|
m.AddQamosquitoinspections(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddExistingQamosquitoinspections(existingModels ...*models.FieldseekerQamosquitoinspection) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
for _, em := range existingModels {
|
|
o.r.Qamosquitoinspections = append(o.r.Qamosquitoinspections, &organizationRQamosquitoinspectionsR{
|
|
o: o.f.FromExistingFieldseekerQamosquitoinspection(em),
|
|
})
|
|
}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithoutQamosquitoinspections() OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Qamosquitoinspections = nil
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithRodentlocations(number int, related *FieldseekerRodentlocationTemplate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Rodentlocations = []*organizationRRodentlocationsR{{
|
|
number: number,
|
|
o: related,
|
|
}}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithNewRodentlocations(number int, mods ...FieldseekerRodentlocationMod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewFieldseekerRodentlocationWithContext(ctx, mods...)
|
|
m.WithRodentlocations(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddRodentlocations(number int, related *FieldseekerRodentlocationTemplate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Rodentlocations = append(o.r.Rodentlocations, &organizationRRodentlocationsR{
|
|
number: number,
|
|
o: related,
|
|
})
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddNewRodentlocations(number int, mods ...FieldseekerRodentlocationMod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewFieldseekerRodentlocationWithContext(ctx, mods...)
|
|
m.AddRodentlocations(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddExistingRodentlocations(existingModels ...*models.FieldseekerRodentlocation) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
for _, em := range existingModels {
|
|
o.r.Rodentlocations = append(o.r.Rodentlocations, &organizationRRodentlocationsR{
|
|
o: o.f.FromExistingFieldseekerRodentlocation(em),
|
|
})
|
|
}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithoutRodentlocations() OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Rodentlocations = nil
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithSamplecollections(number int, related *FieldseekerSamplecollectionTemplate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Samplecollections = []*organizationRSamplecollectionsR{{
|
|
number: number,
|
|
o: related,
|
|
}}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithNewSamplecollections(number int, mods ...FieldseekerSamplecollectionMod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewFieldseekerSamplecollectionWithContext(ctx, mods...)
|
|
m.WithSamplecollections(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddSamplecollections(number int, related *FieldseekerSamplecollectionTemplate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Samplecollections = append(o.r.Samplecollections, &organizationRSamplecollectionsR{
|
|
number: number,
|
|
o: related,
|
|
})
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddNewSamplecollections(number int, mods ...FieldseekerSamplecollectionMod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewFieldseekerSamplecollectionWithContext(ctx, mods...)
|
|
m.AddSamplecollections(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddExistingSamplecollections(existingModels ...*models.FieldseekerSamplecollection) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
for _, em := range existingModels {
|
|
o.r.Samplecollections = append(o.r.Samplecollections, &organizationRSamplecollectionsR{
|
|
o: o.f.FromExistingFieldseekerSamplecollection(em),
|
|
})
|
|
}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithoutSamplecollections() OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Samplecollections = nil
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithSamplelocations(number int, related *FieldseekerSamplelocationTemplate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Samplelocations = []*organizationRSamplelocationsR{{
|
|
number: number,
|
|
o: related,
|
|
}}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithNewSamplelocations(number int, mods ...FieldseekerSamplelocationMod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewFieldseekerSamplelocationWithContext(ctx, mods...)
|
|
m.WithSamplelocations(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddSamplelocations(number int, related *FieldseekerSamplelocationTemplate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Samplelocations = append(o.r.Samplelocations, &organizationRSamplelocationsR{
|
|
number: number,
|
|
o: related,
|
|
})
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddNewSamplelocations(number int, mods ...FieldseekerSamplelocationMod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewFieldseekerSamplelocationWithContext(ctx, mods...)
|
|
m.AddSamplelocations(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddExistingSamplelocations(existingModels ...*models.FieldseekerSamplelocation) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
for _, em := range existingModels {
|
|
o.r.Samplelocations = append(o.r.Samplelocations, &organizationRSamplelocationsR{
|
|
o: o.f.FromExistingFieldseekerSamplelocation(em),
|
|
})
|
|
}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithoutSamplelocations() OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Samplelocations = nil
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithServicerequests(number int, related *FieldseekerServicerequestTemplate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Servicerequests = []*organizationRServicerequestsR{{
|
|
number: number,
|
|
o: related,
|
|
}}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithNewServicerequests(number int, mods ...FieldseekerServicerequestMod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewFieldseekerServicerequestWithContext(ctx, mods...)
|
|
m.WithServicerequests(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddServicerequests(number int, related *FieldseekerServicerequestTemplate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Servicerequests = append(o.r.Servicerequests, &organizationRServicerequestsR{
|
|
number: number,
|
|
o: related,
|
|
})
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddNewServicerequests(number int, mods ...FieldseekerServicerequestMod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewFieldseekerServicerequestWithContext(ctx, mods...)
|
|
m.AddServicerequests(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddExistingServicerequests(existingModels ...*models.FieldseekerServicerequest) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
for _, em := range existingModels {
|
|
o.r.Servicerequests = append(o.r.Servicerequests, &organizationRServicerequestsR{
|
|
o: o.f.FromExistingFieldseekerServicerequest(em),
|
|
})
|
|
}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithoutServicerequests() OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Servicerequests = nil
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithSpeciesabundances(number int, related *FieldseekerSpeciesabundanceTemplate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Speciesabundances = []*organizationRSpeciesabundancesR{{
|
|
number: number,
|
|
o: related,
|
|
}}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithNewSpeciesabundances(number int, mods ...FieldseekerSpeciesabundanceMod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewFieldseekerSpeciesabundanceWithContext(ctx, mods...)
|
|
m.WithSpeciesabundances(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddSpeciesabundances(number int, related *FieldseekerSpeciesabundanceTemplate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Speciesabundances = append(o.r.Speciesabundances, &organizationRSpeciesabundancesR{
|
|
number: number,
|
|
o: related,
|
|
})
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddNewSpeciesabundances(number int, mods ...FieldseekerSpeciesabundanceMod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewFieldseekerSpeciesabundanceWithContext(ctx, mods...)
|
|
m.AddSpeciesabundances(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddExistingSpeciesabundances(existingModels ...*models.FieldseekerSpeciesabundance) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
for _, em := range existingModels {
|
|
o.r.Speciesabundances = append(o.r.Speciesabundances, &organizationRSpeciesabundancesR{
|
|
o: o.f.FromExistingFieldseekerSpeciesabundance(em),
|
|
})
|
|
}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithoutSpeciesabundances() OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Speciesabundances = nil
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithStormdrains(number int, related *FieldseekerStormdrainTemplate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Stormdrains = []*organizationRStormdrainsR{{
|
|
number: number,
|
|
o: related,
|
|
}}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithNewStormdrains(number int, mods ...FieldseekerStormdrainMod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewFieldseekerStormdrainWithContext(ctx, mods...)
|
|
m.WithStormdrains(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddStormdrains(number int, related *FieldseekerStormdrainTemplate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Stormdrains = append(o.r.Stormdrains, &organizationRStormdrainsR{
|
|
number: number,
|
|
o: related,
|
|
})
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddNewStormdrains(number int, mods ...FieldseekerStormdrainMod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewFieldseekerStormdrainWithContext(ctx, mods...)
|
|
m.AddStormdrains(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddExistingStormdrains(existingModels ...*models.FieldseekerStormdrain) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
for _, em := range existingModels {
|
|
o.r.Stormdrains = append(o.r.Stormdrains, &organizationRStormdrainsR{
|
|
o: o.f.FromExistingFieldseekerStormdrain(em),
|
|
})
|
|
}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithoutStormdrains() OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Stormdrains = nil
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithTimecards(number int, related *FieldseekerTimecardTemplate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Timecards = []*organizationRTimecardsR{{
|
|
number: number,
|
|
o: related,
|
|
}}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithNewTimecards(number int, mods ...FieldseekerTimecardMod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewFieldseekerTimecardWithContext(ctx, mods...)
|
|
m.WithTimecards(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddTimecards(number int, related *FieldseekerTimecardTemplate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Timecards = append(o.r.Timecards, &organizationRTimecardsR{
|
|
number: number,
|
|
o: related,
|
|
})
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddNewTimecards(number int, mods ...FieldseekerTimecardMod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewFieldseekerTimecardWithContext(ctx, mods...)
|
|
m.AddTimecards(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddExistingTimecards(existingModels ...*models.FieldseekerTimecard) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
for _, em := range existingModels {
|
|
o.r.Timecards = append(o.r.Timecards, &organizationRTimecardsR{
|
|
o: o.f.FromExistingFieldseekerTimecard(em),
|
|
})
|
|
}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithoutTimecards() OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Timecards = nil
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithTrapdata(number int, related *FieldseekerTrapdatumTemplate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Trapdata = []*organizationRTrapdataR{{
|
|
number: number,
|
|
o: related,
|
|
}}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithNewTrapdata(number int, mods ...FieldseekerTrapdatumMod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewFieldseekerTrapdatumWithContext(ctx, mods...)
|
|
m.WithTrapdata(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddTrapdata(number int, related *FieldseekerTrapdatumTemplate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Trapdata = append(o.r.Trapdata, &organizationRTrapdataR{
|
|
number: number,
|
|
o: related,
|
|
})
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddNewTrapdata(number int, mods ...FieldseekerTrapdatumMod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewFieldseekerTrapdatumWithContext(ctx, mods...)
|
|
m.AddTrapdata(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddExistingTrapdata(existingModels ...*models.FieldseekerTrapdatum) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
for _, em := range existingModels {
|
|
o.r.Trapdata = append(o.r.Trapdata, &organizationRTrapdataR{
|
|
o: o.f.FromExistingFieldseekerTrapdatum(em),
|
|
})
|
|
}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithoutTrapdata() OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Trapdata = nil
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithTraplocations(number int, related *FieldseekerTraplocationTemplate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Traplocations = []*organizationRTraplocationsR{{
|
|
number: number,
|
|
o: related,
|
|
}}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithNewTraplocations(number int, mods ...FieldseekerTraplocationMod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewFieldseekerTraplocationWithContext(ctx, mods...)
|
|
m.WithTraplocations(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddTraplocations(number int, related *FieldseekerTraplocationTemplate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Traplocations = append(o.r.Traplocations, &organizationRTraplocationsR{
|
|
number: number,
|
|
o: related,
|
|
})
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddNewTraplocations(number int, mods ...FieldseekerTraplocationMod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewFieldseekerTraplocationWithContext(ctx, mods...)
|
|
m.AddTraplocations(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddExistingTraplocations(existingModels ...*models.FieldseekerTraplocation) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
for _, em := range existingModels {
|
|
o.r.Traplocations = append(o.r.Traplocations, &organizationRTraplocationsR{
|
|
o: o.f.FromExistingFieldseekerTraplocation(em),
|
|
})
|
|
}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithoutTraplocations() OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Traplocations = nil
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithTreatments(number int, related *FieldseekerTreatmentTemplate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Treatments = []*organizationRTreatmentsR{{
|
|
number: number,
|
|
o: related,
|
|
}}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithNewTreatments(number int, mods ...FieldseekerTreatmentMod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewFieldseekerTreatmentWithContext(ctx, mods...)
|
|
m.WithTreatments(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddTreatments(number int, related *FieldseekerTreatmentTemplate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Treatments = append(o.r.Treatments, &organizationRTreatmentsR{
|
|
number: number,
|
|
o: related,
|
|
})
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddNewTreatments(number int, mods ...FieldseekerTreatmentMod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewFieldseekerTreatmentWithContext(ctx, mods...)
|
|
m.AddTreatments(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddExistingTreatments(existingModels ...*models.FieldseekerTreatment) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
for _, em := range existingModels {
|
|
o.r.Treatments = append(o.r.Treatments, &organizationRTreatmentsR{
|
|
o: o.f.FromExistingFieldseekerTreatment(em),
|
|
})
|
|
}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithoutTreatments() OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Treatments = nil
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithTreatmentareas(number int, related *FieldseekerTreatmentareaTemplate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Treatmentareas = []*organizationRTreatmentareasR{{
|
|
number: number,
|
|
o: related,
|
|
}}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithNewTreatmentareas(number int, mods ...FieldseekerTreatmentareaMod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewFieldseekerTreatmentareaWithContext(ctx, mods...)
|
|
m.WithTreatmentareas(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddTreatmentareas(number int, related *FieldseekerTreatmentareaTemplate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Treatmentareas = append(o.r.Treatmentareas, &organizationRTreatmentareasR{
|
|
number: number,
|
|
o: related,
|
|
})
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddNewTreatmentareas(number int, mods ...FieldseekerTreatmentareaMod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewFieldseekerTreatmentareaWithContext(ctx, mods...)
|
|
m.AddTreatmentareas(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddExistingTreatmentareas(existingModels ...*models.FieldseekerTreatmentarea) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
for _, em := range existingModels {
|
|
o.r.Treatmentareas = append(o.r.Treatmentareas, &organizationRTreatmentareasR{
|
|
o: o.f.FromExistingFieldseekerTreatmentarea(em),
|
|
})
|
|
}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithoutTreatmentareas() OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Treatmentareas = nil
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithZones(number int, related *FieldseekerZoneTemplate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Zones = []*organizationRZonesR{{
|
|
number: number,
|
|
o: related,
|
|
}}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithNewZones(number int, mods ...FieldseekerZoneMod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewFieldseekerZoneWithContext(ctx, mods...)
|
|
m.WithZones(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddZones(number int, related *FieldseekerZoneTemplate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Zones = append(o.r.Zones, &organizationRZonesR{
|
|
number: number,
|
|
o: related,
|
|
})
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddNewZones(number int, mods ...FieldseekerZoneMod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewFieldseekerZoneWithContext(ctx, mods...)
|
|
m.AddZones(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddExistingZones(existingModels ...*models.FieldseekerZone) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
for _, em := range existingModels {
|
|
o.r.Zones = append(o.r.Zones, &organizationRZonesR{
|
|
o: o.f.FromExistingFieldseekerZone(em),
|
|
})
|
|
}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithoutZones() OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Zones = nil
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithZones2s(number int, related *FieldseekerZones2Template) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Zones2s = []*organizationRZones2sR{{
|
|
number: number,
|
|
o: related,
|
|
}}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithNewZones2s(number int, mods ...FieldseekerZones2Mod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewFieldseekerZones2WithContext(ctx, mods...)
|
|
m.WithZones2s(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddZones2s(number int, related *FieldseekerZones2Template) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Zones2s = append(o.r.Zones2s, &organizationRZones2sR{
|
|
number: number,
|
|
o: related,
|
|
})
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddNewZones2s(number int, mods ...FieldseekerZones2Mod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewFieldseekerZones2WithContext(ctx, mods...)
|
|
m.AddZones2s(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddExistingZones2s(existingModels ...*models.FieldseekerZones2) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
for _, em := range existingModels {
|
|
o.r.Zones2s = append(o.r.Zones2s, &organizationRZones2sR{
|
|
o: o.f.FromExistingFieldseekerZones2(em),
|
|
})
|
|
}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithoutZones2s() OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.Zones2s = nil
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithFieldseekerSyncs(number int, related *FieldseekerSyncTemplate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.FieldseekerSyncs = []*organizationRFieldseekerSyncsR{{
|
|
number: number,
|
|
o: related,
|
|
}}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithNewFieldseekerSyncs(number int, mods ...FieldseekerSyncMod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewFieldseekerSyncWithContext(ctx, mods...)
|
|
m.WithFieldseekerSyncs(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddFieldseekerSyncs(number int, related *FieldseekerSyncTemplate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.FieldseekerSyncs = append(o.r.FieldseekerSyncs, &organizationRFieldseekerSyncsR{
|
|
number: number,
|
|
o: related,
|
|
})
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddNewFieldseekerSyncs(number int, mods ...FieldseekerSyncMod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewFieldseekerSyncWithContext(ctx, mods...)
|
|
m.AddFieldseekerSyncs(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddExistingFieldseekerSyncs(existingModels ...*models.FieldseekerSync) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
for _, em := range existingModels {
|
|
o.r.FieldseekerSyncs = append(o.r.FieldseekerSyncs, &organizationRFieldseekerSyncsR{
|
|
o: o.f.FromExistingFieldseekerSync(em),
|
|
})
|
|
}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithoutFieldseekerSyncs() OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.FieldseekerSyncs = nil
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithH3Aggregations(number int, related *H3AggregationTemplate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.H3Aggregations = []*organizationRH3AggregationsR{{
|
|
number: number,
|
|
o: related,
|
|
}}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithNewH3Aggregations(number int, mods ...H3AggregationMod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewH3AggregationWithContext(ctx, mods...)
|
|
m.WithH3Aggregations(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddH3Aggregations(number int, related *H3AggregationTemplate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.H3Aggregations = append(o.r.H3Aggregations, &organizationRH3AggregationsR{
|
|
number: number,
|
|
o: related,
|
|
})
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddNewH3Aggregations(number int, mods ...H3AggregationMod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewH3AggregationWithContext(ctx, mods...)
|
|
m.AddH3Aggregations(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddExistingH3Aggregations(existingModels ...*models.H3Aggregation) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
for _, em := range existingModels {
|
|
o.r.H3Aggregations = append(o.r.H3Aggregations, &organizationRH3AggregationsR{
|
|
o: o.f.FromExistingH3Aggregation(em),
|
|
})
|
|
}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithoutH3Aggregations() OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.H3Aggregations = nil
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithNoteAudios(number int, related *NoteAudioTemplate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.NoteAudios = []*organizationRNoteAudiosR{{
|
|
number: number,
|
|
o: related,
|
|
}}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithNewNoteAudios(number int, mods ...NoteAudioMod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewNoteAudioWithContext(ctx, mods...)
|
|
m.WithNoteAudios(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddNoteAudios(number int, related *NoteAudioTemplate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.NoteAudios = append(o.r.NoteAudios, &organizationRNoteAudiosR{
|
|
number: number,
|
|
o: related,
|
|
})
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddNewNoteAudios(number int, mods ...NoteAudioMod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewNoteAudioWithContext(ctx, mods...)
|
|
m.AddNoteAudios(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddExistingNoteAudios(existingModels ...*models.NoteAudio) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
for _, em := range existingModels {
|
|
o.r.NoteAudios = append(o.r.NoteAudios, &organizationRNoteAudiosR{
|
|
o: o.f.FromExistingNoteAudio(em),
|
|
})
|
|
}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithoutNoteAudios() OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.NoteAudios = nil
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithNoteImages(number int, related *NoteImageTemplate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.NoteImages = []*organizationRNoteImagesR{{
|
|
number: number,
|
|
o: related,
|
|
}}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithNewNoteImages(number int, mods ...NoteImageMod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewNoteImageWithContext(ctx, mods...)
|
|
m.WithNoteImages(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddNoteImages(number int, related *NoteImageTemplate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.NoteImages = append(o.r.NoteImages, &organizationRNoteImagesR{
|
|
number: number,
|
|
o: related,
|
|
})
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddNewNoteImages(number int, mods ...NoteImageMod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewNoteImageWithContext(ctx, mods...)
|
|
m.AddNoteImages(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddExistingNoteImages(existingModels ...*models.NoteImage) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
for _, em := range existingModels {
|
|
o.r.NoteImages = append(o.r.NoteImages, &organizationRNoteImagesR{
|
|
o: o.f.FromExistingNoteImage(em),
|
|
})
|
|
}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithoutNoteImages() OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.NoteImages = nil
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithUser(number int, related *UserTemplate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.User = []*organizationRUserR{{
|
|
number: number,
|
|
o: related,
|
|
}}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithNewUser(number int, mods ...UserMod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewUserWithContext(ctx, mods...)
|
|
m.WithUser(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddUser(number int, related *UserTemplate) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.User = append(o.r.User, &organizationRUserR{
|
|
number: number,
|
|
o: related,
|
|
})
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddNewUser(number int, mods ...UserMod) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
related := o.f.NewUserWithContext(ctx, mods...)
|
|
m.AddUser(number, related).Apply(ctx, o)
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) AddExistingUser(existingModels ...*models.User) OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
for _, em := range existingModels {
|
|
o.r.User = append(o.r.User, &organizationRUserR{
|
|
o: o.f.FromExistingUser(em),
|
|
})
|
|
}
|
|
})
|
|
}
|
|
|
|
func (m organizationMods) WithoutUser() OrganizationMod {
|
|
return OrganizationModFunc(func(ctx context.Context, o *OrganizationTemplate) {
|
|
o.r.User = nil
|
|
})
|
|
}
|