// Code generated by BobGen mysql v0.42.0. DO NOT EDIT. // This file is meant to be re-generated in place and/or deleted at any time. package models import ( "context" "fmt" "io" "time" "github.com/aarondl/opt/null" "github.com/aarondl/opt/omit" "github.com/aarondl/opt/omitnull" "github.com/stephenafamo/bob" "github.com/stephenafamo/bob/dialect/mysql" "github.com/stephenafamo/bob/dialect/mysql/dialect" "github.com/stephenafamo/bob/dialect/mysql/dm" "github.com/stephenafamo/bob/dialect/mysql/sm" "github.com/stephenafamo/bob/dialect/mysql/um" "github.com/stephenafamo/bob/expr" "github.com/stephenafamo/bob/mods" "github.com/stephenafamo/bob/orm" ) // LocationsPackage is an object representing the database table. type LocationsPackage struct { ID int32 `db:"id,pk,autoincr" ` UUID string `db:"uuid" ` CurrentPath string `db:"current_path" ` PointerFilePath null.Val[string] `db:"pointer_file_path" ` Size int64 `db:"size" ` PackageType string `db:"package_type" ` Status string `db:"status" ` CurrentLocationID string `db:"current_location_id" ` OriginPipelineID null.Val[string] `db:"origin_pipeline_id" ` PointerFileLocationID null.Val[string] `db:"pointer_file_location_id" ` MiscAttributes null.Val[string] `db:"misc_attributes" ` Description null.Val[string] `db:"description" ` EncryptionKeyFingerprint null.Val[string] `db:"encryption_key_fingerprint" ` ReplicatedPackageID null.Val[string] `db:"replicated_package_id" ` StoredDate null.Val[time.Time] `db:"stored_date" ` Checksum null.Val[string] `db:"checksum" ` ChecksumAlgorithm null.Val[string] `db:"checksum_algorithm" ` R locationsPackageR `db:"-" ` } // LocationsPackageSlice is an alias for a slice of pointers to LocationsPackage. // This should almost always be used instead of []*LocationsPackage. type LocationsPackageSlice []*LocationsPackage // LocationsPackages contains methods to work with the locations_package table var LocationsPackages = mysql.NewTablex[*LocationsPackage, LocationsPackageSlice, *LocationsPackageSetter]("locations_package", buildLocationsPackageColumns("locations_package"), []string{"id"}, []string{"uuid"}) // LocationsPackagesQuery is a query on the locations_package table type LocationsPackagesQuery = *mysql.ViewQuery[*LocationsPackage, LocationsPackageSlice] // locationsPackageR is where relationships are stored. type locationsPackageR struct { PackageLocationsEvents LocationsEventSlice // locations_event_package_id_50db610f_fk_locations_package_uuid PackageLocationsFiles LocationsFileSlice // locations_file_package_id_dd478d69_fk_locations_package_id PackageLocationsFixitylogs LocationsFixitylogSlice // locations_fixitylog_package_id_0201e98f_fk_locations CurrentLocationLocationsLocation *LocationsLocation // locations_package_current_location_id_c8f7daee_fk_locations OriginPipelineLocationsPipeline *LocationsPipeline // locations_package_origin_pipeline_id_9f8d6473_fk_locations PointerFileLocationLocationsLocation *LocationsLocation // locations_package_pointer_file_locatio_2adf5d3c_fk_locations FromPackageLocationsPackageRelatedPackages LocationsPackageRelatedPackageSlice // locations_package_re_from_package_id_eab8b60c_fk_locations ToPackageLocationsPackageRelatedPackages LocationsPackageRelatedPackageSlice // locations_package_re_to_package_id_7a32b99c_fk_locations ReplicatedPackage *LocationsPackage // locations_package_replicated_package_i_6db19821_fk_locations ReverseReplicatedPackages LocationsPackageSlice // locations_package_replicated_package_i_6db19821_fk_locations__self_join_reverse PackageLocationsPackagedownloadtasks LocationsPackagedownloadtaskSlice // locations_packagedow_package_id_488c7751_fk_locations } func buildLocationsPackageColumns(alias string) locationsPackageColumns { return locationsPackageColumns{ ColumnsExpr: expr.NewColumnsExpr( "id", "uuid", "current_path", "pointer_file_path", "size", "package_type", "status", "current_location_id", "origin_pipeline_id", "pointer_file_location_id", "misc_attributes", "description", "encryption_key_fingerprint", "replicated_package_id", "stored_date", "checksum", "checksum_algorithm", ).WithParent("locations_package"), tableAlias: alias, ID: mysql.Quote(alias, "id"), UUID: mysql.Quote(alias, "uuid"), CurrentPath: mysql.Quote(alias, "current_path"), PointerFilePath: mysql.Quote(alias, "pointer_file_path"), Size: mysql.Quote(alias, "size"), PackageType: mysql.Quote(alias, "package_type"), Status: mysql.Quote(alias, "status"), CurrentLocationID: mysql.Quote(alias, "current_location_id"), OriginPipelineID: mysql.Quote(alias, "origin_pipeline_id"), PointerFileLocationID: mysql.Quote(alias, "pointer_file_location_id"), MiscAttributes: mysql.Quote(alias, "misc_attributes"), Description: mysql.Quote(alias, "description"), EncryptionKeyFingerprint: mysql.Quote(alias, "encryption_key_fingerprint"), ReplicatedPackageID: mysql.Quote(alias, "replicated_package_id"), StoredDate: mysql.Quote(alias, "stored_date"), Checksum: mysql.Quote(alias, "checksum"), ChecksumAlgorithm: mysql.Quote(alias, "checksum_algorithm"), } } type locationsPackageColumns struct { expr.ColumnsExpr tableAlias string ID mysql.Expression UUID mysql.Expression CurrentPath mysql.Expression PointerFilePath mysql.Expression Size mysql.Expression PackageType mysql.Expression Status mysql.Expression CurrentLocationID mysql.Expression OriginPipelineID mysql.Expression PointerFileLocationID mysql.Expression MiscAttributes mysql.Expression Description mysql.Expression EncryptionKeyFingerprint mysql.Expression ReplicatedPackageID mysql.Expression StoredDate mysql.Expression Checksum mysql.Expression ChecksumAlgorithm mysql.Expression } func (c locationsPackageColumns) Alias() string { return c.tableAlias } func (locationsPackageColumns) AliasedAs(alias string) locationsPackageColumns { return buildLocationsPackageColumns(alias) } // LocationsPackageSetter is used for insert/upsert/update operations // All values are optional, and do not have to be set // Generated columns are not included type LocationsPackageSetter struct { ID omit.Val[int32] `db:"id,pk,autoincr" ` UUID omit.Val[string] `db:"uuid" ` CurrentPath omit.Val[string] `db:"current_path" ` PointerFilePath omitnull.Val[string] `db:"pointer_file_path" ` Size omit.Val[int64] `db:"size" ` PackageType omit.Val[string] `db:"package_type" ` Status omit.Val[string] `db:"status" ` CurrentLocationID omit.Val[string] `db:"current_location_id" ` OriginPipelineID omitnull.Val[string] `db:"origin_pipeline_id" ` PointerFileLocationID omitnull.Val[string] `db:"pointer_file_location_id" ` MiscAttributes omitnull.Val[string] `db:"misc_attributes" ` Description omitnull.Val[string] `db:"description" ` EncryptionKeyFingerprint omitnull.Val[string] `db:"encryption_key_fingerprint" ` ReplicatedPackageID omitnull.Val[string] `db:"replicated_package_id" ` StoredDate omitnull.Val[time.Time] `db:"stored_date" ` Checksum omitnull.Val[string] `db:"checksum" ` ChecksumAlgorithm omitnull.Val[string] `db:"checksum_algorithm" ` } func (s LocationsPackageSetter) SetColumns() []string { vals := make([]string, 0, 17) if s.ID.IsValue() { vals = append(vals, "id") } if s.UUID.IsValue() { vals = append(vals, "uuid") } if s.CurrentPath.IsValue() { vals = append(vals, "current_path") } if !s.PointerFilePath.IsUnset() { vals = append(vals, "pointer_file_path") } if s.Size.IsValue() { vals = append(vals, "size") } if s.PackageType.IsValue() { vals = append(vals, "package_type") } if s.Status.IsValue() { vals = append(vals, "status") } if s.CurrentLocationID.IsValue() { vals = append(vals, "current_location_id") } if !s.OriginPipelineID.IsUnset() { vals = append(vals, "origin_pipeline_id") } if !s.PointerFileLocationID.IsUnset() { vals = append(vals, "pointer_file_location_id") } if !s.MiscAttributes.IsUnset() { vals = append(vals, "misc_attributes") } if !s.Description.IsUnset() { vals = append(vals, "description") } if !s.EncryptionKeyFingerprint.IsUnset() { vals = append(vals, "encryption_key_fingerprint") } if !s.ReplicatedPackageID.IsUnset() { vals = append(vals, "replicated_package_id") } if !s.StoredDate.IsUnset() { vals = append(vals, "stored_date") } if !s.Checksum.IsUnset() { vals = append(vals, "checksum") } if !s.ChecksumAlgorithm.IsUnset() { vals = append(vals, "checksum_algorithm") } return vals } func (s LocationsPackageSetter) Overwrite(t *LocationsPackage) { if s.ID.IsValue() { t.ID = s.ID.MustGet() } if s.UUID.IsValue() { t.UUID = s.UUID.MustGet() } if s.CurrentPath.IsValue() { t.CurrentPath = s.CurrentPath.MustGet() } if !s.PointerFilePath.IsUnset() { t.PointerFilePath = s.PointerFilePath.MustGetNull() } if s.Size.IsValue() { t.Size = s.Size.MustGet() } if s.PackageType.IsValue() { t.PackageType = s.PackageType.MustGet() } if s.Status.IsValue() { t.Status = s.Status.MustGet() } if s.CurrentLocationID.IsValue() { t.CurrentLocationID = s.CurrentLocationID.MustGet() } if !s.OriginPipelineID.IsUnset() { t.OriginPipelineID = s.OriginPipelineID.MustGetNull() } if !s.PointerFileLocationID.IsUnset() { t.PointerFileLocationID = s.PointerFileLocationID.MustGetNull() } if !s.MiscAttributes.IsUnset() { t.MiscAttributes = s.MiscAttributes.MustGetNull() } if !s.Description.IsUnset() { t.Description = s.Description.MustGetNull() } if !s.EncryptionKeyFingerprint.IsUnset() { t.EncryptionKeyFingerprint = s.EncryptionKeyFingerprint.MustGetNull() } if !s.ReplicatedPackageID.IsUnset() { t.ReplicatedPackageID = s.ReplicatedPackageID.MustGetNull() } if !s.StoredDate.IsUnset() { t.StoredDate = s.StoredDate.MustGetNull() } if !s.Checksum.IsUnset() { t.Checksum = s.Checksum.MustGetNull() } if !s.ChecksumAlgorithm.IsUnset() { t.ChecksumAlgorithm = s.ChecksumAlgorithm.MustGetNull() } } func (s *LocationsPackageSetter) Apply(q *dialect.InsertQuery) { q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { return LocationsPackages.BeforeInsertHooks.RunHooks(ctx, exec, s) }) q.AppendValues( bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { if !(s.ID.IsValue()) { return mysql.Raw("DEFAULT").WriteSQL(ctx, w, d, start) } return mysql.Arg(s.ID.MustGet()).WriteSQL(ctx, w, d, start) }), bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { if !(s.UUID.IsValue()) { return mysql.Raw("DEFAULT").WriteSQL(ctx, w, d, start) } return mysql.Arg(s.UUID.MustGet()).WriteSQL(ctx, w, d, start) }), bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { if !(s.CurrentPath.IsValue()) { return mysql.Raw("DEFAULT").WriteSQL(ctx, w, d, start) } return mysql.Arg(s.CurrentPath.MustGet()).WriteSQL(ctx, w, d, start) }), bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { if !(!s.PointerFilePath.IsUnset()) { return mysql.Raw("DEFAULT").WriteSQL(ctx, w, d, start) } return mysql.Arg(s.PointerFilePath.MustGetNull()).WriteSQL(ctx, w, d, start) }), bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { if !(s.Size.IsValue()) { return mysql.Raw("DEFAULT").WriteSQL(ctx, w, d, start) } return mysql.Arg(s.Size.MustGet()).WriteSQL(ctx, w, d, start) }), bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { if !(s.PackageType.IsValue()) { return mysql.Raw("DEFAULT").WriteSQL(ctx, w, d, start) } return mysql.Arg(s.PackageType.MustGet()).WriteSQL(ctx, w, d, start) }), bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { if !(s.Status.IsValue()) { return mysql.Raw("DEFAULT").WriteSQL(ctx, w, d, start) } return mysql.Arg(s.Status.MustGet()).WriteSQL(ctx, w, d, start) }), bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { if !(s.CurrentLocationID.IsValue()) { return mysql.Raw("DEFAULT").WriteSQL(ctx, w, d, start) } return mysql.Arg(s.CurrentLocationID.MustGet()).WriteSQL(ctx, w, d, start) }), bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { if !(!s.OriginPipelineID.IsUnset()) { return mysql.Raw("DEFAULT").WriteSQL(ctx, w, d, start) } return mysql.Arg(s.OriginPipelineID.MustGetNull()).WriteSQL(ctx, w, d, start) }), bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { if !(!s.PointerFileLocationID.IsUnset()) { return mysql.Raw("DEFAULT").WriteSQL(ctx, w, d, start) } return mysql.Arg(s.PointerFileLocationID.MustGetNull()).WriteSQL(ctx, w, d, start) }), bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { if !(!s.MiscAttributes.IsUnset()) { return mysql.Raw("DEFAULT").WriteSQL(ctx, w, d, start) } return mysql.Arg(s.MiscAttributes.MustGetNull()).WriteSQL(ctx, w, d, start) }), bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { if !(!s.Description.IsUnset()) { return mysql.Raw("DEFAULT").WriteSQL(ctx, w, d, start) } return mysql.Arg(s.Description.MustGetNull()).WriteSQL(ctx, w, d, start) }), bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { if !(!s.EncryptionKeyFingerprint.IsUnset()) { return mysql.Raw("DEFAULT").WriteSQL(ctx, w, d, start) } return mysql.Arg(s.EncryptionKeyFingerprint.MustGetNull()).WriteSQL(ctx, w, d, start) }), bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { if !(!s.ReplicatedPackageID.IsUnset()) { return mysql.Raw("DEFAULT").WriteSQL(ctx, w, d, start) } return mysql.Arg(s.ReplicatedPackageID.MustGetNull()).WriteSQL(ctx, w, d, start) }), bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { if !(!s.StoredDate.IsUnset()) { return mysql.Raw("DEFAULT").WriteSQL(ctx, w, d, start) } return mysql.Arg(s.StoredDate.MustGetNull()).WriteSQL(ctx, w, d, start) }), bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { if !(!s.Checksum.IsUnset()) { return mysql.Raw("DEFAULT").WriteSQL(ctx, w, d, start) } return mysql.Arg(s.Checksum.MustGetNull()).WriteSQL(ctx, w, d, start) }), bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { if !(!s.ChecksumAlgorithm.IsUnset()) { return mysql.Raw("DEFAULT").WriteSQL(ctx, w, d, start) } return mysql.Arg(s.ChecksumAlgorithm.MustGetNull()).WriteSQL(ctx, w, d, start) })) } func (s LocationsPackageSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] { return um.Set(s.Expressions("locations_package")...) } func (s LocationsPackageSetter) Expressions(prefix ...string) []bob.Expression { exprs := make([]bob.Expression, 0, 17) if s.ID.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ mysql.Quote(append(prefix, "id")...), mysql.Arg(s.ID), }}) } if s.UUID.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ mysql.Quote(append(prefix, "uuid")...), mysql.Arg(s.UUID), }}) } if s.CurrentPath.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ mysql.Quote(append(prefix, "current_path")...), mysql.Arg(s.CurrentPath), }}) } if !s.PointerFilePath.IsUnset() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ mysql.Quote(append(prefix, "pointer_file_path")...), mysql.Arg(s.PointerFilePath), }}) } if s.Size.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ mysql.Quote(append(prefix, "size")...), mysql.Arg(s.Size), }}) } if s.PackageType.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ mysql.Quote(append(prefix, "package_type")...), mysql.Arg(s.PackageType), }}) } if s.Status.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ mysql.Quote(append(prefix, "status")...), mysql.Arg(s.Status), }}) } if s.CurrentLocationID.IsValue() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ mysql.Quote(append(prefix, "current_location_id")...), mysql.Arg(s.CurrentLocationID), }}) } if !s.OriginPipelineID.IsUnset() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ mysql.Quote(append(prefix, "origin_pipeline_id")...), mysql.Arg(s.OriginPipelineID), }}) } if !s.PointerFileLocationID.IsUnset() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ mysql.Quote(append(prefix, "pointer_file_location_id")...), mysql.Arg(s.PointerFileLocationID), }}) } if !s.MiscAttributes.IsUnset() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ mysql.Quote(append(prefix, "misc_attributes")...), mysql.Arg(s.MiscAttributes), }}) } if !s.Description.IsUnset() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ mysql.Quote(append(prefix, "description")...), mysql.Arg(s.Description), }}) } if !s.EncryptionKeyFingerprint.IsUnset() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ mysql.Quote(append(prefix, "encryption_key_fingerprint")...), mysql.Arg(s.EncryptionKeyFingerprint), }}) } if !s.ReplicatedPackageID.IsUnset() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ mysql.Quote(append(prefix, "replicated_package_id")...), mysql.Arg(s.ReplicatedPackageID), }}) } if !s.StoredDate.IsUnset() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ mysql.Quote(append(prefix, "stored_date")...), mysql.Arg(s.StoredDate), }}) } if !s.Checksum.IsUnset() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ mysql.Quote(append(prefix, "checksum")...), mysql.Arg(s.Checksum), }}) } if !s.ChecksumAlgorithm.IsUnset() { exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{ mysql.Quote(append(prefix, "checksum_algorithm")...), mysql.Arg(s.ChecksumAlgorithm), }}) } return exprs } // FindLocationsPackage retrieves a single record by primary key // If cols is empty Find will return all columns. func FindLocationsPackage(ctx context.Context, exec bob.Executor, IDPK int32, cols ...string) (*LocationsPackage, error) { if len(cols) == 0 { return LocationsPackages.Query( sm.Where(LocationsPackages.Columns.ID.EQ(mysql.Arg(IDPK))), ).One(ctx, exec) } return LocationsPackages.Query( sm.Where(LocationsPackages.Columns.ID.EQ(mysql.Arg(IDPK))), sm.Columns(LocationsPackages.Columns.Only(cols...)), ).One(ctx, exec) } // LocationsPackageExists checks the presence of a single record by primary key func LocationsPackageExists(ctx context.Context, exec bob.Executor, IDPK int32) (bool, error) { return LocationsPackages.Query( sm.Where(LocationsPackages.Columns.ID.EQ(mysql.Arg(IDPK))), ).Exists(ctx, exec) } // AfterQueryHook is called after LocationsPackage is retrieved from the database func (o *LocationsPackage) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { var err error switch queryType { case bob.QueryTypeSelect: ctx, err = LocationsPackages.AfterSelectHooks.RunHooks(ctx, exec, LocationsPackageSlice{o}) case bob.QueryTypeInsert: ctx, err = LocationsPackages.AfterInsertHooks.RunHooks(ctx, exec, LocationsPackageSlice{o}) case bob.QueryTypeUpdate: ctx, err = LocationsPackages.AfterUpdateHooks.RunHooks(ctx, exec, LocationsPackageSlice{o}) case bob.QueryTypeDelete: ctx, err = LocationsPackages.AfterDeleteHooks.RunHooks(ctx, exec, LocationsPackageSlice{o}) } return err } // primaryKeyVals returns the primary key values of the LocationsPackage func (o *LocationsPackage) primaryKeyVals() bob.Expression { return mysql.Arg(o.ID) } func (o *LocationsPackage) pkEQ() dialect.Expression { return mysql.Quote("locations_package", "id").EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { return o.primaryKeyVals().WriteSQL(ctx, w, d, start) })) } // Update uses an executor to update the LocationsPackage func (o *LocationsPackage) Update(ctx context.Context, exec bob.Executor, s *LocationsPackageSetter) error { _, err := LocationsPackages.Update(s.UpdateMod(), um.Where(o.pkEQ())).Exec(ctx, exec) if err != nil { return err } s.Overwrite(o) return nil } // Delete deletes a single LocationsPackage record with an executor func (o *LocationsPackage) Delete(ctx context.Context, exec bob.Executor) error { _, err := LocationsPackages.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec) return err } // Reload refreshes the LocationsPackage using the executor func (o *LocationsPackage) Reload(ctx context.Context, exec bob.Executor) error { o2, err := LocationsPackages.Query( sm.Where(LocationsPackages.Columns.ID.EQ(mysql.Arg(o.ID))), ).One(ctx, exec) if err != nil { return err } o2.R = o.R *o = *o2 return nil } // AfterQueryHook is called after LocationsPackageSlice is retrieved from the database func (o LocationsPackageSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error { var err error switch queryType { case bob.QueryTypeSelect: ctx, err = LocationsPackages.AfterSelectHooks.RunHooks(ctx, exec, o) case bob.QueryTypeInsert: ctx, err = LocationsPackages.AfterInsertHooks.RunHooks(ctx, exec, o) case bob.QueryTypeUpdate: ctx, err = LocationsPackages.AfterUpdateHooks.RunHooks(ctx, exec, o) case bob.QueryTypeDelete: ctx, err = LocationsPackages.AfterDeleteHooks.RunHooks(ctx, exec, o) } return err } func (o LocationsPackageSlice) pkIN() dialect.Expression { if len(o) == 0 { return mysql.Raw("NULL") } return mysql.Quote("locations_package", "id").In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) { pkPairs := make([]bob.Expression, len(o)) for i, row := range o { pkPairs[i] = row.primaryKeyVals() } return bob.ExpressSlice(ctx, w, d, start, pkPairs, "", ", ", "") })) } // copyMatchingRows finds models in the given slice that have the same primary key // then it first copies the existing relationships from the old model to the new model // and then replaces the old model in the slice with the new model func (o LocationsPackageSlice) copyMatchingRows(from ...*LocationsPackage) { for i, old := range o { for _, new := range from { if new.ID != old.ID { continue } new.R = old.R o[i] = new break } } } // UpdateMod modifies an update query with "WHERE primary_key IN (o...)" func (o LocationsPackageSlice) UpdateMod() bob.Mod[*dialect.UpdateQuery] { return bob.ModFunc[*dialect.UpdateQuery](func(q *dialect.UpdateQuery) { q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { return LocationsPackages.BeforeUpdateHooks.RunHooks(ctx, exec, o) }) q.AppendLoader(bob.LoaderFunc(func(ctx context.Context, exec bob.Executor, retrieved any) error { var err error switch retrieved := retrieved.(type) { case *LocationsPackage: o.copyMatchingRows(retrieved) case []*LocationsPackage: o.copyMatchingRows(retrieved...) case LocationsPackageSlice: o.copyMatchingRows(retrieved...) default: // If the retrieved value is not a LocationsPackage or a slice of LocationsPackage // then run the AfterUpdateHooks on the slice _, err = LocationsPackages.AfterUpdateHooks.RunHooks(ctx, exec, o) } return err })) q.AppendWhere(o.pkIN()) }) } // DeleteMod modifies an delete query with "WHERE primary_key IN (o...)" func (o LocationsPackageSlice) DeleteMod() bob.Mod[*dialect.DeleteQuery] { return bob.ModFunc[*dialect.DeleteQuery](func(q *dialect.DeleteQuery) { q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) { return LocationsPackages.BeforeDeleteHooks.RunHooks(ctx, exec, o) }) q.AppendLoader(bob.LoaderFunc(func(ctx context.Context, exec bob.Executor, retrieved any) error { var err error switch retrieved := retrieved.(type) { case *LocationsPackage: o.copyMatchingRows(retrieved) case []*LocationsPackage: o.copyMatchingRows(retrieved...) case LocationsPackageSlice: o.copyMatchingRows(retrieved...) default: // If the retrieved value is not a LocationsPackage or a slice of LocationsPackage // then run the AfterDeleteHooks on the slice _, err = LocationsPackages.AfterDeleteHooks.RunHooks(ctx, exec, o) } return err })) q.AppendWhere(o.pkIN()) }) } func (o LocationsPackageSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals LocationsPackageSetter) error { _, err := LocationsPackages.Update(vals.UpdateMod(), o.UpdateMod()).Exec(ctx, exec) for i := range o { vals.Overwrite(o[i]) } return err } func (o LocationsPackageSlice) DeleteAll(ctx context.Context, exec bob.Executor) error { if len(o) == 0 { return nil } _, err := LocationsPackages.Delete(o.DeleteMod()).Exec(ctx, exec) return err } func (o LocationsPackageSlice) ReloadAll(ctx context.Context, exec bob.Executor) error { if len(o) == 0 { return nil } o2, err := LocationsPackages.Query(sm.Where(o.pkIN())).All(ctx, exec) if err != nil { return err } o.copyMatchingRows(o2...) return nil } // PackageLocationsEvents starts a query for related objects on locations_event func (o *LocationsPackage) PackageLocationsEvents(mods ...bob.Mod[*dialect.SelectQuery]) LocationsEventsQuery { return LocationsEvents.Query(append(mods, sm.Where(LocationsEvents.Columns.PackageID.EQ(mysql.Arg(o.UUID))), )...) } func (os LocationsPackageSlice) PackageLocationsEvents(mods ...bob.Mod[*dialect.SelectQuery]) LocationsEventsQuery { PKArgSlice := make([]bob.Expression, len(os)) for i, o := range os { PKArgSlice[i] = mysql.ArgGroup(o.UUID) } PKArgExpr := mysql.Group(PKArgSlice...) return LocationsEvents.Query(append(mods, sm.Where(mysql.Group(LocationsEvents.Columns.PackageID).OP("IN", PKArgExpr)), )...) } // PackageLocationsFiles starts a query for related objects on locations_file func (o *LocationsPackage) PackageLocationsFiles(mods ...bob.Mod[*dialect.SelectQuery]) LocationsFilesQuery { return LocationsFiles.Query(append(mods, sm.Where(LocationsFiles.Columns.PackageID.EQ(mysql.Arg(o.ID))), )...) } func (os LocationsPackageSlice) PackageLocationsFiles(mods ...bob.Mod[*dialect.SelectQuery]) LocationsFilesQuery { PKArgSlice := make([]bob.Expression, len(os)) for i, o := range os { PKArgSlice[i] = mysql.ArgGroup(o.ID) } PKArgExpr := mysql.Group(PKArgSlice...) return LocationsFiles.Query(append(mods, sm.Where(mysql.Group(LocationsFiles.Columns.PackageID).OP("IN", PKArgExpr)), )...) } // PackageLocationsFixitylogs starts a query for related objects on locations_fixitylog func (o *LocationsPackage) PackageLocationsFixitylogs(mods ...bob.Mod[*dialect.SelectQuery]) LocationsFixitylogsQuery { return LocationsFixitylogs.Query(append(mods, sm.Where(LocationsFixitylogs.Columns.PackageID.EQ(mysql.Arg(o.UUID))), )...) } func (os LocationsPackageSlice) PackageLocationsFixitylogs(mods ...bob.Mod[*dialect.SelectQuery]) LocationsFixitylogsQuery { PKArgSlice := make([]bob.Expression, len(os)) for i, o := range os { PKArgSlice[i] = mysql.ArgGroup(o.UUID) } PKArgExpr := mysql.Group(PKArgSlice...) return LocationsFixitylogs.Query(append(mods, sm.Where(mysql.Group(LocationsFixitylogs.Columns.PackageID).OP("IN", PKArgExpr)), )...) } // CurrentLocationLocationsLocation starts a query for related objects on locations_location func (o *LocationsPackage) CurrentLocationLocationsLocation(mods ...bob.Mod[*dialect.SelectQuery]) LocationsLocationsQuery { return LocationsLocations.Query(append(mods, sm.Where(LocationsLocations.Columns.UUID.EQ(mysql.Arg(o.CurrentLocationID))), )...) } func (os LocationsPackageSlice) CurrentLocationLocationsLocation(mods ...bob.Mod[*dialect.SelectQuery]) LocationsLocationsQuery { PKArgSlice := make([]bob.Expression, len(os)) for i, o := range os { PKArgSlice[i] = mysql.ArgGroup(o.CurrentLocationID) } PKArgExpr := mysql.Group(PKArgSlice...) return LocationsLocations.Query(append(mods, sm.Where(mysql.Group(LocationsLocations.Columns.UUID).OP("IN", PKArgExpr)), )...) } // OriginPipelineLocationsPipeline starts a query for related objects on locations_pipeline func (o *LocationsPackage) OriginPipelineLocationsPipeline(mods ...bob.Mod[*dialect.SelectQuery]) LocationsPipelinesQuery { return LocationsPipelines.Query(append(mods, sm.Where(LocationsPipelines.Columns.UUID.EQ(mysql.Arg(o.OriginPipelineID))), )...) } func (os LocationsPackageSlice) OriginPipelineLocationsPipeline(mods ...bob.Mod[*dialect.SelectQuery]) LocationsPipelinesQuery { PKArgSlice := make([]bob.Expression, len(os)) for i, o := range os { PKArgSlice[i] = mysql.ArgGroup(o.OriginPipelineID) } PKArgExpr := mysql.Group(PKArgSlice...) return LocationsPipelines.Query(append(mods, sm.Where(mysql.Group(LocationsPipelines.Columns.UUID).OP("IN", PKArgExpr)), )...) } // PointerFileLocationLocationsLocation starts a query for related objects on locations_location func (o *LocationsPackage) PointerFileLocationLocationsLocation(mods ...bob.Mod[*dialect.SelectQuery]) LocationsLocationsQuery { return LocationsLocations.Query(append(mods, sm.Where(LocationsLocations.Columns.UUID.EQ(mysql.Arg(o.PointerFileLocationID))), )...) } func (os LocationsPackageSlice) PointerFileLocationLocationsLocation(mods ...bob.Mod[*dialect.SelectQuery]) LocationsLocationsQuery { PKArgSlice := make([]bob.Expression, len(os)) for i, o := range os { PKArgSlice[i] = mysql.ArgGroup(o.PointerFileLocationID) } PKArgExpr := mysql.Group(PKArgSlice...) return LocationsLocations.Query(append(mods, sm.Where(mysql.Group(LocationsLocations.Columns.UUID).OP("IN", PKArgExpr)), )...) } // FromPackageLocationsPackageRelatedPackages starts a query for related objects on locations_package_related_packages func (o *LocationsPackage) FromPackageLocationsPackageRelatedPackages(mods ...bob.Mod[*dialect.SelectQuery]) LocationsPackageRelatedPackagesQuery { return LocationsPackageRelatedPackages.Query(append(mods, sm.Where(LocationsPackageRelatedPackages.Columns.FromPackageID.EQ(mysql.Arg(o.ID))), )...) } func (os LocationsPackageSlice) FromPackageLocationsPackageRelatedPackages(mods ...bob.Mod[*dialect.SelectQuery]) LocationsPackageRelatedPackagesQuery { PKArgSlice := make([]bob.Expression, len(os)) for i, o := range os { PKArgSlice[i] = mysql.ArgGroup(o.ID) } PKArgExpr := mysql.Group(PKArgSlice...) return LocationsPackageRelatedPackages.Query(append(mods, sm.Where(mysql.Group(LocationsPackageRelatedPackages.Columns.FromPackageID).OP("IN", PKArgExpr)), )...) } // ToPackageLocationsPackageRelatedPackages starts a query for related objects on locations_package_related_packages func (o *LocationsPackage) ToPackageLocationsPackageRelatedPackages(mods ...bob.Mod[*dialect.SelectQuery]) LocationsPackageRelatedPackagesQuery { return LocationsPackageRelatedPackages.Query(append(mods, sm.Where(LocationsPackageRelatedPackages.Columns.ToPackageID.EQ(mysql.Arg(o.ID))), )...) } func (os LocationsPackageSlice) ToPackageLocationsPackageRelatedPackages(mods ...bob.Mod[*dialect.SelectQuery]) LocationsPackageRelatedPackagesQuery { PKArgSlice := make([]bob.Expression, len(os)) for i, o := range os { PKArgSlice[i] = mysql.ArgGroup(o.ID) } PKArgExpr := mysql.Group(PKArgSlice...) return LocationsPackageRelatedPackages.Query(append(mods, sm.Where(mysql.Group(LocationsPackageRelatedPackages.Columns.ToPackageID).OP("IN", PKArgExpr)), )...) } // ReplicatedPackage starts a query for related objects on locations_package func (o *LocationsPackage) ReplicatedPackage(mods ...bob.Mod[*dialect.SelectQuery]) LocationsPackagesQuery { return LocationsPackages.Query(append(mods, sm.Where(LocationsPackages.Columns.UUID.EQ(mysql.Arg(o.ReplicatedPackageID))), )...) } func (os LocationsPackageSlice) ReplicatedPackage(mods ...bob.Mod[*dialect.SelectQuery]) LocationsPackagesQuery { PKArgSlice := make([]bob.Expression, len(os)) for i, o := range os { PKArgSlice[i] = mysql.ArgGroup(o.ReplicatedPackageID) } PKArgExpr := mysql.Group(PKArgSlice...) return LocationsPackages.Query(append(mods, sm.Where(mysql.Group(LocationsPackages.Columns.UUID).OP("IN", PKArgExpr)), )...) } // ReverseReplicatedPackages starts a query for related objects on locations_package func (o *LocationsPackage) ReverseReplicatedPackages(mods ...bob.Mod[*dialect.SelectQuery]) LocationsPackagesQuery { return LocationsPackages.Query(append(mods, sm.Where(LocationsPackages.Columns.ReplicatedPackageID.EQ(mysql.Arg(o.UUID))), )...) } func (os LocationsPackageSlice) ReverseReplicatedPackages(mods ...bob.Mod[*dialect.SelectQuery]) LocationsPackagesQuery { PKArgSlice := make([]bob.Expression, len(os)) for i, o := range os { PKArgSlice[i] = mysql.ArgGroup(o.UUID) } PKArgExpr := mysql.Group(PKArgSlice...) return LocationsPackages.Query(append(mods, sm.Where(mysql.Group(LocationsPackages.Columns.ReplicatedPackageID).OP("IN", PKArgExpr)), )...) } // PackageLocationsPackagedownloadtasks starts a query for related objects on locations_packagedownloadtask func (o *LocationsPackage) PackageLocationsPackagedownloadtasks(mods ...bob.Mod[*dialect.SelectQuery]) LocationsPackagedownloadtasksQuery { return LocationsPackagedownloadtasks.Query(append(mods, sm.Where(LocationsPackagedownloadtasks.Columns.PackageID.EQ(mysql.Arg(o.UUID))), )...) } func (os LocationsPackageSlice) PackageLocationsPackagedownloadtasks(mods ...bob.Mod[*dialect.SelectQuery]) LocationsPackagedownloadtasksQuery { PKArgSlice := make([]bob.Expression, len(os)) for i, o := range os { PKArgSlice[i] = mysql.ArgGroup(o.UUID) } PKArgExpr := mysql.Group(PKArgSlice...) return LocationsPackagedownloadtasks.Query(append(mods, sm.Where(mysql.Group(LocationsPackagedownloadtasks.Columns.PackageID).OP("IN", PKArgExpr)), )...) } func insertLocationsPackagePackageLocationsEvents0(ctx context.Context, exec bob.Executor, locationsEvents1 []*LocationsEventSetter, locationsPackage0 *LocationsPackage) (LocationsEventSlice, error) { for i := range locationsEvents1 { locationsEvents1[i].PackageID = omit.From(locationsPackage0.UUID) } ret, err := LocationsEvents.Insert(bob.ToMods(locationsEvents1...)).All(ctx, exec) if err != nil { return ret, fmt.Errorf("insertLocationsPackagePackageLocationsEvents0: %w", err) } return ret, nil } func attachLocationsPackagePackageLocationsEvents0(ctx context.Context, exec bob.Executor, count int, locationsEvents1 LocationsEventSlice, locationsPackage0 *LocationsPackage) (LocationsEventSlice, error) { setter := &LocationsEventSetter{ PackageID: omit.From(locationsPackage0.UUID), } err := locationsEvents1.UpdateAll(ctx, exec, *setter) if err != nil { return nil, fmt.Errorf("attachLocationsPackagePackageLocationsEvents0: %w", err) } return locationsEvents1, nil } func (locationsPackage0 *LocationsPackage) InsertPackageLocationsEvents(ctx context.Context, exec bob.Executor, related ...*LocationsEventSetter) error { if len(related) == 0 { return nil } var err error locationsEvents1, err := insertLocationsPackagePackageLocationsEvents0(ctx, exec, related, locationsPackage0) if err != nil { return err } locationsPackage0.R.PackageLocationsEvents = append(locationsPackage0.R.PackageLocationsEvents, locationsEvents1...) for _, rel := range locationsEvents1 { rel.R.PackageLocationsPackage = locationsPackage0 } return nil } func (locationsPackage0 *LocationsPackage) AttachPackageLocationsEvents(ctx context.Context, exec bob.Executor, related ...*LocationsEvent) error { if len(related) == 0 { return nil } var err error locationsEvents1 := LocationsEventSlice(related) _, err = attachLocationsPackagePackageLocationsEvents0(ctx, exec, len(related), locationsEvents1, locationsPackage0) if err != nil { return err } locationsPackage0.R.PackageLocationsEvents = append(locationsPackage0.R.PackageLocationsEvents, locationsEvents1...) for _, rel := range related { rel.R.PackageLocationsPackage = locationsPackage0 } return nil } func insertLocationsPackagePackageLocationsFiles0(ctx context.Context, exec bob.Executor, locationsFiles1 []*LocationsFileSetter, locationsPackage0 *LocationsPackage) (LocationsFileSlice, error) { for i := range locationsFiles1 { locationsFiles1[i].PackageID = omitnull.From(locationsPackage0.ID) } ret, err := LocationsFiles.Insert(bob.ToMods(locationsFiles1...)).All(ctx, exec) if err != nil { return ret, fmt.Errorf("insertLocationsPackagePackageLocationsFiles0: %w", err) } return ret, nil } func attachLocationsPackagePackageLocationsFiles0(ctx context.Context, exec bob.Executor, count int, locationsFiles1 LocationsFileSlice, locationsPackage0 *LocationsPackage) (LocationsFileSlice, error) { setter := &LocationsFileSetter{ PackageID: omitnull.From(locationsPackage0.ID), } err := locationsFiles1.UpdateAll(ctx, exec, *setter) if err != nil { return nil, fmt.Errorf("attachLocationsPackagePackageLocationsFiles0: %w", err) } return locationsFiles1, nil } func (locationsPackage0 *LocationsPackage) InsertPackageLocationsFiles(ctx context.Context, exec bob.Executor, related ...*LocationsFileSetter) error { if len(related) == 0 { return nil } var err error locationsFiles1, err := insertLocationsPackagePackageLocationsFiles0(ctx, exec, related, locationsPackage0) if err != nil { return err } locationsPackage0.R.PackageLocationsFiles = append(locationsPackage0.R.PackageLocationsFiles, locationsFiles1...) for _, rel := range locationsFiles1 { rel.R.PackageLocationsPackage = locationsPackage0 } return nil } func (locationsPackage0 *LocationsPackage) AttachPackageLocationsFiles(ctx context.Context, exec bob.Executor, related ...*LocationsFile) error { if len(related) == 0 { return nil } var err error locationsFiles1 := LocationsFileSlice(related) _, err = attachLocationsPackagePackageLocationsFiles0(ctx, exec, len(related), locationsFiles1, locationsPackage0) if err != nil { return err } locationsPackage0.R.PackageLocationsFiles = append(locationsPackage0.R.PackageLocationsFiles, locationsFiles1...) for _, rel := range related { rel.R.PackageLocationsPackage = locationsPackage0 } return nil } func insertLocationsPackagePackageLocationsFixitylogs0(ctx context.Context, exec bob.Executor, locationsFixitylogs1 []*LocationsFixitylogSetter, locationsPackage0 *LocationsPackage) (LocationsFixitylogSlice, error) { for i := range locationsFixitylogs1 { locationsFixitylogs1[i].PackageID = omit.From(locationsPackage0.UUID) } ret, err := LocationsFixitylogs.Insert(bob.ToMods(locationsFixitylogs1...)).All(ctx, exec) if err != nil { return ret, fmt.Errorf("insertLocationsPackagePackageLocationsFixitylogs0: %w", err) } return ret, nil } func attachLocationsPackagePackageLocationsFixitylogs0(ctx context.Context, exec bob.Executor, count int, locationsFixitylogs1 LocationsFixitylogSlice, locationsPackage0 *LocationsPackage) (LocationsFixitylogSlice, error) { setter := &LocationsFixitylogSetter{ PackageID: omit.From(locationsPackage0.UUID), } err := locationsFixitylogs1.UpdateAll(ctx, exec, *setter) if err != nil { return nil, fmt.Errorf("attachLocationsPackagePackageLocationsFixitylogs0: %w", err) } return locationsFixitylogs1, nil } func (locationsPackage0 *LocationsPackage) InsertPackageLocationsFixitylogs(ctx context.Context, exec bob.Executor, related ...*LocationsFixitylogSetter) error { if len(related) == 0 { return nil } var err error locationsFixitylogs1, err := insertLocationsPackagePackageLocationsFixitylogs0(ctx, exec, related, locationsPackage0) if err != nil { return err } locationsPackage0.R.PackageLocationsFixitylogs = append(locationsPackage0.R.PackageLocationsFixitylogs, locationsFixitylogs1...) for _, rel := range locationsFixitylogs1 { rel.R.PackageLocationsPackage = locationsPackage0 } return nil } func (locationsPackage0 *LocationsPackage) AttachPackageLocationsFixitylogs(ctx context.Context, exec bob.Executor, related ...*LocationsFixitylog) error { if len(related) == 0 { return nil } var err error locationsFixitylogs1 := LocationsFixitylogSlice(related) _, err = attachLocationsPackagePackageLocationsFixitylogs0(ctx, exec, len(related), locationsFixitylogs1, locationsPackage0) if err != nil { return err } locationsPackage0.R.PackageLocationsFixitylogs = append(locationsPackage0.R.PackageLocationsFixitylogs, locationsFixitylogs1...) for _, rel := range related { rel.R.PackageLocationsPackage = locationsPackage0 } return nil } func attachLocationsPackageCurrentLocationLocationsLocation0(ctx context.Context, exec bob.Executor, count int, locationsPackage0 *LocationsPackage, locationsLocation1 *LocationsLocation) (*LocationsPackage, error) { setter := &LocationsPackageSetter{ CurrentLocationID: omit.From(locationsLocation1.UUID), } err := locationsPackage0.Update(ctx, exec, setter) if err != nil { return nil, fmt.Errorf("attachLocationsPackageCurrentLocationLocationsLocation0: %w", err) } return locationsPackage0, nil } func (locationsPackage0 *LocationsPackage) InsertCurrentLocationLocationsLocation(ctx context.Context, exec bob.Executor, related *LocationsLocationSetter) error { var err error locationsLocation1, err := LocationsLocations.Insert(related).One(ctx, exec) if err != nil { return fmt.Errorf("inserting related objects: %w", err) } _, err = attachLocationsPackageCurrentLocationLocationsLocation0(ctx, exec, 1, locationsPackage0, locationsLocation1) if err != nil { return err } locationsPackage0.R.CurrentLocationLocationsLocation = locationsLocation1 locationsLocation1.R.CurrentLocationLocationsPackages = append(locationsLocation1.R.CurrentLocationLocationsPackages, locationsPackage0) return nil } func (locationsPackage0 *LocationsPackage) AttachCurrentLocationLocationsLocation(ctx context.Context, exec bob.Executor, locationsLocation1 *LocationsLocation) error { var err error _, err = attachLocationsPackageCurrentLocationLocationsLocation0(ctx, exec, 1, locationsPackage0, locationsLocation1) if err != nil { return err } locationsPackage0.R.CurrentLocationLocationsLocation = locationsLocation1 locationsLocation1.R.CurrentLocationLocationsPackages = append(locationsLocation1.R.CurrentLocationLocationsPackages, locationsPackage0) return nil } func attachLocationsPackageOriginPipelineLocationsPipeline0(ctx context.Context, exec bob.Executor, count int, locationsPackage0 *LocationsPackage, locationsPipeline1 *LocationsPipeline) (*LocationsPackage, error) { setter := &LocationsPackageSetter{ OriginPipelineID: omitnull.From(locationsPipeline1.UUID), } err := locationsPackage0.Update(ctx, exec, setter) if err != nil { return nil, fmt.Errorf("attachLocationsPackageOriginPipelineLocationsPipeline0: %w", err) } return locationsPackage0, nil } func (locationsPackage0 *LocationsPackage) InsertOriginPipelineLocationsPipeline(ctx context.Context, exec bob.Executor, related *LocationsPipelineSetter) error { var err error locationsPipeline1, err := LocationsPipelines.Insert(related).One(ctx, exec) if err != nil { return fmt.Errorf("inserting related objects: %w", err) } _, err = attachLocationsPackageOriginPipelineLocationsPipeline0(ctx, exec, 1, locationsPackage0, locationsPipeline1) if err != nil { return err } locationsPackage0.R.OriginPipelineLocationsPipeline = locationsPipeline1 locationsPipeline1.R.OriginPipelineLocationsPackages = append(locationsPipeline1.R.OriginPipelineLocationsPackages, locationsPackage0) return nil } func (locationsPackage0 *LocationsPackage) AttachOriginPipelineLocationsPipeline(ctx context.Context, exec bob.Executor, locationsPipeline1 *LocationsPipeline) error { var err error _, err = attachLocationsPackageOriginPipelineLocationsPipeline0(ctx, exec, 1, locationsPackage0, locationsPipeline1) if err != nil { return err } locationsPackage0.R.OriginPipelineLocationsPipeline = locationsPipeline1 locationsPipeline1.R.OriginPipelineLocationsPackages = append(locationsPipeline1.R.OriginPipelineLocationsPackages, locationsPackage0) return nil } func attachLocationsPackagePointerFileLocationLocationsLocation0(ctx context.Context, exec bob.Executor, count int, locationsPackage0 *LocationsPackage, locationsLocation1 *LocationsLocation) (*LocationsPackage, error) { setter := &LocationsPackageSetter{ PointerFileLocationID: omitnull.From(locationsLocation1.UUID), } err := locationsPackage0.Update(ctx, exec, setter) if err != nil { return nil, fmt.Errorf("attachLocationsPackagePointerFileLocationLocationsLocation0: %w", err) } return locationsPackage0, nil } func (locationsPackage0 *LocationsPackage) InsertPointerFileLocationLocationsLocation(ctx context.Context, exec bob.Executor, related *LocationsLocationSetter) error { var err error locationsLocation1, err := LocationsLocations.Insert(related).One(ctx, exec) if err != nil { return fmt.Errorf("inserting related objects: %w", err) } _, err = attachLocationsPackagePointerFileLocationLocationsLocation0(ctx, exec, 1, locationsPackage0, locationsLocation1) if err != nil { return err } locationsPackage0.R.PointerFileLocationLocationsLocation = locationsLocation1 locationsLocation1.R.PointerFileLocationLocationsPackages = append(locationsLocation1.R.PointerFileLocationLocationsPackages, locationsPackage0) return nil } func (locationsPackage0 *LocationsPackage) AttachPointerFileLocationLocationsLocation(ctx context.Context, exec bob.Executor, locationsLocation1 *LocationsLocation) error { var err error _, err = attachLocationsPackagePointerFileLocationLocationsLocation0(ctx, exec, 1, locationsPackage0, locationsLocation1) if err != nil { return err } locationsPackage0.R.PointerFileLocationLocationsLocation = locationsLocation1 locationsLocation1.R.PointerFileLocationLocationsPackages = append(locationsLocation1.R.PointerFileLocationLocationsPackages, locationsPackage0) return nil } func insertLocationsPackageFromPackageLocationsPackageRelatedPackages0(ctx context.Context, exec bob.Executor, locationsPackageRelatedPackages1 []*LocationsPackageRelatedPackageSetter, locationsPackage0 *LocationsPackage) (LocationsPackageRelatedPackageSlice, error) { for i := range locationsPackageRelatedPackages1 { locationsPackageRelatedPackages1[i].FromPackageID = omit.From(locationsPackage0.ID) } ret, err := LocationsPackageRelatedPackages.Insert(bob.ToMods(locationsPackageRelatedPackages1...)).All(ctx, exec) if err != nil { return ret, fmt.Errorf("insertLocationsPackageFromPackageLocationsPackageRelatedPackages0: %w", err) } return ret, nil } func attachLocationsPackageFromPackageLocationsPackageRelatedPackages0(ctx context.Context, exec bob.Executor, count int, locationsPackageRelatedPackages1 LocationsPackageRelatedPackageSlice, locationsPackage0 *LocationsPackage) (LocationsPackageRelatedPackageSlice, error) { setter := &LocationsPackageRelatedPackageSetter{ FromPackageID: omit.From(locationsPackage0.ID), } err := locationsPackageRelatedPackages1.UpdateAll(ctx, exec, *setter) if err != nil { return nil, fmt.Errorf("attachLocationsPackageFromPackageLocationsPackageRelatedPackages0: %w", err) } return locationsPackageRelatedPackages1, nil } func (locationsPackage0 *LocationsPackage) InsertFromPackageLocationsPackageRelatedPackages(ctx context.Context, exec bob.Executor, related ...*LocationsPackageRelatedPackageSetter) error { if len(related) == 0 { return nil } var err error locationsPackageRelatedPackages1, err := insertLocationsPackageFromPackageLocationsPackageRelatedPackages0(ctx, exec, related, locationsPackage0) if err != nil { return err } locationsPackage0.R.FromPackageLocationsPackageRelatedPackages = append(locationsPackage0.R.FromPackageLocationsPackageRelatedPackages, locationsPackageRelatedPackages1...) for _, rel := range locationsPackageRelatedPackages1 { rel.R.FromPackageLocationsPackage = locationsPackage0 } return nil } func (locationsPackage0 *LocationsPackage) AttachFromPackageLocationsPackageRelatedPackages(ctx context.Context, exec bob.Executor, related ...*LocationsPackageRelatedPackage) error { if len(related) == 0 { return nil } var err error locationsPackageRelatedPackages1 := LocationsPackageRelatedPackageSlice(related) _, err = attachLocationsPackageFromPackageLocationsPackageRelatedPackages0(ctx, exec, len(related), locationsPackageRelatedPackages1, locationsPackage0) if err != nil { return err } locationsPackage0.R.FromPackageLocationsPackageRelatedPackages = append(locationsPackage0.R.FromPackageLocationsPackageRelatedPackages, locationsPackageRelatedPackages1...) for _, rel := range related { rel.R.FromPackageLocationsPackage = locationsPackage0 } return nil } func insertLocationsPackageToPackageLocationsPackageRelatedPackages0(ctx context.Context, exec bob.Executor, locationsPackageRelatedPackages1 []*LocationsPackageRelatedPackageSetter, locationsPackage0 *LocationsPackage) (LocationsPackageRelatedPackageSlice, error) { for i := range locationsPackageRelatedPackages1 { locationsPackageRelatedPackages1[i].ToPackageID = omit.From(locationsPackage0.ID) } ret, err := LocationsPackageRelatedPackages.Insert(bob.ToMods(locationsPackageRelatedPackages1...)).All(ctx, exec) if err != nil { return ret, fmt.Errorf("insertLocationsPackageToPackageLocationsPackageRelatedPackages0: %w", err) } return ret, nil } func attachLocationsPackageToPackageLocationsPackageRelatedPackages0(ctx context.Context, exec bob.Executor, count int, locationsPackageRelatedPackages1 LocationsPackageRelatedPackageSlice, locationsPackage0 *LocationsPackage) (LocationsPackageRelatedPackageSlice, error) { setter := &LocationsPackageRelatedPackageSetter{ ToPackageID: omit.From(locationsPackage0.ID), } err := locationsPackageRelatedPackages1.UpdateAll(ctx, exec, *setter) if err != nil { return nil, fmt.Errorf("attachLocationsPackageToPackageLocationsPackageRelatedPackages0: %w", err) } return locationsPackageRelatedPackages1, nil } func (locationsPackage0 *LocationsPackage) InsertToPackageLocationsPackageRelatedPackages(ctx context.Context, exec bob.Executor, related ...*LocationsPackageRelatedPackageSetter) error { if len(related) == 0 { return nil } var err error locationsPackageRelatedPackages1, err := insertLocationsPackageToPackageLocationsPackageRelatedPackages0(ctx, exec, related, locationsPackage0) if err != nil { return err } locationsPackage0.R.ToPackageLocationsPackageRelatedPackages = append(locationsPackage0.R.ToPackageLocationsPackageRelatedPackages, locationsPackageRelatedPackages1...) for _, rel := range locationsPackageRelatedPackages1 { rel.R.ToPackageLocationsPackage = locationsPackage0 } return nil } func (locationsPackage0 *LocationsPackage) AttachToPackageLocationsPackageRelatedPackages(ctx context.Context, exec bob.Executor, related ...*LocationsPackageRelatedPackage) error { if len(related) == 0 { return nil } var err error locationsPackageRelatedPackages1 := LocationsPackageRelatedPackageSlice(related) _, err = attachLocationsPackageToPackageLocationsPackageRelatedPackages0(ctx, exec, len(related), locationsPackageRelatedPackages1, locationsPackage0) if err != nil { return err } locationsPackage0.R.ToPackageLocationsPackageRelatedPackages = append(locationsPackage0.R.ToPackageLocationsPackageRelatedPackages, locationsPackageRelatedPackages1...) for _, rel := range related { rel.R.ToPackageLocationsPackage = locationsPackage0 } return nil } func attachLocationsPackageReplicatedPackage0(ctx context.Context, exec bob.Executor, count int, locationsPackage0 *LocationsPackage, locationsPackage1 *LocationsPackage) (*LocationsPackage, error) { setter := &LocationsPackageSetter{ ReplicatedPackageID: omitnull.From(locationsPackage1.UUID), } err := locationsPackage0.Update(ctx, exec, setter) if err != nil { return nil, fmt.Errorf("attachLocationsPackageReplicatedPackage0: %w", err) } return locationsPackage0, nil } func (locationsPackage0 *LocationsPackage) InsertReplicatedPackage(ctx context.Context, exec bob.Executor, related *LocationsPackageSetter) error { var err error locationsPackage1, err := LocationsPackages.Insert(related).One(ctx, exec) if err != nil { return fmt.Errorf("inserting related objects: %w", err) } _, err = attachLocationsPackageReplicatedPackage0(ctx, exec, 1, locationsPackage0, locationsPackage1) if err != nil { return err } locationsPackage0.R.ReplicatedPackage = locationsPackage1 locationsPackage1.R.ReplicatedPackage = locationsPackage0 return nil } func (locationsPackage0 *LocationsPackage) AttachReplicatedPackage(ctx context.Context, exec bob.Executor, locationsPackage1 *LocationsPackage) error { var err error _, err = attachLocationsPackageReplicatedPackage0(ctx, exec, 1, locationsPackage0, locationsPackage1) if err != nil { return err } locationsPackage0.R.ReplicatedPackage = locationsPackage1 locationsPackage1.R.ReplicatedPackage = locationsPackage0 return nil } func insertLocationsPackageReverseReplicatedPackages0(ctx context.Context, exec bob.Executor, locationsPackages1 []*LocationsPackageSetter, locationsPackage0 *LocationsPackage) (LocationsPackageSlice, error) { for i := range locationsPackages1 { locationsPackages1[i].ReplicatedPackageID = omitnull.From(locationsPackage0.UUID) } ret, err := LocationsPackages.Insert(bob.ToMods(locationsPackages1...)).All(ctx, exec) if err != nil { return ret, fmt.Errorf("insertLocationsPackageReverseReplicatedPackages0: %w", err) } return ret, nil } func attachLocationsPackageReverseReplicatedPackages0(ctx context.Context, exec bob.Executor, count int, locationsPackages1 LocationsPackageSlice, locationsPackage0 *LocationsPackage) (LocationsPackageSlice, error) { setter := &LocationsPackageSetter{ ReplicatedPackageID: omitnull.From(locationsPackage0.UUID), } err := locationsPackages1.UpdateAll(ctx, exec, *setter) if err != nil { return nil, fmt.Errorf("attachLocationsPackageReverseReplicatedPackages0: %w", err) } return locationsPackages1, nil } func (locationsPackage0 *LocationsPackage) InsertReverseReplicatedPackages(ctx context.Context, exec bob.Executor, related ...*LocationsPackageSetter) error { if len(related) == 0 { return nil } var err error locationsPackages1, err := insertLocationsPackageReverseReplicatedPackages0(ctx, exec, related, locationsPackage0) if err != nil { return err } locationsPackage0.R.ReverseReplicatedPackages = append(locationsPackage0.R.ReverseReplicatedPackages, locationsPackages1...) for _, rel := range locationsPackages1 { rel.R.ReverseReplicatedPackages = append(rel.R.ReverseReplicatedPackages, locationsPackage0) } return nil } func (locationsPackage0 *LocationsPackage) AttachReverseReplicatedPackages(ctx context.Context, exec bob.Executor, related ...*LocationsPackage) error { if len(related) == 0 { return nil } var err error locationsPackages1 := LocationsPackageSlice(related) _, err = attachLocationsPackageReverseReplicatedPackages0(ctx, exec, len(related), locationsPackages1, locationsPackage0) if err != nil { return err } locationsPackage0.R.ReverseReplicatedPackages = append(locationsPackage0.R.ReverseReplicatedPackages, locationsPackages1...) for _, rel := range related { rel.R.ReverseReplicatedPackages = append(rel.R.ReverseReplicatedPackages, locationsPackage0) } return nil } func insertLocationsPackagePackageLocationsPackagedownloadtasks0(ctx context.Context, exec bob.Executor, locationsPackagedownloadtasks1 []*LocationsPackagedownloadtaskSetter, locationsPackage0 *LocationsPackage) (LocationsPackagedownloadtaskSlice, error) { for i := range locationsPackagedownloadtasks1 { locationsPackagedownloadtasks1[i].PackageID = omit.From(locationsPackage0.UUID) } ret, err := LocationsPackagedownloadtasks.Insert(bob.ToMods(locationsPackagedownloadtasks1...)).All(ctx, exec) if err != nil { return ret, fmt.Errorf("insertLocationsPackagePackageLocationsPackagedownloadtasks0: %w", err) } return ret, nil } func attachLocationsPackagePackageLocationsPackagedownloadtasks0(ctx context.Context, exec bob.Executor, count int, locationsPackagedownloadtasks1 LocationsPackagedownloadtaskSlice, locationsPackage0 *LocationsPackage) (LocationsPackagedownloadtaskSlice, error) { setter := &LocationsPackagedownloadtaskSetter{ PackageID: omit.From(locationsPackage0.UUID), } err := locationsPackagedownloadtasks1.UpdateAll(ctx, exec, *setter) if err != nil { return nil, fmt.Errorf("attachLocationsPackagePackageLocationsPackagedownloadtasks0: %w", err) } return locationsPackagedownloadtasks1, nil } func (locationsPackage0 *LocationsPackage) InsertPackageLocationsPackagedownloadtasks(ctx context.Context, exec bob.Executor, related ...*LocationsPackagedownloadtaskSetter) error { if len(related) == 0 { return nil } var err error locationsPackagedownloadtasks1, err := insertLocationsPackagePackageLocationsPackagedownloadtasks0(ctx, exec, related, locationsPackage0) if err != nil { return err } locationsPackage0.R.PackageLocationsPackagedownloadtasks = append(locationsPackage0.R.PackageLocationsPackagedownloadtasks, locationsPackagedownloadtasks1...) for _, rel := range locationsPackagedownloadtasks1 { rel.R.PackageLocationsPackage = locationsPackage0 } return nil } func (locationsPackage0 *LocationsPackage) AttachPackageLocationsPackagedownloadtasks(ctx context.Context, exec bob.Executor, related ...*LocationsPackagedownloadtask) error { if len(related) == 0 { return nil } var err error locationsPackagedownloadtasks1 := LocationsPackagedownloadtaskSlice(related) _, err = attachLocationsPackagePackageLocationsPackagedownloadtasks0(ctx, exec, len(related), locationsPackagedownloadtasks1, locationsPackage0) if err != nil { return err } locationsPackage0.R.PackageLocationsPackagedownloadtasks = append(locationsPackage0.R.PackageLocationsPackagedownloadtasks, locationsPackagedownloadtasks1...) for _, rel := range related { rel.R.PackageLocationsPackage = locationsPackage0 } return nil } type locationsPackageWhere[Q mysql.Filterable] struct { ID mysql.WhereMod[Q, int32] UUID mysql.WhereMod[Q, string] CurrentPath mysql.WhereMod[Q, string] PointerFilePath mysql.WhereNullMod[Q, string] Size mysql.WhereMod[Q, int64] PackageType mysql.WhereMod[Q, string] Status mysql.WhereMod[Q, string] CurrentLocationID mysql.WhereMod[Q, string] OriginPipelineID mysql.WhereNullMod[Q, string] PointerFileLocationID mysql.WhereNullMod[Q, string] MiscAttributes mysql.WhereNullMod[Q, string] Description mysql.WhereNullMod[Q, string] EncryptionKeyFingerprint mysql.WhereNullMod[Q, string] ReplicatedPackageID mysql.WhereNullMod[Q, string] StoredDate mysql.WhereNullMod[Q, time.Time] Checksum mysql.WhereNullMod[Q, string] ChecksumAlgorithm mysql.WhereNullMod[Q, string] } func (locationsPackageWhere[Q]) AliasedAs(alias string) locationsPackageWhere[Q] { return buildLocationsPackageWhere[Q](buildLocationsPackageColumns(alias)) } func buildLocationsPackageWhere[Q mysql.Filterable](cols locationsPackageColumns) locationsPackageWhere[Q] { return locationsPackageWhere[Q]{ ID: mysql.Where[Q, int32](cols.ID), UUID: mysql.Where[Q, string](cols.UUID), CurrentPath: mysql.Where[Q, string](cols.CurrentPath), PointerFilePath: mysql.WhereNull[Q, string](cols.PointerFilePath), Size: mysql.Where[Q, int64](cols.Size), PackageType: mysql.Where[Q, string](cols.PackageType), Status: mysql.Where[Q, string](cols.Status), CurrentLocationID: mysql.Where[Q, string](cols.CurrentLocationID), OriginPipelineID: mysql.WhereNull[Q, string](cols.OriginPipelineID), PointerFileLocationID: mysql.WhereNull[Q, string](cols.PointerFileLocationID), MiscAttributes: mysql.WhereNull[Q, string](cols.MiscAttributes), Description: mysql.WhereNull[Q, string](cols.Description), EncryptionKeyFingerprint: mysql.WhereNull[Q, string](cols.EncryptionKeyFingerprint), ReplicatedPackageID: mysql.WhereNull[Q, string](cols.ReplicatedPackageID), StoredDate: mysql.WhereNull[Q, time.Time](cols.StoredDate), Checksum: mysql.WhereNull[Q, string](cols.Checksum), ChecksumAlgorithm: mysql.WhereNull[Q, string](cols.ChecksumAlgorithm), } } func (o *LocationsPackage) Preload(name string, retrieved any) error { if o == nil { return nil } switch name { case "PackageLocationsEvents": rels, ok := retrieved.(LocationsEventSlice) if !ok { return fmt.Errorf("locationsPackage cannot load %T as %q", retrieved, name) } o.R.PackageLocationsEvents = rels for _, rel := range rels { if rel != nil { rel.R.PackageLocationsPackage = o } } return nil case "PackageLocationsFiles": rels, ok := retrieved.(LocationsFileSlice) if !ok { return fmt.Errorf("locationsPackage cannot load %T as %q", retrieved, name) } o.R.PackageLocationsFiles = rels for _, rel := range rels { if rel != nil { rel.R.PackageLocationsPackage = o } } return nil case "PackageLocationsFixitylogs": rels, ok := retrieved.(LocationsFixitylogSlice) if !ok { return fmt.Errorf("locationsPackage cannot load %T as %q", retrieved, name) } o.R.PackageLocationsFixitylogs = rels for _, rel := range rels { if rel != nil { rel.R.PackageLocationsPackage = o } } return nil case "CurrentLocationLocationsLocation": rel, ok := retrieved.(*LocationsLocation) if !ok { return fmt.Errorf("locationsPackage cannot load %T as %q", retrieved, name) } o.R.CurrentLocationLocationsLocation = rel if rel != nil { rel.R.CurrentLocationLocationsPackages = LocationsPackageSlice{o} } return nil case "OriginPipelineLocationsPipeline": rel, ok := retrieved.(*LocationsPipeline) if !ok { return fmt.Errorf("locationsPackage cannot load %T as %q", retrieved, name) } o.R.OriginPipelineLocationsPipeline = rel if rel != nil { rel.R.OriginPipelineLocationsPackages = LocationsPackageSlice{o} } return nil case "PointerFileLocationLocationsLocation": rel, ok := retrieved.(*LocationsLocation) if !ok { return fmt.Errorf("locationsPackage cannot load %T as %q", retrieved, name) } o.R.PointerFileLocationLocationsLocation = rel if rel != nil { rel.R.PointerFileLocationLocationsPackages = LocationsPackageSlice{o} } return nil case "FromPackageLocationsPackageRelatedPackages": rels, ok := retrieved.(LocationsPackageRelatedPackageSlice) if !ok { return fmt.Errorf("locationsPackage cannot load %T as %q", retrieved, name) } o.R.FromPackageLocationsPackageRelatedPackages = rels for _, rel := range rels { if rel != nil { rel.R.FromPackageLocationsPackage = o } } return nil case "ToPackageLocationsPackageRelatedPackages": rels, ok := retrieved.(LocationsPackageRelatedPackageSlice) if !ok { return fmt.Errorf("locationsPackage cannot load %T as %q", retrieved, name) } o.R.ToPackageLocationsPackageRelatedPackages = rels for _, rel := range rels { if rel != nil { rel.R.ToPackageLocationsPackage = o } } return nil case "ReplicatedPackage": rel, ok := retrieved.(*LocationsPackage) if !ok { return fmt.Errorf("locationsPackage cannot load %T as %q", retrieved, name) } o.R.ReplicatedPackage = rel if rel != nil { rel.R.ReplicatedPackage = o } return nil case "ReverseReplicatedPackages": rels, ok := retrieved.(LocationsPackageSlice) if !ok { return fmt.Errorf("locationsPackage cannot load %T as %q", retrieved, name) } o.R.ReverseReplicatedPackages = rels for _, rel := range rels { if rel != nil { rel.R.ReverseReplicatedPackages = LocationsPackageSlice{o} } } return nil case "PackageLocationsPackagedownloadtasks": rels, ok := retrieved.(LocationsPackagedownloadtaskSlice) if !ok { return fmt.Errorf("locationsPackage cannot load %T as %q", retrieved, name) } o.R.PackageLocationsPackagedownloadtasks = rels for _, rel := range rels { if rel != nil { rel.R.PackageLocationsPackage = o } } return nil default: return fmt.Errorf("locationsPackage has no relationship %q", name) } } type locationsPackagePreloader struct { CurrentLocationLocationsLocation func(...mysql.PreloadOption) mysql.Preloader OriginPipelineLocationsPipeline func(...mysql.PreloadOption) mysql.Preloader PointerFileLocationLocationsLocation func(...mysql.PreloadOption) mysql.Preloader ReplicatedPackage func(...mysql.PreloadOption) mysql.Preloader } func buildLocationsPackagePreloader() locationsPackagePreloader { return locationsPackagePreloader{ CurrentLocationLocationsLocation: func(opts ...mysql.PreloadOption) mysql.Preloader { return mysql.Preload[*LocationsLocation, LocationsLocationSlice](mysql.PreloadRel{ Name: "CurrentLocationLocationsLocation", Sides: []mysql.PreloadSide{ { From: LocationsPackages, To: LocationsLocations, FromColumns: []string{"current_location_id"}, ToColumns: []string{"uuid"}, }, }, }, LocationsLocations.Columns.Names(), opts...) }, OriginPipelineLocationsPipeline: func(opts ...mysql.PreloadOption) mysql.Preloader { return mysql.Preload[*LocationsPipeline, LocationsPipelineSlice](mysql.PreloadRel{ Name: "OriginPipelineLocationsPipeline", Sides: []mysql.PreloadSide{ { From: LocationsPackages, To: LocationsPipelines, FromColumns: []string{"origin_pipeline_id"}, ToColumns: []string{"uuid"}, }, }, }, LocationsPipelines.Columns.Names(), opts...) }, PointerFileLocationLocationsLocation: func(opts ...mysql.PreloadOption) mysql.Preloader { return mysql.Preload[*LocationsLocation, LocationsLocationSlice](mysql.PreloadRel{ Name: "PointerFileLocationLocationsLocation", Sides: []mysql.PreloadSide{ { From: LocationsPackages, To: LocationsLocations, FromColumns: []string{"pointer_file_location_id"}, ToColumns: []string{"uuid"}, }, }, }, LocationsLocations.Columns.Names(), opts...) }, ReplicatedPackage: func(opts ...mysql.PreloadOption) mysql.Preloader { return mysql.Preload[*LocationsPackage, LocationsPackageSlice](mysql.PreloadRel{ Name: "ReplicatedPackage", Sides: []mysql.PreloadSide{ { From: LocationsPackages, To: LocationsPackages, FromColumns: []string{"replicated_package_id"}, ToColumns: []string{"uuid"}, }, }, }, LocationsPackages.Columns.Names(), opts...) }, } } type locationsPackageThenLoader[Q orm.Loadable] struct { PackageLocationsEvents func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] PackageLocationsFiles func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] PackageLocationsFixitylogs func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] CurrentLocationLocationsLocation func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] OriginPipelineLocationsPipeline func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] PointerFileLocationLocationsLocation func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] FromPackageLocationsPackageRelatedPackages func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] ToPackageLocationsPackageRelatedPackages func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] ReplicatedPackage func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] ReverseReplicatedPackages func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] PackageLocationsPackagedownloadtasks func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q] } func buildLocationsPackageThenLoader[Q orm.Loadable]() locationsPackageThenLoader[Q] { type PackageLocationsEventsLoadInterface interface { LoadPackageLocationsEvents(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error } type PackageLocationsFilesLoadInterface interface { LoadPackageLocationsFiles(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error } type PackageLocationsFixitylogsLoadInterface interface { LoadPackageLocationsFixitylogs(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error } type CurrentLocationLocationsLocationLoadInterface interface { LoadCurrentLocationLocationsLocation(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error } type OriginPipelineLocationsPipelineLoadInterface interface { LoadOriginPipelineLocationsPipeline(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error } type PointerFileLocationLocationsLocationLoadInterface interface { LoadPointerFileLocationLocationsLocation(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error } type FromPackageLocationsPackageRelatedPackagesLoadInterface interface { LoadFromPackageLocationsPackageRelatedPackages(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error } type ToPackageLocationsPackageRelatedPackagesLoadInterface interface { LoadToPackageLocationsPackageRelatedPackages(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error } type ReplicatedPackageLoadInterface interface { LoadReplicatedPackage(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error } type ReverseReplicatedPackagesLoadInterface interface { LoadReverseReplicatedPackages(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error } type PackageLocationsPackagedownloadtasksLoadInterface interface { LoadPackageLocationsPackagedownloadtasks(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error } return locationsPackageThenLoader[Q]{ PackageLocationsEvents: thenLoadBuilder[Q]( "PackageLocationsEvents", func(ctx context.Context, exec bob.Executor, retrieved PackageLocationsEventsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { return retrieved.LoadPackageLocationsEvents(ctx, exec, mods...) }, ), PackageLocationsFiles: thenLoadBuilder[Q]( "PackageLocationsFiles", func(ctx context.Context, exec bob.Executor, retrieved PackageLocationsFilesLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { return retrieved.LoadPackageLocationsFiles(ctx, exec, mods...) }, ), PackageLocationsFixitylogs: thenLoadBuilder[Q]( "PackageLocationsFixitylogs", func(ctx context.Context, exec bob.Executor, retrieved PackageLocationsFixitylogsLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { return retrieved.LoadPackageLocationsFixitylogs(ctx, exec, mods...) }, ), CurrentLocationLocationsLocation: thenLoadBuilder[Q]( "CurrentLocationLocationsLocation", func(ctx context.Context, exec bob.Executor, retrieved CurrentLocationLocationsLocationLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { return retrieved.LoadCurrentLocationLocationsLocation(ctx, exec, mods...) }, ), OriginPipelineLocationsPipeline: thenLoadBuilder[Q]( "OriginPipelineLocationsPipeline", func(ctx context.Context, exec bob.Executor, retrieved OriginPipelineLocationsPipelineLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { return retrieved.LoadOriginPipelineLocationsPipeline(ctx, exec, mods...) }, ), PointerFileLocationLocationsLocation: thenLoadBuilder[Q]( "PointerFileLocationLocationsLocation", func(ctx context.Context, exec bob.Executor, retrieved PointerFileLocationLocationsLocationLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { return retrieved.LoadPointerFileLocationLocationsLocation(ctx, exec, mods...) }, ), FromPackageLocationsPackageRelatedPackages: thenLoadBuilder[Q]( "FromPackageLocationsPackageRelatedPackages", func(ctx context.Context, exec bob.Executor, retrieved FromPackageLocationsPackageRelatedPackagesLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { return retrieved.LoadFromPackageLocationsPackageRelatedPackages(ctx, exec, mods...) }, ), ToPackageLocationsPackageRelatedPackages: thenLoadBuilder[Q]( "ToPackageLocationsPackageRelatedPackages", func(ctx context.Context, exec bob.Executor, retrieved ToPackageLocationsPackageRelatedPackagesLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { return retrieved.LoadToPackageLocationsPackageRelatedPackages(ctx, exec, mods...) }, ), ReplicatedPackage: thenLoadBuilder[Q]( "ReplicatedPackage", func(ctx context.Context, exec bob.Executor, retrieved ReplicatedPackageLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { return retrieved.LoadReplicatedPackage(ctx, exec, mods...) }, ), ReverseReplicatedPackages: thenLoadBuilder[Q]( "ReverseReplicatedPackages", func(ctx context.Context, exec bob.Executor, retrieved ReverseReplicatedPackagesLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { return retrieved.LoadReverseReplicatedPackages(ctx, exec, mods...) }, ), PackageLocationsPackagedownloadtasks: thenLoadBuilder[Q]( "PackageLocationsPackagedownloadtasks", func(ctx context.Context, exec bob.Executor, retrieved PackageLocationsPackagedownloadtasksLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error { return retrieved.LoadPackageLocationsPackagedownloadtasks(ctx, exec, mods...) }, ), } } // LoadPackageLocationsEvents loads the locationsPackage's PackageLocationsEvents into the .R struct func (o *LocationsPackage) LoadPackageLocationsEvents(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { if o == nil { return nil } // Reset the relationship o.R.PackageLocationsEvents = nil related, err := o.PackageLocationsEvents(mods...).All(ctx, exec) if err != nil { return err } for _, rel := range related { rel.R.PackageLocationsPackage = o } o.R.PackageLocationsEvents = related return nil } // LoadPackageLocationsEvents loads the locationsPackage's PackageLocationsEvents into the .R struct func (os LocationsPackageSlice) LoadPackageLocationsEvents(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { if len(os) == 0 { return nil } locationsEvents, err := os.PackageLocationsEvents(mods...).All(ctx, exec) if err != nil { return err } for _, o := range os { if o == nil { continue } o.R.PackageLocationsEvents = nil } for _, o := range os { if o == nil { continue } for _, rel := range locationsEvents { if !(o.UUID == rel.PackageID) { continue } rel.R.PackageLocationsPackage = o o.R.PackageLocationsEvents = append(o.R.PackageLocationsEvents, rel) } } return nil } // LoadPackageLocationsFiles loads the locationsPackage's PackageLocationsFiles into the .R struct func (o *LocationsPackage) LoadPackageLocationsFiles(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { if o == nil { return nil } // Reset the relationship o.R.PackageLocationsFiles = nil related, err := o.PackageLocationsFiles(mods...).All(ctx, exec) if err != nil { return err } for _, rel := range related { rel.R.PackageLocationsPackage = o } o.R.PackageLocationsFiles = related return nil } // LoadPackageLocationsFiles loads the locationsPackage's PackageLocationsFiles into the .R struct func (os LocationsPackageSlice) LoadPackageLocationsFiles(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { if len(os) == 0 { return nil } locationsFiles, err := os.PackageLocationsFiles(mods...).All(ctx, exec) if err != nil { return err } for _, o := range os { if o == nil { continue } o.R.PackageLocationsFiles = nil } for _, o := range os { if o == nil { continue } for _, rel := range locationsFiles { if !rel.PackageID.IsValue() { continue } if !(rel.PackageID.IsValue() && o.ID == rel.PackageID.MustGet()) { continue } rel.R.PackageLocationsPackage = o o.R.PackageLocationsFiles = append(o.R.PackageLocationsFiles, rel) } } return nil } // LoadPackageLocationsFixitylogs loads the locationsPackage's PackageLocationsFixitylogs into the .R struct func (o *LocationsPackage) LoadPackageLocationsFixitylogs(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { if o == nil { return nil } // Reset the relationship o.R.PackageLocationsFixitylogs = nil related, err := o.PackageLocationsFixitylogs(mods...).All(ctx, exec) if err != nil { return err } for _, rel := range related { rel.R.PackageLocationsPackage = o } o.R.PackageLocationsFixitylogs = related return nil } // LoadPackageLocationsFixitylogs loads the locationsPackage's PackageLocationsFixitylogs into the .R struct func (os LocationsPackageSlice) LoadPackageLocationsFixitylogs(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { if len(os) == 0 { return nil } locationsFixitylogs, err := os.PackageLocationsFixitylogs(mods...).All(ctx, exec) if err != nil { return err } for _, o := range os { if o == nil { continue } o.R.PackageLocationsFixitylogs = nil } for _, o := range os { if o == nil { continue } for _, rel := range locationsFixitylogs { if !(o.UUID == rel.PackageID) { continue } rel.R.PackageLocationsPackage = o o.R.PackageLocationsFixitylogs = append(o.R.PackageLocationsFixitylogs, rel) } } return nil } // LoadCurrentLocationLocationsLocation loads the locationsPackage's CurrentLocationLocationsLocation into the .R struct func (o *LocationsPackage) LoadCurrentLocationLocationsLocation(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { if o == nil { return nil } // Reset the relationship o.R.CurrentLocationLocationsLocation = nil related, err := o.CurrentLocationLocationsLocation(mods...).One(ctx, exec) if err != nil { return err } related.R.CurrentLocationLocationsPackages = LocationsPackageSlice{o} o.R.CurrentLocationLocationsLocation = related return nil } // LoadCurrentLocationLocationsLocation loads the locationsPackage's CurrentLocationLocationsLocation into the .R struct func (os LocationsPackageSlice) LoadCurrentLocationLocationsLocation(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { if len(os) == 0 { return nil } locationsLocations, err := os.CurrentLocationLocationsLocation(mods...).All(ctx, exec) if err != nil { return err } for _, o := range os { if o == nil { continue } for _, rel := range locationsLocations { if !(o.CurrentLocationID == rel.UUID) { continue } rel.R.CurrentLocationLocationsPackages = append(rel.R.CurrentLocationLocationsPackages, o) o.R.CurrentLocationLocationsLocation = rel break } } return nil } // LoadOriginPipelineLocationsPipeline loads the locationsPackage's OriginPipelineLocationsPipeline into the .R struct func (o *LocationsPackage) LoadOriginPipelineLocationsPipeline(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { if o == nil { return nil } // Reset the relationship o.R.OriginPipelineLocationsPipeline = nil related, err := o.OriginPipelineLocationsPipeline(mods...).One(ctx, exec) if err != nil { return err } related.R.OriginPipelineLocationsPackages = LocationsPackageSlice{o} o.R.OriginPipelineLocationsPipeline = related return nil } // LoadOriginPipelineLocationsPipeline loads the locationsPackage's OriginPipelineLocationsPipeline into the .R struct func (os LocationsPackageSlice) LoadOriginPipelineLocationsPipeline(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { if len(os) == 0 { return nil } locationsPipelines, err := os.OriginPipelineLocationsPipeline(mods...).All(ctx, exec) if err != nil { return err } for _, o := range os { if o == nil { continue } for _, rel := range locationsPipelines { if !o.OriginPipelineID.IsValue() { continue } if !(o.OriginPipelineID.IsValue() && o.OriginPipelineID.MustGet() == rel.UUID) { continue } rel.R.OriginPipelineLocationsPackages = append(rel.R.OriginPipelineLocationsPackages, o) o.R.OriginPipelineLocationsPipeline = rel break } } return nil } // LoadPointerFileLocationLocationsLocation loads the locationsPackage's PointerFileLocationLocationsLocation into the .R struct func (o *LocationsPackage) LoadPointerFileLocationLocationsLocation(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { if o == nil { return nil } // Reset the relationship o.R.PointerFileLocationLocationsLocation = nil related, err := o.PointerFileLocationLocationsLocation(mods...).One(ctx, exec) if err != nil { return err } related.R.PointerFileLocationLocationsPackages = LocationsPackageSlice{o} o.R.PointerFileLocationLocationsLocation = related return nil } // LoadPointerFileLocationLocationsLocation loads the locationsPackage's PointerFileLocationLocationsLocation into the .R struct func (os LocationsPackageSlice) LoadPointerFileLocationLocationsLocation(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { if len(os) == 0 { return nil } locationsLocations, err := os.PointerFileLocationLocationsLocation(mods...).All(ctx, exec) if err != nil { return err } for _, o := range os { if o == nil { continue } for _, rel := range locationsLocations { if !o.PointerFileLocationID.IsValue() { continue } if !(o.PointerFileLocationID.IsValue() && o.PointerFileLocationID.MustGet() == rel.UUID) { continue } rel.R.PointerFileLocationLocationsPackages = append(rel.R.PointerFileLocationLocationsPackages, o) o.R.PointerFileLocationLocationsLocation = rel break } } return nil } // LoadFromPackageLocationsPackageRelatedPackages loads the locationsPackage's FromPackageLocationsPackageRelatedPackages into the .R struct func (o *LocationsPackage) LoadFromPackageLocationsPackageRelatedPackages(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { if o == nil { return nil } // Reset the relationship o.R.FromPackageLocationsPackageRelatedPackages = nil related, err := o.FromPackageLocationsPackageRelatedPackages(mods...).All(ctx, exec) if err != nil { return err } for _, rel := range related { rel.R.FromPackageLocationsPackage = o } o.R.FromPackageLocationsPackageRelatedPackages = related return nil } // LoadFromPackageLocationsPackageRelatedPackages loads the locationsPackage's FromPackageLocationsPackageRelatedPackages into the .R struct func (os LocationsPackageSlice) LoadFromPackageLocationsPackageRelatedPackages(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { if len(os) == 0 { return nil } locationsPackageRelatedPackages, err := os.FromPackageLocationsPackageRelatedPackages(mods...).All(ctx, exec) if err != nil { return err } for _, o := range os { if o == nil { continue } o.R.FromPackageLocationsPackageRelatedPackages = nil } for _, o := range os { if o == nil { continue } for _, rel := range locationsPackageRelatedPackages { if !(o.ID == rel.FromPackageID) { continue } rel.R.FromPackageLocationsPackage = o o.R.FromPackageLocationsPackageRelatedPackages = append(o.R.FromPackageLocationsPackageRelatedPackages, rel) } } return nil } // LoadToPackageLocationsPackageRelatedPackages loads the locationsPackage's ToPackageLocationsPackageRelatedPackages into the .R struct func (o *LocationsPackage) LoadToPackageLocationsPackageRelatedPackages(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { if o == nil { return nil } // Reset the relationship o.R.ToPackageLocationsPackageRelatedPackages = nil related, err := o.ToPackageLocationsPackageRelatedPackages(mods...).All(ctx, exec) if err != nil { return err } for _, rel := range related { rel.R.ToPackageLocationsPackage = o } o.R.ToPackageLocationsPackageRelatedPackages = related return nil } // LoadToPackageLocationsPackageRelatedPackages loads the locationsPackage's ToPackageLocationsPackageRelatedPackages into the .R struct func (os LocationsPackageSlice) LoadToPackageLocationsPackageRelatedPackages(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { if len(os) == 0 { return nil } locationsPackageRelatedPackages, err := os.ToPackageLocationsPackageRelatedPackages(mods...).All(ctx, exec) if err != nil { return err } for _, o := range os { if o == nil { continue } o.R.ToPackageLocationsPackageRelatedPackages = nil } for _, o := range os { if o == nil { continue } for _, rel := range locationsPackageRelatedPackages { if !(o.ID == rel.ToPackageID) { continue } rel.R.ToPackageLocationsPackage = o o.R.ToPackageLocationsPackageRelatedPackages = append(o.R.ToPackageLocationsPackageRelatedPackages, rel) } } return nil } // LoadReplicatedPackage loads the locationsPackage's ReplicatedPackage into the .R struct func (o *LocationsPackage) LoadReplicatedPackage(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { if o == nil { return nil } // Reset the relationship o.R.ReplicatedPackage = nil related, err := o.ReplicatedPackage(mods...).One(ctx, exec) if err != nil { return err } related.R.ReplicatedPackage = o o.R.ReplicatedPackage = related return nil } // LoadReplicatedPackage loads the locationsPackage's ReplicatedPackage into the .R struct func (os LocationsPackageSlice) LoadReplicatedPackage(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { if len(os) == 0 { return nil } locationsPackages, err := os.ReplicatedPackage(mods...).All(ctx, exec) if err != nil { return err } for _, o := range os { if o == nil { continue } for _, rel := range locationsPackages { if !o.ReplicatedPackageID.IsValue() { continue } if !(o.ReplicatedPackageID.IsValue() && o.ReplicatedPackageID.MustGet() == rel.UUID) { continue } rel.R.ReplicatedPackage = o o.R.ReplicatedPackage = rel break } } return nil } // LoadReverseReplicatedPackages loads the locationsPackage's ReverseReplicatedPackages into the .R struct func (o *LocationsPackage) LoadReverseReplicatedPackages(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { if o == nil { return nil } // Reset the relationship o.R.ReverseReplicatedPackages = nil related, err := o.ReverseReplicatedPackages(mods...).All(ctx, exec) if err != nil { return err } for _, rel := range related { rel.R.ReverseReplicatedPackages = LocationsPackageSlice{o} } o.R.ReverseReplicatedPackages = related return nil } // LoadReverseReplicatedPackages loads the locationsPackage's ReverseReplicatedPackages into the .R struct func (os LocationsPackageSlice) LoadReverseReplicatedPackages(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { if len(os) == 0 { return nil } locationsPackages, err := os.ReverseReplicatedPackages(mods...).All(ctx, exec) if err != nil { return err } for _, o := range os { if o == nil { continue } o.R.ReverseReplicatedPackages = nil } for _, o := range os { if o == nil { continue } for _, rel := range locationsPackages { if !rel.ReplicatedPackageID.IsValue() { continue } if !(rel.ReplicatedPackageID.IsValue() && o.UUID == rel.ReplicatedPackageID.MustGet()) { continue } rel.R.ReverseReplicatedPackages = append(rel.R.ReverseReplicatedPackages, o) o.R.ReverseReplicatedPackages = append(o.R.ReverseReplicatedPackages, rel) } } return nil } // LoadPackageLocationsPackagedownloadtasks loads the locationsPackage's PackageLocationsPackagedownloadtasks into the .R struct func (o *LocationsPackage) LoadPackageLocationsPackagedownloadtasks(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { if o == nil { return nil } // Reset the relationship o.R.PackageLocationsPackagedownloadtasks = nil related, err := o.PackageLocationsPackagedownloadtasks(mods...).All(ctx, exec) if err != nil { return err } for _, rel := range related { rel.R.PackageLocationsPackage = o } o.R.PackageLocationsPackagedownloadtasks = related return nil } // LoadPackageLocationsPackagedownloadtasks loads the locationsPackage's PackageLocationsPackagedownloadtasks into the .R struct func (os LocationsPackageSlice) LoadPackageLocationsPackagedownloadtasks(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error { if len(os) == 0 { return nil } locationsPackagedownloadtasks, err := os.PackageLocationsPackagedownloadtasks(mods...).All(ctx, exec) if err != nil { return err } for _, o := range os { if o == nil { continue } o.R.PackageLocationsPackagedownloadtasks = nil } for _, o := range os { if o == nil { continue } for _, rel := range locationsPackagedownloadtasks { if !(o.UUID == rel.PackageID) { continue } rel.R.PackageLocationsPackage = o o.R.PackageLocationsPackagedownloadtasks = append(o.R.PackageLocationsPackagedownloadtasks, rel) } } return nil } type locationsPackageJoins[Q dialect.Joinable] struct { typ string PackageLocationsEvents modAs[Q, locationsEventColumns] PackageLocationsFiles modAs[Q, locationsFileColumns] PackageLocationsFixitylogs modAs[Q, locationsFixitylogColumns] CurrentLocationLocationsLocation modAs[Q, locationsLocationColumns] OriginPipelineLocationsPipeline modAs[Q, locationsPipelineColumns] PointerFileLocationLocationsLocation modAs[Q, locationsLocationColumns] FromPackageLocationsPackageRelatedPackages modAs[Q, locationsPackageRelatedPackageColumns] ToPackageLocationsPackageRelatedPackages modAs[Q, locationsPackageRelatedPackageColumns] ReplicatedPackage modAs[Q, locationsPackageColumns] ReverseReplicatedPackages modAs[Q, locationsPackageColumns] PackageLocationsPackagedownloadtasks modAs[Q, locationsPackagedownloadtaskColumns] } func (j locationsPackageJoins[Q]) aliasedAs(alias string) locationsPackageJoins[Q] { return buildLocationsPackageJoins[Q](buildLocationsPackageColumns(alias), j.typ) } func buildLocationsPackageJoins[Q dialect.Joinable](cols locationsPackageColumns, typ string) locationsPackageJoins[Q] { return locationsPackageJoins[Q]{ typ: typ, PackageLocationsEvents: modAs[Q, locationsEventColumns]{ c: LocationsEvents.Columns, f: func(to locationsEventColumns) bob.Mod[Q] { mods := make(mods.QueryMods[Q], 0, 1) { mods = append(mods, dialect.Join[Q](typ, LocationsEvents.Name().As(to.Alias())).On( to.PackageID.EQ(cols.UUID), )) } return mods }, }, PackageLocationsFiles: modAs[Q, locationsFileColumns]{ c: LocationsFiles.Columns, f: func(to locationsFileColumns) bob.Mod[Q] { mods := make(mods.QueryMods[Q], 0, 1) { mods = append(mods, dialect.Join[Q](typ, LocationsFiles.Name().As(to.Alias())).On( to.PackageID.EQ(cols.ID), )) } return mods }, }, PackageLocationsFixitylogs: modAs[Q, locationsFixitylogColumns]{ c: LocationsFixitylogs.Columns, f: func(to locationsFixitylogColumns) bob.Mod[Q] { mods := make(mods.QueryMods[Q], 0, 1) { mods = append(mods, dialect.Join[Q](typ, LocationsFixitylogs.Name().As(to.Alias())).On( to.PackageID.EQ(cols.UUID), )) } return mods }, }, CurrentLocationLocationsLocation: modAs[Q, locationsLocationColumns]{ c: LocationsLocations.Columns, f: func(to locationsLocationColumns) bob.Mod[Q] { mods := make(mods.QueryMods[Q], 0, 1) { mods = append(mods, dialect.Join[Q](typ, LocationsLocations.Name().As(to.Alias())).On( to.UUID.EQ(cols.CurrentLocationID), )) } return mods }, }, OriginPipelineLocationsPipeline: modAs[Q, locationsPipelineColumns]{ c: LocationsPipelines.Columns, f: func(to locationsPipelineColumns) bob.Mod[Q] { mods := make(mods.QueryMods[Q], 0, 1) { mods = append(mods, dialect.Join[Q](typ, LocationsPipelines.Name().As(to.Alias())).On( to.UUID.EQ(cols.OriginPipelineID), )) } return mods }, }, PointerFileLocationLocationsLocation: modAs[Q, locationsLocationColumns]{ c: LocationsLocations.Columns, f: func(to locationsLocationColumns) bob.Mod[Q] { mods := make(mods.QueryMods[Q], 0, 1) { mods = append(mods, dialect.Join[Q](typ, LocationsLocations.Name().As(to.Alias())).On( to.UUID.EQ(cols.PointerFileLocationID), )) } return mods }, }, FromPackageLocationsPackageRelatedPackages: modAs[Q, locationsPackageRelatedPackageColumns]{ c: LocationsPackageRelatedPackages.Columns, f: func(to locationsPackageRelatedPackageColumns) bob.Mod[Q] { mods := make(mods.QueryMods[Q], 0, 1) { mods = append(mods, dialect.Join[Q](typ, LocationsPackageRelatedPackages.Name().As(to.Alias())).On( to.FromPackageID.EQ(cols.ID), )) } return mods }, }, ToPackageLocationsPackageRelatedPackages: modAs[Q, locationsPackageRelatedPackageColumns]{ c: LocationsPackageRelatedPackages.Columns, f: func(to locationsPackageRelatedPackageColumns) bob.Mod[Q] { mods := make(mods.QueryMods[Q], 0, 1) { mods = append(mods, dialect.Join[Q](typ, LocationsPackageRelatedPackages.Name().As(to.Alias())).On( to.ToPackageID.EQ(cols.ID), )) } return mods }, }, ReplicatedPackage: modAs[Q, locationsPackageColumns]{ c: LocationsPackages.Columns, f: func(to locationsPackageColumns) bob.Mod[Q] { mods := make(mods.QueryMods[Q], 0, 1) { mods = append(mods, dialect.Join[Q](typ, LocationsPackages.Name().As(to.Alias())).On( to.UUID.EQ(cols.ReplicatedPackageID), )) } return mods }, }, ReverseReplicatedPackages: modAs[Q, locationsPackageColumns]{ c: LocationsPackages.Columns, f: func(to locationsPackageColumns) bob.Mod[Q] { mods := make(mods.QueryMods[Q], 0, 1) { mods = append(mods, dialect.Join[Q](typ, LocationsPackages.Name().As(to.Alias())).On( to.ReplicatedPackageID.EQ(cols.UUID), )) } return mods }, }, PackageLocationsPackagedownloadtasks: modAs[Q, locationsPackagedownloadtaskColumns]{ c: LocationsPackagedownloadtasks.Columns, f: func(to locationsPackagedownloadtaskColumns) bob.Mod[Q] { mods := make(mods.QueryMods[Q], 0, 1) { mods = append(mods, dialect.Join[Q](typ, LocationsPackagedownloadtasks.Name().As(to.Alias())).On( to.PackageID.EQ(cols.UUID), )) } return mods }, }, } }