Add support for satellite tiles, with caching
This commit is contained in:
parent
61351dabf1
commit
b6e1bffd79
18 changed files with 1318 additions and 241 deletions
|
|
@ -7,7 +7,7 @@ var TileCachedImageErrors = &tileCachedImageErrors{
|
|||
ErrUniqueCachedImagePkey: &UniqueConstraintError{
|
||||
schema: "tile",
|
||||
table: "cached_image",
|
||||
columns: []string{"arcgis_id", "x", "y", "z"},
|
||||
columns: []string{"service_id", "x", "y", "z"},
|
||||
s: "cached_image_pkey",
|
||||
},
|
||||
}
|
||||
|
|
|
|||
26
db/dberrors/tile.service.bob.go
Normal file
26
db/dberrors/tile.service.bob.go
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
// Code generated by BobGen psql v0.42.5. DO NOT EDIT.
|
||||
// This file is meant to be re-generated in place and/or deleted at any time.
|
||||
|
||||
package dberrors
|
||||
|
||||
var TileServiceErrors = &tileServiceErrors{
|
||||
ErrUniqueServicePkey: &UniqueConstraintError{
|
||||
schema: "tile",
|
||||
table: "service",
|
||||
columns: []string{"id"},
|
||||
s: "service_pkey",
|
||||
},
|
||||
|
||||
ErrUniqueServiceNameUnique: &UniqueConstraintError{
|
||||
schema: "tile",
|
||||
table: "service",
|
||||
columns: []string{"name"},
|
||||
s: "service_name_unique",
|
||||
},
|
||||
}
|
||||
|
||||
type tileServiceErrors struct {
|
||||
ErrUniqueServicePkey *UniqueConstraintError
|
||||
|
||||
ErrUniqueServiceNameUnique *UniqueConstraintError
|
||||
}
|
||||
|
|
@ -15,15 +15,6 @@ var TileCachedImages = Table[
|
|||
Schema: "tile",
|
||||
Name: "cached_image",
|
||||
Columns: tileCachedImageColumns{
|
||||
ArcgisID: column{
|
||||
Name: "arcgis_id",
|
||||
DBType: "text",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
X: column{
|
||||
Name: "x",
|
||||
DBType: "integer",
|
||||
|
|
@ -60,6 +51,15 @@ var TileCachedImages = Table[
|
|||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
ServiceID: column{
|
||||
Name: "service_id",
|
||||
DBType: "integer",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
},
|
||||
Indexes: tileCachedImageIndexes{
|
||||
CachedImagePkey: index{
|
||||
|
|
@ -67,7 +67,7 @@ var TileCachedImages = Table[
|
|||
Name: "cached_image_pkey",
|
||||
Columns: []indexColumn{
|
||||
{
|
||||
Name: "arcgis_id",
|
||||
Name: "service_id",
|
||||
Desc: null.FromCond(false, true),
|
||||
IsExpression: false,
|
||||
},
|
||||
|
|
@ -97,18 +97,18 @@ var TileCachedImages = Table[
|
|||
},
|
||||
PrimaryKey: &constraint{
|
||||
Name: "cached_image_pkey",
|
||||
Columns: []string{"arcgis_id", "x", "y", "z"},
|
||||
Columns: []string{"service_id", "x", "y", "z"},
|
||||
Comment: "",
|
||||
},
|
||||
ForeignKeys: tileCachedImageForeignKeys{
|
||||
TileCachedImageCachedImageArcgisIDFkey: foreignKey{
|
||||
TileCachedImageCachedImageServiceIDFkey: foreignKey{
|
||||
constraint: constraint{
|
||||
Name: "tile.cached_image.cached_image_arcgis_id_fkey",
|
||||
Columns: []string{"arcgis_id"},
|
||||
Name: "tile.cached_image.cached_image_service_id_fkey",
|
||||
Columns: []string{"service_id"},
|
||||
Comment: "",
|
||||
},
|
||||
ForeignTable: "arcgis.service_map",
|
||||
ForeignColumns: []string{"arcgis_id"},
|
||||
ForeignTable: "tile.service",
|
||||
ForeignColumns: []string{"id"},
|
||||
},
|
||||
},
|
||||
|
||||
|
|
@ -116,16 +116,16 @@ var TileCachedImages = Table[
|
|||
}
|
||||
|
||||
type tileCachedImageColumns struct {
|
||||
ArcgisID column
|
||||
X column
|
||||
Y column
|
||||
Z column
|
||||
IsEmpty column
|
||||
X column
|
||||
Y column
|
||||
Z column
|
||||
IsEmpty column
|
||||
ServiceID column
|
||||
}
|
||||
|
||||
func (c tileCachedImageColumns) AsSlice() []column {
|
||||
return []column{
|
||||
c.ArcgisID, c.X, c.Y, c.Z, c.IsEmpty,
|
||||
c.X, c.Y, c.Z, c.IsEmpty, c.ServiceID,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -140,12 +140,12 @@ func (i tileCachedImageIndexes) AsSlice() []index {
|
|||
}
|
||||
|
||||
type tileCachedImageForeignKeys struct {
|
||||
TileCachedImageCachedImageArcgisIDFkey foreignKey
|
||||
TileCachedImageCachedImageServiceIDFkey foreignKey
|
||||
}
|
||||
|
||||
func (f tileCachedImageForeignKeys) AsSlice() []foreignKey {
|
||||
return []foreignKey{
|
||||
f.TileCachedImageCachedImageArcgisIDFkey,
|
||||
f.TileCachedImageCachedImageServiceIDFkey,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
156
db/dbinfo/tile.service.bob.go
Normal file
156
db/dbinfo/tile.service.bob.go
Normal file
|
|
@ -0,0 +1,156 @@
|
|||
// Code generated by BobGen psql v0.42.5. DO NOT EDIT.
|
||||
// This file is meant to be re-generated in place and/or deleted at any time.
|
||||
|
||||
package dbinfo
|
||||
|
||||
import "github.com/aarondl/opt/null"
|
||||
|
||||
var TileServices = Table[
|
||||
tileServiceColumns,
|
||||
tileServiceIndexes,
|
||||
tileServiceForeignKeys,
|
||||
tileServiceUniques,
|
||||
tileServiceChecks,
|
||||
]{
|
||||
Schema: "tile",
|
||||
Name: "service",
|
||||
Columns: tileServiceColumns{
|
||||
ID: column{
|
||||
Name: "id",
|
||||
DBType: "integer",
|
||||
Default: "nextval('tile.service_id_seq'::regclass)",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
Name: column{
|
||||
Name: "name",
|
||||
DBType: "text",
|
||||
Default: "",
|
||||
Comment: "",
|
||||
Nullable: false,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
ArcgisID: column{
|
||||
Name: "arcgis_id",
|
||||
DBType: "text",
|
||||
Default: "NULL",
|
||||
Comment: "",
|
||||
Nullable: true,
|
||||
Generated: false,
|
||||
AutoIncr: false,
|
||||
},
|
||||
},
|
||||
Indexes: tileServiceIndexes{
|
||||
ServicePkey: index{
|
||||
Type: "btree",
|
||||
Name: "service_pkey",
|
||||
Columns: []indexColumn{
|
||||
{
|
||||
Name: "id",
|
||||
Desc: null.FromCond(false, true),
|
||||
IsExpression: false,
|
||||
},
|
||||
},
|
||||
Unique: true,
|
||||
Comment: "",
|
||||
NullsFirst: []bool{false},
|
||||
NullsDistinct: false,
|
||||
Where: "",
|
||||
Include: []string{},
|
||||
},
|
||||
ServiceNameUnique: index{
|
||||
Type: "btree",
|
||||
Name: "service_name_unique",
|
||||
Columns: []indexColumn{
|
||||
{
|
||||
Name: "name",
|
||||
Desc: null.FromCond(false, true),
|
||||
IsExpression: false,
|
||||
},
|
||||
},
|
||||
Unique: true,
|
||||
Comment: "",
|
||||
NullsFirst: []bool{false},
|
||||
NullsDistinct: false,
|
||||
Where: "",
|
||||
Include: []string{},
|
||||
},
|
||||
},
|
||||
PrimaryKey: &constraint{
|
||||
Name: "service_pkey",
|
||||
Columns: []string{"id"},
|
||||
Comment: "",
|
||||
},
|
||||
ForeignKeys: tileServiceForeignKeys{
|
||||
TileServiceServiceArcgisIDFkey: foreignKey{
|
||||
constraint: constraint{
|
||||
Name: "tile.service.service_arcgis_id_fkey",
|
||||
Columns: []string{"arcgis_id"},
|
||||
Comment: "",
|
||||
},
|
||||
ForeignTable: "arcgis.service_map",
|
||||
ForeignColumns: []string{"arcgis_id"},
|
||||
},
|
||||
},
|
||||
Uniques: tileServiceUniques{
|
||||
ServiceNameUnique: constraint{
|
||||
Name: "service_name_unique",
|
||||
Columns: []string{"name"},
|
||||
Comment: "",
|
||||
},
|
||||
},
|
||||
|
||||
Comment: "",
|
||||
}
|
||||
|
||||
type tileServiceColumns struct {
|
||||
ID column
|
||||
Name column
|
||||
ArcgisID column
|
||||
}
|
||||
|
||||
func (c tileServiceColumns) AsSlice() []column {
|
||||
return []column{
|
||||
c.ID, c.Name, c.ArcgisID,
|
||||
}
|
||||
}
|
||||
|
||||
type tileServiceIndexes struct {
|
||||
ServicePkey index
|
||||
ServiceNameUnique index
|
||||
}
|
||||
|
||||
func (i tileServiceIndexes) AsSlice() []index {
|
||||
return []index{
|
||||
i.ServicePkey, i.ServiceNameUnique,
|
||||
}
|
||||
}
|
||||
|
||||
type tileServiceForeignKeys struct {
|
||||
TileServiceServiceArcgisIDFkey foreignKey
|
||||
}
|
||||
|
||||
func (f tileServiceForeignKeys) AsSlice() []foreignKey {
|
||||
return []foreignKey{
|
||||
f.TileServiceServiceArcgisIDFkey,
|
||||
}
|
||||
}
|
||||
|
||||
type tileServiceUniques struct {
|
||||
ServiceNameUnique constraint
|
||||
}
|
||||
|
||||
func (u tileServiceUniques) AsSlice() []constraint {
|
||||
return []constraint{
|
||||
u.ServiceNameUnique,
|
||||
}
|
||||
}
|
||||
|
||||
type tileServiceChecks struct{}
|
||||
|
||||
func (c tileServiceChecks) AsSlice() []check {
|
||||
return []check{}
|
||||
}
|
||||
25
db/migrations/00142_tile_image_provider.sql
Normal file
25
db/migrations/00142_tile_image_provider.sql
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
-- +goose Up
|
||||
CREATE TABLE tile.service (
|
||||
id SERIAL,
|
||||
name TEXT NOT NULL,
|
||||
arcgis_id TEXT REFERENCES arcgis.service_map(arcgis_id),
|
||||
PRIMARY KEY(id)
|
||||
);
|
||||
|
||||
INSERT INTO tile.service (name, arcgis_id)
|
||||
SELECT name, arcgis_id
|
||||
FROM arcgis.service_map;
|
||||
|
||||
ALTER TABLE tile.cached_image ADD COLUMN service_id INTEGER REFERENCES tile.service(id);
|
||||
|
||||
UPDATE tile.cached_image
|
||||
SET service_id = tile.service.id
|
||||
FROM tile.service
|
||||
WHERE tile.service.arcgis_id = tile.cached_image.arcgis_id;
|
||||
|
||||
ALTER TABLE tile.cached_image
|
||||
DROP CONSTRAINT cached_image_pkey,
|
||||
ALTER COLUMN arcgis_id DROP NOT NULL,
|
||||
ALTER COLUMN service_id SET NOT NULL,
|
||||
ADD PRIMARY KEY (service_id, x, y, z),
|
||||
DROP COLUMN arcgis_id;
|
||||
7
db/migrations/00143_tile_service_stadia.sql
Normal file
7
db/migrations/00143_tile_service_stadia.sql
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
-- +goose Up
|
||||
INSERT INTO tile.service (name, arcgis_id) VALUES ('stadia', NULL);
|
||||
ALTER TABLE tile.service
|
||||
ADD CONSTRAINT service_name_unique UNIQUE (name);
|
||||
-- +goose Down
|
||||
ALTER TABLE tile.service DROP CONSTRAINT service_name_unique;
|
||||
DELETE FROM tile.service WHERE name = 'stadia';
|
||||
|
|
@ -44,9 +44,9 @@ type ArcgisServiceMapsQuery = *psql.ViewQuery[*ArcgisServiceMap, ArcgisServiceMa
|
|||
|
||||
// arcgisServiceMapR is where relationships are stored.
|
||||
type arcgisServiceMapR struct {
|
||||
Account *ArcgisAccount // arcgis.service_map.service_map_account_id_fkey
|
||||
ArcgisMapServiceOrganizations OrganizationSlice // organization.organization_arcgis_map_service_id_fkey
|
||||
ArcgisCachedImages TileCachedImageSlice // tile.cached_image.cached_image_arcgis_id_fkey
|
||||
Account *ArcgisAccount // arcgis.service_map.service_map_account_id_fkey
|
||||
ArcgisMapServiceOrganizations OrganizationSlice // organization.organization_arcgis_map_service_id_fkey
|
||||
ArcgisServices TileServiceSlice // tile.service.service_arcgis_id_fkey
|
||||
}
|
||||
|
||||
func buildArcgisServiceMapColumns(alias string) arcgisServiceMapColumns {
|
||||
|
|
@ -487,14 +487,14 @@ func (os ArcgisServiceMapSlice) ArcgisMapServiceOrganizations(mods ...bob.Mod[*d
|
|||
)...)
|
||||
}
|
||||
|
||||
// ArcgisCachedImages starts a query for related objects on tile.cached_image
|
||||
func (o *ArcgisServiceMap) ArcgisCachedImages(mods ...bob.Mod[*dialect.SelectQuery]) TileCachedImagesQuery {
|
||||
return TileCachedImages.Query(append(mods,
|
||||
sm.Where(TileCachedImages.Columns.ArcgisID.EQ(psql.Arg(o.ArcgisID))),
|
||||
// ArcgisServices starts a query for related objects on tile.service
|
||||
func (o *ArcgisServiceMap) ArcgisServices(mods ...bob.Mod[*dialect.SelectQuery]) TileServicesQuery {
|
||||
return TileServices.Query(append(mods,
|
||||
sm.Where(TileServices.Columns.ArcgisID.EQ(psql.Arg(o.ArcgisID))),
|
||||
)...)
|
||||
}
|
||||
|
||||
func (os ArcgisServiceMapSlice) ArcgisCachedImages(mods ...bob.Mod[*dialect.SelectQuery]) TileCachedImagesQuery {
|
||||
func (os ArcgisServiceMapSlice) ArcgisServices(mods ...bob.Mod[*dialect.SelectQuery]) TileServicesQuery {
|
||||
pkArcgisID := make(pgtypes.Array[string], 0, len(os))
|
||||
for _, o := range os {
|
||||
if o == nil {
|
||||
|
|
@ -506,8 +506,8 @@ func (os ArcgisServiceMapSlice) ArcgisCachedImages(mods ...bob.Mod[*dialect.Sele
|
|||
psql.F("unnest", psql.Cast(psql.Arg(pkArcgisID), "text[]")),
|
||||
))
|
||||
|
||||
return TileCachedImages.Query(append(mods,
|
||||
sm.Where(psql.Group(TileCachedImages.Columns.ArcgisID).OP("IN", PKArgExpr)),
|
||||
return TileServices.Query(append(mods,
|
||||
sm.Where(psql.Group(TileServices.Columns.ArcgisID).OP("IN", PKArgExpr)),
|
||||
)...)
|
||||
}
|
||||
|
||||
|
|
@ -627,66 +627,66 @@ func (arcgisServiceMap0 *ArcgisServiceMap) AttachArcgisMapServiceOrganizations(c
|
|||
return nil
|
||||
}
|
||||
|
||||
func insertArcgisServiceMapArcgisCachedImages0(ctx context.Context, exec bob.Executor, tileCachedImages1 []*TileCachedImageSetter, arcgisServiceMap0 *ArcgisServiceMap) (TileCachedImageSlice, error) {
|
||||
for i := range tileCachedImages1 {
|
||||
tileCachedImages1[i].ArcgisID = omit.From(arcgisServiceMap0.ArcgisID)
|
||||
func insertArcgisServiceMapArcgisServices0(ctx context.Context, exec bob.Executor, tileServices1 []*TileServiceSetter, arcgisServiceMap0 *ArcgisServiceMap) (TileServiceSlice, error) {
|
||||
for i := range tileServices1 {
|
||||
tileServices1[i].ArcgisID = omitnull.From(arcgisServiceMap0.ArcgisID)
|
||||
}
|
||||
|
||||
ret, err := TileCachedImages.Insert(bob.ToMods(tileCachedImages1...)).All(ctx, exec)
|
||||
ret, err := TileServices.Insert(bob.ToMods(tileServices1...)).All(ctx, exec)
|
||||
if err != nil {
|
||||
return ret, fmt.Errorf("insertArcgisServiceMapArcgisCachedImages0: %w", err)
|
||||
return ret, fmt.Errorf("insertArcgisServiceMapArcgisServices0: %w", err)
|
||||
}
|
||||
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
func attachArcgisServiceMapArcgisCachedImages0(ctx context.Context, exec bob.Executor, count int, tileCachedImages1 TileCachedImageSlice, arcgisServiceMap0 *ArcgisServiceMap) (TileCachedImageSlice, error) {
|
||||
setter := &TileCachedImageSetter{
|
||||
ArcgisID: omit.From(arcgisServiceMap0.ArcgisID),
|
||||
func attachArcgisServiceMapArcgisServices0(ctx context.Context, exec bob.Executor, count int, tileServices1 TileServiceSlice, arcgisServiceMap0 *ArcgisServiceMap) (TileServiceSlice, error) {
|
||||
setter := &TileServiceSetter{
|
||||
ArcgisID: omitnull.From(arcgisServiceMap0.ArcgisID),
|
||||
}
|
||||
|
||||
err := tileCachedImages1.UpdateAll(ctx, exec, *setter)
|
||||
err := tileServices1.UpdateAll(ctx, exec, *setter)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("attachArcgisServiceMapArcgisCachedImages0: %w", err)
|
||||
return nil, fmt.Errorf("attachArcgisServiceMapArcgisServices0: %w", err)
|
||||
}
|
||||
|
||||
return tileCachedImages1, nil
|
||||
return tileServices1, nil
|
||||
}
|
||||
|
||||
func (arcgisServiceMap0 *ArcgisServiceMap) InsertArcgisCachedImages(ctx context.Context, exec bob.Executor, related ...*TileCachedImageSetter) error {
|
||||
func (arcgisServiceMap0 *ArcgisServiceMap) InsertArcgisServices(ctx context.Context, exec bob.Executor, related ...*TileServiceSetter) error {
|
||||
if len(related) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
var err error
|
||||
|
||||
tileCachedImages1, err := insertArcgisServiceMapArcgisCachedImages0(ctx, exec, related, arcgisServiceMap0)
|
||||
tileServices1, err := insertArcgisServiceMapArcgisServices0(ctx, exec, related, arcgisServiceMap0)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
arcgisServiceMap0.R.ArcgisCachedImages = append(arcgisServiceMap0.R.ArcgisCachedImages, tileCachedImages1...)
|
||||
arcgisServiceMap0.R.ArcgisServices = append(arcgisServiceMap0.R.ArcgisServices, tileServices1...)
|
||||
|
||||
for _, rel := range tileCachedImages1 {
|
||||
for _, rel := range tileServices1 {
|
||||
rel.R.ArcgisServiceMap = arcgisServiceMap0
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (arcgisServiceMap0 *ArcgisServiceMap) AttachArcgisCachedImages(ctx context.Context, exec bob.Executor, related ...*TileCachedImage) error {
|
||||
func (arcgisServiceMap0 *ArcgisServiceMap) AttachArcgisServices(ctx context.Context, exec bob.Executor, related ...*TileService) error {
|
||||
if len(related) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
var err error
|
||||
tileCachedImages1 := TileCachedImageSlice(related)
|
||||
tileServices1 := TileServiceSlice(related)
|
||||
|
||||
_, err = attachArcgisServiceMapArcgisCachedImages0(ctx, exec, len(related), tileCachedImages1, arcgisServiceMap0)
|
||||
_, err = attachArcgisServiceMapArcgisServices0(ctx, exec, len(related), tileServices1, arcgisServiceMap0)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
arcgisServiceMap0.R.ArcgisCachedImages = append(arcgisServiceMap0.R.ArcgisCachedImages, tileCachedImages1...)
|
||||
arcgisServiceMap0.R.ArcgisServices = append(arcgisServiceMap0.R.ArcgisServices, tileServices1...)
|
||||
|
||||
for _, rel := range related {
|
||||
rel.R.ArcgisServiceMap = arcgisServiceMap0
|
||||
|
|
@ -749,13 +749,13 @@ func (o *ArcgisServiceMap) Preload(name string, retrieved any) error {
|
|||
}
|
||||
}
|
||||
return nil
|
||||
case "ArcgisCachedImages":
|
||||
rels, ok := retrieved.(TileCachedImageSlice)
|
||||
case "ArcgisServices":
|
||||
rels, ok := retrieved.(TileServiceSlice)
|
||||
if !ok {
|
||||
return fmt.Errorf("arcgisServiceMap cannot load %T as %q", retrieved, name)
|
||||
}
|
||||
|
||||
o.R.ArcgisCachedImages = rels
|
||||
o.R.ArcgisServices = rels
|
||||
|
||||
for _, rel := range rels {
|
||||
if rel != nil {
|
||||
|
|
@ -793,7 +793,7 @@ func buildArcgisServiceMapPreloader() arcgisServiceMapPreloader {
|
|||
type arcgisServiceMapThenLoader[Q orm.Loadable] struct {
|
||||
Account func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q]
|
||||
ArcgisMapServiceOrganizations func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q]
|
||||
ArcgisCachedImages func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q]
|
||||
ArcgisServices func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q]
|
||||
}
|
||||
|
||||
func buildArcgisServiceMapThenLoader[Q orm.Loadable]() arcgisServiceMapThenLoader[Q] {
|
||||
|
|
@ -803,8 +803,8 @@ func buildArcgisServiceMapThenLoader[Q orm.Loadable]() arcgisServiceMapThenLoade
|
|||
type ArcgisMapServiceOrganizationsLoadInterface interface {
|
||||
LoadArcgisMapServiceOrganizations(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error
|
||||
}
|
||||
type ArcgisCachedImagesLoadInterface interface {
|
||||
LoadArcgisCachedImages(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error
|
||||
type ArcgisServicesLoadInterface interface {
|
||||
LoadArcgisServices(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error
|
||||
}
|
||||
|
||||
return arcgisServiceMapThenLoader[Q]{
|
||||
|
|
@ -820,10 +820,10 @@ func buildArcgisServiceMapThenLoader[Q orm.Loadable]() arcgisServiceMapThenLoade
|
|||
return retrieved.LoadArcgisMapServiceOrganizations(ctx, exec, mods...)
|
||||
},
|
||||
),
|
||||
ArcgisCachedImages: thenLoadBuilder[Q](
|
||||
"ArcgisCachedImages",
|
||||
func(ctx context.Context, exec bob.Executor, retrieved ArcgisCachedImagesLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
||||
return retrieved.LoadArcgisCachedImages(ctx, exec, mods...)
|
||||
ArcgisServices: thenLoadBuilder[Q](
|
||||
"ArcgisServices",
|
||||
func(ctx context.Context, exec bob.Executor, retrieved ArcgisServicesLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
||||
return retrieved.LoadArcgisServices(ctx, exec, mods...)
|
||||
},
|
||||
),
|
||||
}
|
||||
|
|
@ -945,16 +945,16 @@ func (os ArcgisServiceMapSlice) LoadArcgisMapServiceOrganizations(ctx context.Co
|
|||
return nil
|
||||
}
|
||||
|
||||
// LoadArcgisCachedImages loads the arcgisServiceMap's ArcgisCachedImages into the .R struct
|
||||
func (o *ArcgisServiceMap) LoadArcgisCachedImages(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
||||
// LoadArcgisServices loads the arcgisServiceMap's ArcgisServices into the .R struct
|
||||
func (o *ArcgisServiceMap) LoadArcgisServices(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Reset the relationship
|
||||
o.R.ArcgisCachedImages = nil
|
||||
o.R.ArcgisServices = nil
|
||||
|
||||
related, err := o.ArcgisCachedImages(mods...).All(ctx, exec)
|
||||
related, err := o.ArcgisServices(mods...).All(ctx, exec)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
@ -963,17 +963,17 @@ func (o *ArcgisServiceMap) LoadArcgisCachedImages(ctx context.Context, exec bob.
|
|||
rel.R.ArcgisServiceMap = o
|
||||
}
|
||||
|
||||
o.R.ArcgisCachedImages = related
|
||||
o.R.ArcgisServices = related
|
||||
return nil
|
||||
}
|
||||
|
||||
// LoadArcgisCachedImages loads the arcgisServiceMap's ArcgisCachedImages into the .R struct
|
||||
func (os ArcgisServiceMapSlice) LoadArcgisCachedImages(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
||||
// LoadArcgisServices loads the arcgisServiceMap's ArcgisServices into the .R struct
|
||||
func (os ArcgisServiceMapSlice) LoadArcgisServices(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
||||
if len(os) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
tileCachedImages, err := os.ArcgisCachedImages(mods...).All(ctx, exec)
|
||||
tileServices, err := os.ArcgisServices(mods...).All(ctx, exec)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
@ -983,7 +983,7 @@ func (os ArcgisServiceMapSlice) LoadArcgisCachedImages(ctx context.Context, exec
|
|||
continue
|
||||
}
|
||||
|
||||
o.R.ArcgisCachedImages = nil
|
||||
o.R.ArcgisServices = nil
|
||||
}
|
||||
|
||||
for _, o := range os {
|
||||
|
|
@ -991,15 +991,18 @@ func (os ArcgisServiceMapSlice) LoadArcgisCachedImages(ctx context.Context, exec
|
|||
continue
|
||||
}
|
||||
|
||||
for _, rel := range tileCachedImages {
|
||||
for _, rel := range tileServices {
|
||||
|
||||
if !(o.ArcgisID == rel.ArcgisID) {
|
||||
if !rel.ArcgisID.IsValue() {
|
||||
continue
|
||||
}
|
||||
if !(rel.ArcgisID.IsValue() && o.ArcgisID == rel.ArcgisID.MustGet()) {
|
||||
continue
|
||||
}
|
||||
|
||||
rel.R.ArcgisServiceMap = o
|
||||
|
||||
o.R.ArcgisCachedImages = append(o.R.ArcgisCachedImages, rel)
|
||||
o.R.ArcgisServices = append(o.R.ArcgisServices, rel)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -114,6 +114,7 @@ type preloaders struct {
|
|||
Signal signalPreloader
|
||||
Site sitePreloader
|
||||
TileCachedImage tileCachedImagePreloader
|
||||
TileService tileServicePreloader
|
||||
User userPreloader
|
||||
}
|
||||
|
||||
|
|
@ -216,6 +217,7 @@ func getPreloaders() preloaders {
|
|||
Signal: buildSignalPreloader(),
|
||||
Site: buildSitePreloader(),
|
||||
TileCachedImage: buildTileCachedImagePreloader(),
|
||||
TileService: buildTileServicePreloader(),
|
||||
User: buildUserPreloader(),
|
||||
}
|
||||
}
|
||||
|
|
@ -324,6 +326,7 @@ type thenLoaders[Q orm.Loadable] struct {
|
|||
Signal signalThenLoader[Q]
|
||||
Site siteThenLoader[Q]
|
||||
TileCachedImage tileCachedImageThenLoader[Q]
|
||||
TileService tileServiceThenLoader[Q]
|
||||
User userThenLoader[Q]
|
||||
}
|
||||
|
||||
|
|
@ -426,6 +429,7 @@ func getThenLoaders[Q orm.Loadable]() thenLoaders[Q] {
|
|||
Signal: buildSignalThenLoader[Q](),
|
||||
Site: buildSiteThenLoader[Q](),
|
||||
TileCachedImage: buildTileCachedImageThenLoader[Q](),
|
||||
TileService: buildTileServiceThenLoader[Q](),
|
||||
User: buildUserThenLoader[Q](),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -124,6 +124,7 @@ func Where[Q psql.Filterable]() struct {
|
|||
SpatialRefSys spatialRefSyWhere[Q]
|
||||
StadiaAPIRequests stadiaAPIRequestWhere[Q]
|
||||
TileCachedImages tileCachedImageWhere[Q]
|
||||
TileServices tileServiceWhere[Q]
|
||||
Users userWhere[Q]
|
||||
} {
|
||||
return struct {
|
||||
|
|
@ -234,6 +235,7 @@ func Where[Q psql.Filterable]() struct {
|
|||
SpatialRefSys spatialRefSyWhere[Q]
|
||||
StadiaAPIRequests stadiaAPIRequestWhere[Q]
|
||||
TileCachedImages tileCachedImageWhere[Q]
|
||||
TileServices tileServiceWhere[Q]
|
||||
Users userWhere[Q]
|
||||
}{
|
||||
Addresses: buildAddressWhere[Q](Addresses.Columns),
|
||||
|
|
@ -343,6 +345,7 @@ func Where[Q psql.Filterable]() struct {
|
|||
SpatialRefSys: buildSpatialRefSyWhere[Q](SpatialRefSys.Columns),
|
||||
StadiaAPIRequests: buildStadiaAPIRequestWhere[Q](StadiaAPIRequests.Columns),
|
||||
TileCachedImages: buildTileCachedImageWhere[Q](TileCachedImages.Columns),
|
||||
TileServices: buildTileServiceWhere[Q](TileServices.Columns),
|
||||
Users: buildUserWhere[Q](Users.Columns),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,11 +22,11 @@ import (
|
|||
|
||||
// TileCachedImage is an object representing the database table.
|
||||
type TileCachedImage struct {
|
||||
ArcgisID string `db:"arcgis_id,pk" `
|
||||
X int32 `db:"x,pk" `
|
||||
Y int32 `db:"y,pk" `
|
||||
Z int32 `db:"z,pk" `
|
||||
IsEmpty bool `db:"is_empty" `
|
||||
X int32 `db:"x,pk" `
|
||||
Y int32 `db:"y,pk" `
|
||||
Z int32 `db:"z,pk" `
|
||||
IsEmpty bool `db:"is_empty" `
|
||||
ServiceID int32 `db:"service_id,pk" `
|
||||
|
||||
R tileCachedImageR `db:"-" `
|
||||
}
|
||||
|
|
@ -43,31 +43,31 @@ type TileCachedImagesQuery = *psql.ViewQuery[*TileCachedImage, TileCachedImageSl
|
|||
|
||||
// tileCachedImageR is where relationships are stored.
|
||||
type tileCachedImageR struct {
|
||||
ArcgisServiceMap *ArcgisServiceMap // tile.cached_image.cached_image_arcgis_id_fkey
|
||||
Service *TileService // tile.cached_image.cached_image_service_id_fkey
|
||||
}
|
||||
|
||||
func buildTileCachedImageColumns(alias string) tileCachedImageColumns {
|
||||
return tileCachedImageColumns{
|
||||
ColumnsExpr: expr.NewColumnsExpr(
|
||||
"arcgis_id", "x", "y", "z", "is_empty",
|
||||
"x", "y", "z", "is_empty", "service_id",
|
||||
).WithParent("tile.cached_image"),
|
||||
tableAlias: alias,
|
||||
ArcgisID: psql.Quote(alias, "arcgis_id"),
|
||||
X: psql.Quote(alias, "x"),
|
||||
Y: psql.Quote(alias, "y"),
|
||||
Z: psql.Quote(alias, "z"),
|
||||
IsEmpty: psql.Quote(alias, "is_empty"),
|
||||
ServiceID: psql.Quote(alias, "service_id"),
|
||||
}
|
||||
}
|
||||
|
||||
type tileCachedImageColumns struct {
|
||||
expr.ColumnsExpr
|
||||
tableAlias string
|
||||
ArcgisID psql.Expression
|
||||
X psql.Expression
|
||||
Y psql.Expression
|
||||
Z psql.Expression
|
||||
IsEmpty psql.Expression
|
||||
ServiceID psql.Expression
|
||||
}
|
||||
|
||||
func (c tileCachedImageColumns) Alias() string {
|
||||
|
|
@ -82,18 +82,15 @@ func (tileCachedImageColumns) AliasedAs(alias string) tileCachedImageColumns {
|
|||
// All values are optional, and do not have to be set
|
||||
// Generated columns are not included
|
||||
type TileCachedImageSetter struct {
|
||||
ArcgisID omit.Val[string] `db:"arcgis_id,pk" `
|
||||
X omit.Val[int32] `db:"x,pk" `
|
||||
Y omit.Val[int32] `db:"y,pk" `
|
||||
Z omit.Val[int32] `db:"z,pk" `
|
||||
IsEmpty omit.Val[bool] `db:"is_empty" `
|
||||
X omit.Val[int32] `db:"x,pk" `
|
||||
Y omit.Val[int32] `db:"y,pk" `
|
||||
Z omit.Val[int32] `db:"z,pk" `
|
||||
IsEmpty omit.Val[bool] `db:"is_empty" `
|
||||
ServiceID omit.Val[int32] `db:"service_id,pk" `
|
||||
}
|
||||
|
||||
func (s TileCachedImageSetter) SetColumns() []string {
|
||||
vals := make([]string, 0, 5)
|
||||
if s.ArcgisID.IsValue() {
|
||||
vals = append(vals, "arcgis_id")
|
||||
}
|
||||
if s.X.IsValue() {
|
||||
vals = append(vals, "x")
|
||||
}
|
||||
|
|
@ -106,13 +103,13 @@ func (s TileCachedImageSetter) SetColumns() []string {
|
|||
if s.IsEmpty.IsValue() {
|
||||
vals = append(vals, "is_empty")
|
||||
}
|
||||
if s.ServiceID.IsValue() {
|
||||
vals = append(vals, "service_id")
|
||||
}
|
||||
return vals
|
||||
}
|
||||
|
||||
func (s TileCachedImageSetter) Overwrite(t *TileCachedImage) {
|
||||
if s.ArcgisID.IsValue() {
|
||||
t.ArcgisID = s.ArcgisID.MustGet()
|
||||
}
|
||||
if s.X.IsValue() {
|
||||
t.X = s.X.MustGet()
|
||||
}
|
||||
|
|
@ -125,6 +122,9 @@ func (s TileCachedImageSetter) Overwrite(t *TileCachedImage) {
|
|||
if s.IsEmpty.IsValue() {
|
||||
t.IsEmpty = s.IsEmpty.MustGet()
|
||||
}
|
||||
if s.ServiceID.IsValue() {
|
||||
t.ServiceID = s.ServiceID.MustGet()
|
||||
}
|
||||
}
|
||||
|
||||
func (s *TileCachedImageSetter) Apply(q *dialect.InsertQuery) {
|
||||
|
|
@ -134,32 +134,32 @@ func (s *TileCachedImageSetter) Apply(q *dialect.InsertQuery) {
|
|||
|
||||
q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) {
|
||||
vals := make([]bob.Expression, 5)
|
||||
if s.ArcgisID.IsValue() {
|
||||
vals[0] = psql.Arg(s.ArcgisID.MustGet())
|
||||
if s.X.IsValue() {
|
||||
vals[0] = psql.Arg(s.X.MustGet())
|
||||
} else {
|
||||
vals[0] = psql.Raw("DEFAULT")
|
||||
}
|
||||
|
||||
if s.X.IsValue() {
|
||||
vals[1] = psql.Arg(s.X.MustGet())
|
||||
if s.Y.IsValue() {
|
||||
vals[1] = psql.Arg(s.Y.MustGet())
|
||||
} else {
|
||||
vals[1] = psql.Raw("DEFAULT")
|
||||
}
|
||||
|
||||
if s.Y.IsValue() {
|
||||
vals[2] = psql.Arg(s.Y.MustGet())
|
||||
if s.Z.IsValue() {
|
||||
vals[2] = psql.Arg(s.Z.MustGet())
|
||||
} else {
|
||||
vals[2] = psql.Raw("DEFAULT")
|
||||
}
|
||||
|
||||
if s.Z.IsValue() {
|
||||
vals[3] = psql.Arg(s.Z.MustGet())
|
||||
if s.IsEmpty.IsValue() {
|
||||
vals[3] = psql.Arg(s.IsEmpty.MustGet())
|
||||
} else {
|
||||
vals[3] = psql.Raw("DEFAULT")
|
||||
}
|
||||
|
||||
if s.IsEmpty.IsValue() {
|
||||
vals[4] = psql.Arg(s.IsEmpty.MustGet())
|
||||
if s.ServiceID.IsValue() {
|
||||
vals[4] = psql.Arg(s.ServiceID.MustGet())
|
||||
} else {
|
||||
vals[4] = psql.Raw("DEFAULT")
|
||||
}
|
||||
|
|
@ -175,13 +175,6 @@ func (s TileCachedImageSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] {
|
|||
func (s TileCachedImageSetter) Expressions(prefix ...string) []bob.Expression {
|
||||
exprs := make([]bob.Expression, 0, 5)
|
||||
|
||||
if s.ArcgisID.IsValue() {
|
||||
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
||||
psql.Quote(append(prefix, "arcgis_id")...),
|
||||
psql.Arg(s.ArcgisID),
|
||||
}})
|
||||
}
|
||||
|
||||
if s.X.IsValue() {
|
||||
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
||||
psql.Quote(append(prefix, "x")...),
|
||||
|
|
@ -210,15 +203,22 @@ func (s TileCachedImageSetter) Expressions(prefix ...string) []bob.Expression {
|
|||
}})
|
||||
}
|
||||
|
||||
if s.ServiceID.IsValue() {
|
||||
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
||||
psql.Quote(append(prefix, "service_id")...),
|
||||
psql.Arg(s.ServiceID),
|
||||
}})
|
||||
}
|
||||
|
||||
return exprs
|
||||
}
|
||||
|
||||
// FindTileCachedImage retrieves a single record by primary key
|
||||
// If cols is empty Find will return all columns.
|
||||
func FindTileCachedImage(ctx context.Context, exec bob.Executor, ArcgisIDPK string, XPK int32, YPK int32, ZPK int32, cols ...string) (*TileCachedImage, error) {
|
||||
func FindTileCachedImage(ctx context.Context, exec bob.Executor, ServiceIDPK int32, XPK int32, YPK int32, ZPK int32, cols ...string) (*TileCachedImage, error) {
|
||||
if len(cols) == 0 {
|
||||
return TileCachedImages.Query(
|
||||
sm.Where(TileCachedImages.Columns.ArcgisID.EQ(psql.Arg(ArcgisIDPK))),
|
||||
sm.Where(TileCachedImages.Columns.ServiceID.EQ(psql.Arg(ServiceIDPK))),
|
||||
sm.Where(TileCachedImages.Columns.X.EQ(psql.Arg(XPK))),
|
||||
sm.Where(TileCachedImages.Columns.Y.EQ(psql.Arg(YPK))),
|
||||
sm.Where(TileCachedImages.Columns.Z.EQ(psql.Arg(ZPK))),
|
||||
|
|
@ -226,7 +226,7 @@ func FindTileCachedImage(ctx context.Context, exec bob.Executor, ArcgisIDPK stri
|
|||
}
|
||||
|
||||
return TileCachedImages.Query(
|
||||
sm.Where(TileCachedImages.Columns.ArcgisID.EQ(psql.Arg(ArcgisIDPK))),
|
||||
sm.Where(TileCachedImages.Columns.ServiceID.EQ(psql.Arg(ServiceIDPK))),
|
||||
sm.Where(TileCachedImages.Columns.X.EQ(psql.Arg(XPK))),
|
||||
sm.Where(TileCachedImages.Columns.Y.EQ(psql.Arg(YPK))),
|
||||
sm.Where(TileCachedImages.Columns.Z.EQ(psql.Arg(ZPK))),
|
||||
|
|
@ -235,9 +235,9 @@ func FindTileCachedImage(ctx context.Context, exec bob.Executor, ArcgisIDPK stri
|
|||
}
|
||||
|
||||
// TileCachedImageExists checks the presence of a single record by primary key
|
||||
func TileCachedImageExists(ctx context.Context, exec bob.Executor, ArcgisIDPK string, XPK int32, YPK int32, ZPK int32) (bool, error) {
|
||||
func TileCachedImageExists(ctx context.Context, exec bob.Executor, ServiceIDPK int32, XPK int32, YPK int32, ZPK int32) (bool, error) {
|
||||
return TileCachedImages.Query(
|
||||
sm.Where(TileCachedImages.Columns.ArcgisID.EQ(psql.Arg(ArcgisIDPK))),
|
||||
sm.Where(TileCachedImages.Columns.ServiceID.EQ(psql.Arg(ServiceIDPK))),
|
||||
sm.Where(TileCachedImages.Columns.X.EQ(psql.Arg(XPK))),
|
||||
sm.Where(TileCachedImages.Columns.Y.EQ(psql.Arg(YPK))),
|
||||
sm.Where(TileCachedImages.Columns.Z.EQ(psql.Arg(ZPK))),
|
||||
|
|
@ -265,7 +265,7 @@ func (o *TileCachedImage) AfterQueryHook(ctx context.Context, exec bob.Executor,
|
|||
// primaryKeyVals returns the primary key values of the TileCachedImage
|
||||
func (o *TileCachedImage) primaryKeyVals() bob.Expression {
|
||||
return psql.ArgGroup(
|
||||
o.ArcgisID,
|
||||
o.ServiceID,
|
||||
o.X,
|
||||
o.Y,
|
||||
o.Z,
|
||||
|
|
@ -273,7 +273,7 @@ func (o *TileCachedImage) primaryKeyVals() bob.Expression {
|
|||
}
|
||||
|
||||
func (o *TileCachedImage) pkEQ() dialect.Expression {
|
||||
return psql.Group(psql.Quote("tile.cached_image", "arcgis_id"), psql.Quote("tile.cached_image", "x"), psql.Quote("tile.cached_image", "y"), psql.Quote("tile.cached_image", "z")).EQ(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) {
|
||||
return psql.Group(psql.Quote("tile.cached_image", "service_id"), psql.Quote("tile.cached_image", "x"), psql.Quote("tile.cached_image", "y"), psql.Quote("tile.cached_image", "z")).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)
|
||||
}))
|
||||
}
|
||||
|
|
@ -300,7 +300,7 @@ func (o *TileCachedImage) Delete(ctx context.Context, exec bob.Executor) error {
|
|||
// Reload refreshes the TileCachedImage using the executor
|
||||
func (o *TileCachedImage) Reload(ctx context.Context, exec bob.Executor) error {
|
||||
o2, err := TileCachedImages.Query(
|
||||
sm.Where(TileCachedImages.Columns.ArcgisID.EQ(psql.Arg(o.ArcgisID))),
|
||||
sm.Where(TileCachedImages.Columns.ServiceID.EQ(psql.Arg(o.ServiceID))),
|
||||
sm.Where(TileCachedImages.Columns.X.EQ(psql.Arg(o.X))),
|
||||
sm.Where(TileCachedImages.Columns.Y.EQ(psql.Arg(o.Y))),
|
||||
sm.Where(TileCachedImages.Columns.Z.EQ(psql.Arg(o.Z))),
|
||||
|
|
@ -337,7 +337,7 @@ func (o TileCachedImageSlice) pkIN() dialect.Expression {
|
|||
return psql.Raw("NULL")
|
||||
}
|
||||
|
||||
return psql.Group(psql.Quote("tile.cached_image", "arcgis_id"), psql.Quote("tile.cached_image", "x"), psql.Quote("tile.cached_image", "y"), psql.Quote("tile.cached_image", "z")).In(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) {
|
||||
return psql.Group(psql.Quote("tile.cached_image", "service_id"), psql.Quote("tile.cached_image", "x"), psql.Quote("tile.cached_image", "y"), psql.Quote("tile.cached_image", "z")).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()
|
||||
|
|
@ -352,7 +352,7 @@ func (o TileCachedImageSlice) pkIN() dialect.Expression {
|
|||
func (o TileCachedImageSlice) copyMatchingRows(from ...*TileCachedImage) {
|
||||
for i, old := range o {
|
||||
for _, new := range from {
|
||||
if new.ArcgisID != old.ArcgisID {
|
||||
if new.ServiceID != old.ServiceID {
|
||||
continue
|
||||
}
|
||||
if new.X != old.X {
|
||||
|
|
@ -462,84 +462,84 @@ func (o TileCachedImageSlice) ReloadAll(ctx context.Context, exec bob.Executor)
|
|||
return nil
|
||||
}
|
||||
|
||||
// ArcgisServiceMap starts a query for related objects on arcgis.service_map
|
||||
func (o *TileCachedImage) ArcgisServiceMap(mods ...bob.Mod[*dialect.SelectQuery]) ArcgisServiceMapsQuery {
|
||||
return ArcgisServiceMaps.Query(append(mods,
|
||||
sm.Where(ArcgisServiceMaps.Columns.ArcgisID.EQ(psql.Arg(o.ArcgisID))),
|
||||
// Service starts a query for related objects on tile.service
|
||||
func (o *TileCachedImage) Service(mods ...bob.Mod[*dialect.SelectQuery]) TileServicesQuery {
|
||||
return TileServices.Query(append(mods,
|
||||
sm.Where(TileServices.Columns.ID.EQ(psql.Arg(o.ServiceID))),
|
||||
)...)
|
||||
}
|
||||
|
||||
func (os TileCachedImageSlice) ArcgisServiceMap(mods ...bob.Mod[*dialect.SelectQuery]) ArcgisServiceMapsQuery {
|
||||
pkArcgisID := make(pgtypes.Array[string], 0, len(os))
|
||||
func (os TileCachedImageSlice) Service(mods ...bob.Mod[*dialect.SelectQuery]) TileServicesQuery {
|
||||
pkServiceID := make(pgtypes.Array[int32], 0, len(os))
|
||||
for _, o := range os {
|
||||
if o == nil {
|
||||
continue
|
||||
}
|
||||
pkArcgisID = append(pkArcgisID, o.ArcgisID)
|
||||
pkServiceID = append(pkServiceID, o.ServiceID)
|
||||
}
|
||||
PKArgExpr := psql.Select(sm.Columns(
|
||||
psql.F("unnest", psql.Cast(psql.Arg(pkArcgisID), "text[]")),
|
||||
psql.F("unnest", psql.Cast(psql.Arg(pkServiceID), "integer[]")),
|
||||
))
|
||||
|
||||
return ArcgisServiceMaps.Query(append(mods,
|
||||
sm.Where(psql.Group(ArcgisServiceMaps.Columns.ArcgisID).OP("IN", PKArgExpr)),
|
||||
return TileServices.Query(append(mods,
|
||||
sm.Where(psql.Group(TileServices.Columns.ID).OP("IN", PKArgExpr)),
|
||||
)...)
|
||||
}
|
||||
|
||||
func attachTileCachedImageArcgisServiceMap0(ctx context.Context, exec bob.Executor, count int, tileCachedImage0 *TileCachedImage, arcgisServiceMap1 *ArcgisServiceMap) (*TileCachedImage, error) {
|
||||
func attachTileCachedImageService0(ctx context.Context, exec bob.Executor, count int, tileCachedImage0 *TileCachedImage, tileService1 *TileService) (*TileCachedImage, error) {
|
||||
setter := &TileCachedImageSetter{
|
||||
ArcgisID: omit.From(arcgisServiceMap1.ArcgisID),
|
||||
ServiceID: omit.From(tileService1.ID),
|
||||
}
|
||||
|
||||
err := tileCachedImage0.Update(ctx, exec, setter)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("attachTileCachedImageArcgisServiceMap0: %w", err)
|
||||
return nil, fmt.Errorf("attachTileCachedImageService0: %w", err)
|
||||
}
|
||||
|
||||
return tileCachedImage0, nil
|
||||
}
|
||||
|
||||
func (tileCachedImage0 *TileCachedImage) InsertArcgisServiceMap(ctx context.Context, exec bob.Executor, related *ArcgisServiceMapSetter) error {
|
||||
func (tileCachedImage0 *TileCachedImage) InsertService(ctx context.Context, exec bob.Executor, related *TileServiceSetter) error {
|
||||
var err error
|
||||
|
||||
arcgisServiceMap1, err := ArcgisServiceMaps.Insert(related).One(ctx, exec)
|
||||
tileService1, err := TileServices.Insert(related).One(ctx, exec)
|
||||
if err != nil {
|
||||
return fmt.Errorf("inserting related objects: %w", err)
|
||||
}
|
||||
|
||||
_, err = attachTileCachedImageArcgisServiceMap0(ctx, exec, 1, tileCachedImage0, arcgisServiceMap1)
|
||||
_, err = attachTileCachedImageService0(ctx, exec, 1, tileCachedImage0, tileService1)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
tileCachedImage0.R.ArcgisServiceMap = arcgisServiceMap1
|
||||
tileCachedImage0.R.Service = tileService1
|
||||
|
||||
arcgisServiceMap1.R.ArcgisCachedImages = append(arcgisServiceMap1.R.ArcgisCachedImages, tileCachedImage0)
|
||||
tileService1.R.CachedImages = append(tileService1.R.CachedImages, tileCachedImage0)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (tileCachedImage0 *TileCachedImage) AttachArcgisServiceMap(ctx context.Context, exec bob.Executor, arcgisServiceMap1 *ArcgisServiceMap) error {
|
||||
func (tileCachedImage0 *TileCachedImage) AttachService(ctx context.Context, exec bob.Executor, tileService1 *TileService) error {
|
||||
var err error
|
||||
|
||||
_, err = attachTileCachedImageArcgisServiceMap0(ctx, exec, 1, tileCachedImage0, arcgisServiceMap1)
|
||||
_, err = attachTileCachedImageService0(ctx, exec, 1, tileCachedImage0, tileService1)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
tileCachedImage0.R.ArcgisServiceMap = arcgisServiceMap1
|
||||
tileCachedImage0.R.Service = tileService1
|
||||
|
||||
arcgisServiceMap1.R.ArcgisCachedImages = append(arcgisServiceMap1.R.ArcgisCachedImages, tileCachedImage0)
|
||||
tileService1.R.CachedImages = append(tileService1.R.CachedImages, tileCachedImage0)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type tileCachedImageWhere[Q psql.Filterable] struct {
|
||||
ArcgisID psql.WhereMod[Q, string]
|
||||
X psql.WhereMod[Q, int32]
|
||||
Y psql.WhereMod[Q, int32]
|
||||
Z psql.WhereMod[Q, int32]
|
||||
IsEmpty psql.WhereMod[Q, bool]
|
||||
X psql.WhereMod[Q, int32]
|
||||
Y psql.WhereMod[Q, int32]
|
||||
Z psql.WhereMod[Q, int32]
|
||||
IsEmpty psql.WhereMod[Q, bool]
|
||||
ServiceID psql.WhereMod[Q, int32]
|
||||
}
|
||||
|
||||
func (tileCachedImageWhere[Q]) AliasedAs(alias string) tileCachedImageWhere[Q] {
|
||||
|
|
@ -548,11 +548,11 @@ func (tileCachedImageWhere[Q]) AliasedAs(alias string) tileCachedImageWhere[Q] {
|
|||
|
||||
func buildTileCachedImageWhere[Q psql.Filterable](cols tileCachedImageColumns) tileCachedImageWhere[Q] {
|
||||
return tileCachedImageWhere[Q]{
|
||||
ArcgisID: psql.Where[Q, string](cols.ArcgisID),
|
||||
X: psql.Where[Q, int32](cols.X),
|
||||
Y: psql.Where[Q, int32](cols.Y),
|
||||
Z: psql.Where[Q, int32](cols.Z),
|
||||
IsEmpty: psql.Where[Q, bool](cols.IsEmpty),
|
||||
X: psql.Where[Q, int32](cols.X),
|
||||
Y: psql.Where[Q, int32](cols.Y),
|
||||
Z: psql.Where[Q, int32](cols.Z),
|
||||
IsEmpty: psql.Where[Q, bool](cols.IsEmpty),
|
||||
ServiceID: psql.Where[Q, int32](cols.ServiceID),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -562,16 +562,16 @@ func (o *TileCachedImage) Preload(name string, retrieved any) error {
|
|||
}
|
||||
|
||||
switch name {
|
||||
case "ArcgisServiceMap":
|
||||
rel, ok := retrieved.(*ArcgisServiceMap)
|
||||
case "Service":
|
||||
rel, ok := retrieved.(*TileService)
|
||||
if !ok {
|
||||
return fmt.Errorf("tileCachedImage cannot load %T as %q", retrieved, name)
|
||||
}
|
||||
|
||||
o.R.ArcgisServiceMap = rel
|
||||
o.R.Service = rel
|
||||
|
||||
if rel != nil {
|
||||
rel.R.ArcgisCachedImages = TileCachedImageSlice{o}
|
||||
rel.R.CachedImages = TileCachedImageSlice{o}
|
||||
}
|
||||
return nil
|
||||
default:
|
||||
|
|
@ -580,73 +580,73 @@ func (o *TileCachedImage) Preload(name string, retrieved any) error {
|
|||
}
|
||||
|
||||
type tileCachedImagePreloader struct {
|
||||
ArcgisServiceMap func(...psql.PreloadOption) psql.Preloader
|
||||
Service func(...psql.PreloadOption) psql.Preloader
|
||||
}
|
||||
|
||||
func buildTileCachedImagePreloader() tileCachedImagePreloader {
|
||||
return tileCachedImagePreloader{
|
||||
ArcgisServiceMap: func(opts ...psql.PreloadOption) psql.Preloader {
|
||||
return psql.Preload[*ArcgisServiceMap, ArcgisServiceMapSlice](psql.PreloadRel{
|
||||
Name: "ArcgisServiceMap",
|
||||
Service: func(opts ...psql.PreloadOption) psql.Preloader {
|
||||
return psql.Preload[*TileService, TileServiceSlice](psql.PreloadRel{
|
||||
Name: "Service",
|
||||
Sides: []psql.PreloadSide{
|
||||
{
|
||||
From: TileCachedImages,
|
||||
To: ArcgisServiceMaps,
|
||||
FromColumns: []string{"arcgis_id"},
|
||||
ToColumns: []string{"arcgis_id"},
|
||||
To: TileServices,
|
||||
FromColumns: []string{"service_id"},
|
||||
ToColumns: []string{"id"},
|
||||
},
|
||||
},
|
||||
}, ArcgisServiceMaps.Columns.Names(), opts...)
|
||||
}, TileServices.Columns.Names(), opts...)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
type tileCachedImageThenLoader[Q orm.Loadable] struct {
|
||||
ArcgisServiceMap func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q]
|
||||
Service func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q]
|
||||
}
|
||||
|
||||
func buildTileCachedImageThenLoader[Q orm.Loadable]() tileCachedImageThenLoader[Q] {
|
||||
type ArcgisServiceMapLoadInterface interface {
|
||||
LoadArcgisServiceMap(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error
|
||||
type ServiceLoadInterface interface {
|
||||
LoadService(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error
|
||||
}
|
||||
|
||||
return tileCachedImageThenLoader[Q]{
|
||||
ArcgisServiceMap: thenLoadBuilder[Q](
|
||||
"ArcgisServiceMap",
|
||||
func(ctx context.Context, exec bob.Executor, retrieved ArcgisServiceMapLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
||||
return retrieved.LoadArcgisServiceMap(ctx, exec, mods...)
|
||||
Service: thenLoadBuilder[Q](
|
||||
"Service",
|
||||
func(ctx context.Context, exec bob.Executor, retrieved ServiceLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
||||
return retrieved.LoadService(ctx, exec, mods...)
|
||||
},
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
// LoadArcgisServiceMap loads the tileCachedImage's ArcgisServiceMap into the .R struct
|
||||
func (o *TileCachedImage) LoadArcgisServiceMap(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
||||
// LoadService loads the tileCachedImage's Service into the .R struct
|
||||
func (o *TileCachedImage) LoadService(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Reset the relationship
|
||||
o.R.ArcgisServiceMap = nil
|
||||
o.R.Service = nil
|
||||
|
||||
related, err := o.ArcgisServiceMap(mods...).One(ctx, exec)
|
||||
related, err := o.Service(mods...).One(ctx, exec)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
related.R.ArcgisCachedImages = TileCachedImageSlice{o}
|
||||
related.R.CachedImages = TileCachedImageSlice{o}
|
||||
|
||||
o.R.ArcgisServiceMap = related
|
||||
o.R.Service = related
|
||||
return nil
|
||||
}
|
||||
|
||||
// LoadArcgisServiceMap loads the tileCachedImage's ArcgisServiceMap into the .R struct
|
||||
func (os TileCachedImageSlice) LoadArcgisServiceMap(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
||||
// LoadService loads the tileCachedImage's Service into the .R struct
|
||||
func (os TileCachedImageSlice) LoadService(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
||||
if len(os) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
arcgisServiceMaps, err := os.ArcgisServiceMap(mods...).All(ctx, exec)
|
||||
tileServices, err := os.Service(mods...).All(ctx, exec)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
@ -656,15 +656,15 @@ func (os TileCachedImageSlice) LoadArcgisServiceMap(ctx context.Context, exec bo
|
|||
continue
|
||||
}
|
||||
|
||||
for _, rel := range arcgisServiceMaps {
|
||||
for _, rel := range tileServices {
|
||||
|
||||
if !(o.ArcgisID == rel.ArcgisID) {
|
||||
if !(o.ServiceID == rel.ID) {
|
||||
continue
|
||||
}
|
||||
|
||||
rel.R.ArcgisCachedImages = append(rel.R.ArcgisCachedImages, o)
|
||||
rel.R.CachedImages = append(rel.R.CachedImages, o)
|
||||
|
||||
o.R.ArcgisServiceMap = rel
|
||||
o.R.Service = rel
|
||||
break
|
||||
}
|
||||
}
|
||||
|
|
|
|||
780
db/models/tile.service.bob.go
Normal file
780
db/models/tile.service.bob.go
Normal file
|
|
@ -0,0 +1,780 @@
|
|||
// Code generated by BobGen psql v0.42.5. DO NOT EDIT.
|
||||
// This file is meant to be re-generated in place and/or deleted at any time.
|
||||
|
||||
package models
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/Gleipnir-Technology/bob"
|
||||
"github.com/Gleipnir-Technology/bob/dialect/psql"
|
||||
"github.com/Gleipnir-Technology/bob/dialect/psql/dialect"
|
||||
"github.com/Gleipnir-Technology/bob/dialect/psql/dm"
|
||||
"github.com/Gleipnir-Technology/bob/dialect/psql/sm"
|
||||
"github.com/Gleipnir-Technology/bob/dialect/psql/um"
|
||||
"github.com/Gleipnir-Technology/bob/expr"
|
||||
"github.com/Gleipnir-Technology/bob/orm"
|
||||
"github.com/Gleipnir-Technology/bob/types/pgtypes"
|
||||
"github.com/aarondl/opt/null"
|
||||
"github.com/aarondl/opt/omit"
|
||||
"github.com/aarondl/opt/omitnull"
|
||||
)
|
||||
|
||||
// TileService is an object representing the database table.
|
||||
type TileService struct {
|
||||
ID int32 `db:"id,pk" `
|
||||
Name string `db:"name" `
|
||||
ArcgisID null.Val[string] `db:"arcgis_id" `
|
||||
|
||||
R tileServiceR `db:"-" `
|
||||
}
|
||||
|
||||
// TileServiceSlice is an alias for a slice of pointers to TileService.
|
||||
// This should almost always be used instead of []*TileService.
|
||||
type TileServiceSlice []*TileService
|
||||
|
||||
// TileServices contains methods to work with the service table
|
||||
var TileServices = psql.NewTablex[*TileService, TileServiceSlice, *TileServiceSetter]("tile", "service", buildTileServiceColumns("tile.service"))
|
||||
|
||||
// TileServicesQuery is a query on the service table
|
||||
type TileServicesQuery = *psql.ViewQuery[*TileService, TileServiceSlice]
|
||||
|
||||
// tileServiceR is where relationships are stored.
|
||||
type tileServiceR struct {
|
||||
CachedImages TileCachedImageSlice // tile.cached_image.cached_image_service_id_fkey
|
||||
ArcgisServiceMap *ArcgisServiceMap // tile.service.service_arcgis_id_fkey
|
||||
}
|
||||
|
||||
func buildTileServiceColumns(alias string) tileServiceColumns {
|
||||
return tileServiceColumns{
|
||||
ColumnsExpr: expr.NewColumnsExpr(
|
||||
"id", "name", "arcgis_id",
|
||||
).WithParent("tile.service"),
|
||||
tableAlias: alias,
|
||||
ID: psql.Quote(alias, "id"),
|
||||
Name: psql.Quote(alias, "name"),
|
||||
ArcgisID: psql.Quote(alias, "arcgis_id"),
|
||||
}
|
||||
}
|
||||
|
||||
type tileServiceColumns struct {
|
||||
expr.ColumnsExpr
|
||||
tableAlias string
|
||||
ID psql.Expression
|
||||
Name psql.Expression
|
||||
ArcgisID psql.Expression
|
||||
}
|
||||
|
||||
func (c tileServiceColumns) Alias() string {
|
||||
return c.tableAlias
|
||||
}
|
||||
|
||||
func (tileServiceColumns) AliasedAs(alias string) tileServiceColumns {
|
||||
return buildTileServiceColumns(alias)
|
||||
}
|
||||
|
||||
// TileServiceSetter is used for insert/upsert/update operations
|
||||
// All values are optional, and do not have to be set
|
||||
// Generated columns are not included
|
||||
type TileServiceSetter struct {
|
||||
ID omit.Val[int32] `db:"id,pk" `
|
||||
Name omit.Val[string] `db:"name" `
|
||||
ArcgisID omitnull.Val[string] `db:"arcgis_id" `
|
||||
}
|
||||
|
||||
func (s TileServiceSetter) SetColumns() []string {
|
||||
vals := make([]string, 0, 3)
|
||||
if s.ID.IsValue() {
|
||||
vals = append(vals, "id")
|
||||
}
|
||||
if s.Name.IsValue() {
|
||||
vals = append(vals, "name")
|
||||
}
|
||||
if !s.ArcgisID.IsUnset() {
|
||||
vals = append(vals, "arcgis_id")
|
||||
}
|
||||
return vals
|
||||
}
|
||||
|
||||
func (s TileServiceSetter) Overwrite(t *TileService) {
|
||||
if s.ID.IsValue() {
|
||||
t.ID = s.ID.MustGet()
|
||||
}
|
||||
if s.Name.IsValue() {
|
||||
t.Name = s.Name.MustGet()
|
||||
}
|
||||
if !s.ArcgisID.IsUnset() {
|
||||
t.ArcgisID = s.ArcgisID.MustGetNull()
|
||||
}
|
||||
}
|
||||
|
||||
func (s *TileServiceSetter) Apply(q *dialect.InsertQuery) {
|
||||
q.AppendHooks(func(ctx context.Context, exec bob.Executor) (context.Context, error) {
|
||||
return TileServices.BeforeInsertHooks.RunHooks(ctx, exec, s)
|
||||
})
|
||||
|
||||
q.AppendValues(bob.ExpressionFunc(func(ctx context.Context, w io.StringWriter, d bob.Dialect, start int) ([]any, error) {
|
||||
vals := make([]bob.Expression, 3)
|
||||
if s.ID.IsValue() {
|
||||
vals[0] = psql.Arg(s.ID.MustGet())
|
||||
} else {
|
||||
vals[0] = psql.Raw("DEFAULT")
|
||||
}
|
||||
|
||||
if s.Name.IsValue() {
|
||||
vals[1] = psql.Arg(s.Name.MustGet())
|
||||
} else {
|
||||
vals[1] = psql.Raw("DEFAULT")
|
||||
}
|
||||
|
||||
if !s.ArcgisID.IsUnset() {
|
||||
vals[2] = psql.Arg(s.ArcgisID.MustGetNull())
|
||||
} else {
|
||||
vals[2] = psql.Raw("DEFAULT")
|
||||
}
|
||||
|
||||
return bob.ExpressSlice(ctx, w, d, start, vals, "", ", ", "")
|
||||
}))
|
||||
}
|
||||
|
||||
func (s TileServiceSetter) UpdateMod() bob.Mod[*dialect.UpdateQuery] {
|
||||
return um.Set(s.Expressions()...)
|
||||
}
|
||||
|
||||
func (s TileServiceSetter) Expressions(prefix ...string) []bob.Expression {
|
||||
exprs := make([]bob.Expression, 0, 3)
|
||||
|
||||
if s.ID.IsValue() {
|
||||
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
||||
psql.Quote(append(prefix, "id")...),
|
||||
psql.Arg(s.ID),
|
||||
}})
|
||||
}
|
||||
|
||||
if s.Name.IsValue() {
|
||||
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
||||
psql.Quote(append(prefix, "name")...),
|
||||
psql.Arg(s.Name),
|
||||
}})
|
||||
}
|
||||
|
||||
if !s.ArcgisID.IsUnset() {
|
||||
exprs = append(exprs, expr.Join{Sep: " = ", Exprs: []bob.Expression{
|
||||
psql.Quote(append(prefix, "arcgis_id")...),
|
||||
psql.Arg(s.ArcgisID),
|
||||
}})
|
||||
}
|
||||
|
||||
return exprs
|
||||
}
|
||||
|
||||
// FindTileService retrieves a single record by primary key
|
||||
// If cols is empty Find will return all columns.
|
||||
func FindTileService(ctx context.Context, exec bob.Executor, IDPK int32, cols ...string) (*TileService, error) {
|
||||
if len(cols) == 0 {
|
||||
return TileServices.Query(
|
||||
sm.Where(TileServices.Columns.ID.EQ(psql.Arg(IDPK))),
|
||||
).One(ctx, exec)
|
||||
}
|
||||
|
||||
return TileServices.Query(
|
||||
sm.Where(TileServices.Columns.ID.EQ(psql.Arg(IDPK))),
|
||||
sm.Columns(TileServices.Columns.Only(cols...)),
|
||||
).One(ctx, exec)
|
||||
}
|
||||
|
||||
// TileServiceExists checks the presence of a single record by primary key
|
||||
func TileServiceExists(ctx context.Context, exec bob.Executor, IDPK int32) (bool, error) {
|
||||
return TileServices.Query(
|
||||
sm.Where(TileServices.Columns.ID.EQ(psql.Arg(IDPK))),
|
||||
).Exists(ctx, exec)
|
||||
}
|
||||
|
||||
// AfterQueryHook is called after TileService is retrieved from the database
|
||||
func (o *TileService) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error {
|
||||
var err error
|
||||
|
||||
switch queryType {
|
||||
case bob.QueryTypeSelect:
|
||||
ctx, err = TileServices.AfterSelectHooks.RunHooks(ctx, exec, TileServiceSlice{o})
|
||||
case bob.QueryTypeInsert:
|
||||
ctx, err = TileServices.AfterInsertHooks.RunHooks(ctx, exec, TileServiceSlice{o})
|
||||
case bob.QueryTypeUpdate:
|
||||
ctx, err = TileServices.AfterUpdateHooks.RunHooks(ctx, exec, TileServiceSlice{o})
|
||||
case bob.QueryTypeDelete:
|
||||
ctx, err = TileServices.AfterDeleteHooks.RunHooks(ctx, exec, TileServiceSlice{o})
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// primaryKeyVals returns the primary key values of the TileService
|
||||
func (o *TileService) primaryKeyVals() bob.Expression {
|
||||
return psql.Arg(o.ID)
|
||||
}
|
||||
|
||||
func (o *TileService) pkEQ() dialect.Expression {
|
||||
return psql.Quote("tile.service", "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 TileService
|
||||
func (o *TileService) Update(ctx context.Context, exec bob.Executor, s *TileServiceSetter) error {
|
||||
v, err := TileServices.Update(s.UpdateMod(), um.Where(o.pkEQ())).One(ctx, exec)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
o.R = v.R
|
||||
*o = *v
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Delete deletes a single TileService record with an executor
|
||||
func (o *TileService) Delete(ctx context.Context, exec bob.Executor) error {
|
||||
_, err := TileServices.Delete(dm.Where(o.pkEQ())).Exec(ctx, exec)
|
||||
return err
|
||||
}
|
||||
|
||||
// Reload refreshes the TileService using the executor
|
||||
func (o *TileService) Reload(ctx context.Context, exec bob.Executor) error {
|
||||
o2, err := TileServices.Query(
|
||||
sm.Where(TileServices.Columns.ID.EQ(psql.Arg(o.ID))),
|
||||
).One(ctx, exec)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
o2.R = o.R
|
||||
*o = *o2
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// AfterQueryHook is called after TileServiceSlice is retrieved from the database
|
||||
func (o TileServiceSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error {
|
||||
var err error
|
||||
|
||||
switch queryType {
|
||||
case bob.QueryTypeSelect:
|
||||
ctx, err = TileServices.AfterSelectHooks.RunHooks(ctx, exec, o)
|
||||
case bob.QueryTypeInsert:
|
||||
ctx, err = TileServices.AfterInsertHooks.RunHooks(ctx, exec, o)
|
||||
case bob.QueryTypeUpdate:
|
||||
ctx, err = TileServices.AfterUpdateHooks.RunHooks(ctx, exec, o)
|
||||
case bob.QueryTypeDelete:
|
||||
ctx, err = TileServices.AfterDeleteHooks.RunHooks(ctx, exec, o)
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
func (o TileServiceSlice) pkIN() dialect.Expression {
|
||||
if len(o) == 0 {
|
||||
return psql.Raw("NULL")
|
||||
}
|
||||
|
||||
return psql.Quote("tile.service", "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 TileServiceSlice) copyMatchingRows(from ...*TileService) {
|
||||
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 TileServiceSlice) 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 TileServices.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 *TileService:
|
||||
o.copyMatchingRows(retrieved)
|
||||
case []*TileService:
|
||||
o.copyMatchingRows(retrieved...)
|
||||
case TileServiceSlice:
|
||||
o.copyMatchingRows(retrieved...)
|
||||
default:
|
||||
// If the retrieved value is not a TileService or a slice of TileService
|
||||
// then run the AfterUpdateHooks on the slice
|
||||
_, err = TileServices.AfterUpdateHooks.RunHooks(ctx, exec, o)
|
||||
}
|
||||
|
||||
return err
|
||||
}))
|
||||
|
||||
q.AppendWhere(o.pkIN())
|
||||
})
|
||||
}
|
||||
|
||||
// DeleteMod modifies an delete query with "WHERE primary_key IN (o...)"
|
||||
func (o TileServiceSlice) 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 TileServices.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 *TileService:
|
||||
o.copyMatchingRows(retrieved)
|
||||
case []*TileService:
|
||||
o.copyMatchingRows(retrieved...)
|
||||
case TileServiceSlice:
|
||||
o.copyMatchingRows(retrieved...)
|
||||
default:
|
||||
// If the retrieved value is not a TileService or a slice of TileService
|
||||
// then run the AfterDeleteHooks on the slice
|
||||
_, err = TileServices.AfterDeleteHooks.RunHooks(ctx, exec, o)
|
||||
}
|
||||
|
||||
return err
|
||||
}))
|
||||
|
||||
q.AppendWhere(o.pkIN())
|
||||
})
|
||||
}
|
||||
|
||||
func (o TileServiceSlice) UpdateAll(ctx context.Context, exec bob.Executor, vals TileServiceSetter) error {
|
||||
if len(o) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
_, err := TileServices.Update(vals.UpdateMod(), o.UpdateMod()).All(ctx, exec)
|
||||
return err
|
||||
}
|
||||
|
||||
func (o TileServiceSlice) DeleteAll(ctx context.Context, exec bob.Executor) error {
|
||||
if len(o) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
_, err := TileServices.Delete(o.DeleteMod()).Exec(ctx, exec)
|
||||
return err
|
||||
}
|
||||
|
||||
func (o TileServiceSlice) ReloadAll(ctx context.Context, exec bob.Executor) error {
|
||||
if len(o) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
o2, err := TileServices.Query(sm.Where(o.pkIN())).All(ctx, exec)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
o.copyMatchingRows(o2...)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// CachedImages starts a query for related objects on tile.cached_image
|
||||
func (o *TileService) CachedImages(mods ...bob.Mod[*dialect.SelectQuery]) TileCachedImagesQuery {
|
||||
return TileCachedImages.Query(append(mods,
|
||||
sm.Where(TileCachedImages.Columns.ServiceID.EQ(psql.Arg(o.ID))),
|
||||
)...)
|
||||
}
|
||||
|
||||
func (os TileServiceSlice) CachedImages(mods ...bob.Mod[*dialect.SelectQuery]) TileCachedImagesQuery {
|
||||
pkID := make(pgtypes.Array[int32], 0, len(os))
|
||||
for _, o := range os {
|
||||
if o == nil {
|
||||
continue
|
||||
}
|
||||
pkID = append(pkID, o.ID)
|
||||
}
|
||||
PKArgExpr := psql.Select(sm.Columns(
|
||||
psql.F("unnest", psql.Cast(psql.Arg(pkID), "integer[]")),
|
||||
))
|
||||
|
||||
return TileCachedImages.Query(append(mods,
|
||||
sm.Where(psql.Group(TileCachedImages.Columns.ServiceID).OP("IN", PKArgExpr)),
|
||||
)...)
|
||||
}
|
||||
|
||||
// ArcgisServiceMap starts a query for related objects on arcgis.service_map
|
||||
func (o *TileService) ArcgisServiceMap(mods ...bob.Mod[*dialect.SelectQuery]) ArcgisServiceMapsQuery {
|
||||
return ArcgisServiceMaps.Query(append(mods,
|
||||
sm.Where(ArcgisServiceMaps.Columns.ArcgisID.EQ(psql.Arg(o.ArcgisID))),
|
||||
)...)
|
||||
}
|
||||
|
||||
func (os TileServiceSlice) ArcgisServiceMap(mods ...bob.Mod[*dialect.SelectQuery]) ArcgisServiceMapsQuery {
|
||||
pkArcgisID := make(pgtypes.Array[null.Val[string]], 0, len(os))
|
||||
for _, o := range os {
|
||||
if o == nil {
|
||||
continue
|
||||
}
|
||||
pkArcgisID = append(pkArcgisID, o.ArcgisID)
|
||||
}
|
||||
PKArgExpr := psql.Select(sm.Columns(
|
||||
psql.F("unnest", psql.Cast(psql.Arg(pkArcgisID), "text[]")),
|
||||
))
|
||||
|
||||
return ArcgisServiceMaps.Query(append(mods,
|
||||
sm.Where(psql.Group(ArcgisServiceMaps.Columns.ArcgisID).OP("IN", PKArgExpr)),
|
||||
)...)
|
||||
}
|
||||
|
||||
func insertTileServiceCachedImages0(ctx context.Context, exec bob.Executor, tileCachedImages1 []*TileCachedImageSetter, tileService0 *TileService) (TileCachedImageSlice, error) {
|
||||
for i := range tileCachedImages1 {
|
||||
tileCachedImages1[i].ServiceID = omit.From(tileService0.ID)
|
||||
}
|
||||
|
||||
ret, err := TileCachedImages.Insert(bob.ToMods(tileCachedImages1...)).All(ctx, exec)
|
||||
if err != nil {
|
||||
return ret, fmt.Errorf("insertTileServiceCachedImages0: %w", err)
|
||||
}
|
||||
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
func attachTileServiceCachedImages0(ctx context.Context, exec bob.Executor, count int, tileCachedImages1 TileCachedImageSlice, tileService0 *TileService) (TileCachedImageSlice, error) {
|
||||
setter := &TileCachedImageSetter{
|
||||
ServiceID: omit.From(tileService0.ID),
|
||||
}
|
||||
|
||||
err := tileCachedImages1.UpdateAll(ctx, exec, *setter)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("attachTileServiceCachedImages0: %w", err)
|
||||
}
|
||||
|
||||
return tileCachedImages1, nil
|
||||
}
|
||||
|
||||
func (tileService0 *TileService) InsertCachedImages(ctx context.Context, exec bob.Executor, related ...*TileCachedImageSetter) error {
|
||||
if len(related) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
var err error
|
||||
|
||||
tileCachedImages1, err := insertTileServiceCachedImages0(ctx, exec, related, tileService0)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
tileService0.R.CachedImages = append(tileService0.R.CachedImages, tileCachedImages1...)
|
||||
|
||||
for _, rel := range tileCachedImages1 {
|
||||
rel.R.Service = tileService0
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (tileService0 *TileService) AttachCachedImages(ctx context.Context, exec bob.Executor, related ...*TileCachedImage) error {
|
||||
if len(related) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
var err error
|
||||
tileCachedImages1 := TileCachedImageSlice(related)
|
||||
|
||||
_, err = attachTileServiceCachedImages0(ctx, exec, len(related), tileCachedImages1, tileService0)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
tileService0.R.CachedImages = append(tileService0.R.CachedImages, tileCachedImages1...)
|
||||
|
||||
for _, rel := range related {
|
||||
rel.R.Service = tileService0
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func attachTileServiceArcgisServiceMap0(ctx context.Context, exec bob.Executor, count int, tileService0 *TileService, arcgisServiceMap1 *ArcgisServiceMap) (*TileService, error) {
|
||||
setter := &TileServiceSetter{
|
||||
ArcgisID: omitnull.From(arcgisServiceMap1.ArcgisID),
|
||||
}
|
||||
|
||||
err := tileService0.Update(ctx, exec, setter)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("attachTileServiceArcgisServiceMap0: %w", err)
|
||||
}
|
||||
|
||||
return tileService0, nil
|
||||
}
|
||||
|
||||
func (tileService0 *TileService) InsertArcgisServiceMap(ctx context.Context, exec bob.Executor, related *ArcgisServiceMapSetter) error {
|
||||
var err error
|
||||
|
||||
arcgisServiceMap1, err := ArcgisServiceMaps.Insert(related).One(ctx, exec)
|
||||
if err != nil {
|
||||
return fmt.Errorf("inserting related objects: %w", err)
|
||||
}
|
||||
|
||||
_, err = attachTileServiceArcgisServiceMap0(ctx, exec, 1, tileService0, arcgisServiceMap1)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
tileService0.R.ArcgisServiceMap = arcgisServiceMap1
|
||||
|
||||
arcgisServiceMap1.R.ArcgisServices = append(arcgisServiceMap1.R.ArcgisServices, tileService0)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (tileService0 *TileService) AttachArcgisServiceMap(ctx context.Context, exec bob.Executor, arcgisServiceMap1 *ArcgisServiceMap) error {
|
||||
var err error
|
||||
|
||||
_, err = attachTileServiceArcgisServiceMap0(ctx, exec, 1, tileService0, arcgisServiceMap1)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
tileService0.R.ArcgisServiceMap = arcgisServiceMap1
|
||||
|
||||
arcgisServiceMap1.R.ArcgisServices = append(arcgisServiceMap1.R.ArcgisServices, tileService0)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type tileServiceWhere[Q psql.Filterable] struct {
|
||||
ID psql.WhereMod[Q, int32]
|
||||
Name psql.WhereMod[Q, string]
|
||||
ArcgisID psql.WhereNullMod[Q, string]
|
||||
}
|
||||
|
||||
func (tileServiceWhere[Q]) AliasedAs(alias string) tileServiceWhere[Q] {
|
||||
return buildTileServiceWhere[Q](buildTileServiceColumns(alias))
|
||||
}
|
||||
|
||||
func buildTileServiceWhere[Q psql.Filterable](cols tileServiceColumns) tileServiceWhere[Q] {
|
||||
return tileServiceWhere[Q]{
|
||||
ID: psql.Where[Q, int32](cols.ID),
|
||||
Name: psql.Where[Q, string](cols.Name),
|
||||
ArcgisID: psql.WhereNull[Q, string](cols.ArcgisID),
|
||||
}
|
||||
}
|
||||
|
||||
func (o *TileService) Preload(name string, retrieved any) error {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
switch name {
|
||||
case "CachedImages":
|
||||
rels, ok := retrieved.(TileCachedImageSlice)
|
||||
if !ok {
|
||||
return fmt.Errorf("tileService cannot load %T as %q", retrieved, name)
|
||||
}
|
||||
|
||||
o.R.CachedImages = rels
|
||||
|
||||
for _, rel := range rels {
|
||||
if rel != nil {
|
||||
rel.R.Service = o
|
||||
}
|
||||
}
|
||||
return nil
|
||||
case "ArcgisServiceMap":
|
||||
rel, ok := retrieved.(*ArcgisServiceMap)
|
||||
if !ok {
|
||||
return fmt.Errorf("tileService cannot load %T as %q", retrieved, name)
|
||||
}
|
||||
|
||||
o.R.ArcgisServiceMap = rel
|
||||
|
||||
if rel != nil {
|
||||
rel.R.ArcgisServices = TileServiceSlice{o}
|
||||
}
|
||||
return nil
|
||||
default:
|
||||
return fmt.Errorf("tileService has no relationship %q", name)
|
||||
}
|
||||
}
|
||||
|
||||
type tileServicePreloader struct {
|
||||
ArcgisServiceMap func(...psql.PreloadOption) psql.Preloader
|
||||
}
|
||||
|
||||
func buildTileServicePreloader() tileServicePreloader {
|
||||
return tileServicePreloader{
|
||||
ArcgisServiceMap: func(opts ...psql.PreloadOption) psql.Preloader {
|
||||
return psql.Preload[*ArcgisServiceMap, ArcgisServiceMapSlice](psql.PreloadRel{
|
||||
Name: "ArcgisServiceMap",
|
||||
Sides: []psql.PreloadSide{
|
||||
{
|
||||
From: TileServices,
|
||||
To: ArcgisServiceMaps,
|
||||
FromColumns: []string{"arcgis_id"},
|
||||
ToColumns: []string{"arcgis_id"},
|
||||
},
|
||||
},
|
||||
}, ArcgisServiceMaps.Columns.Names(), opts...)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
type tileServiceThenLoader[Q orm.Loadable] struct {
|
||||
CachedImages func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q]
|
||||
ArcgisServiceMap func(...bob.Mod[*dialect.SelectQuery]) orm.Loader[Q]
|
||||
}
|
||||
|
||||
func buildTileServiceThenLoader[Q orm.Loadable]() tileServiceThenLoader[Q] {
|
||||
type CachedImagesLoadInterface interface {
|
||||
LoadCachedImages(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error
|
||||
}
|
||||
type ArcgisServiceMapLoadInterface interface {
|
||||
LoadArcgisServiceMap(context.Context, bob.Executor, ...bob.Mod[*dialect.SelectQuery]) error
|
||||
}
|
||||
|
||||
return tileServiceThenLoader[Q]{
|
||||
CachedImages: thenLoadBuilder[Q](
|
||||
"CachedImages",
|
||||
func(ctx context.Context, exec bob.Executor, retrieved CachedImagesLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
||||
return retrieved.LoadCachedImages(ctx, exec, mods...)
|
||||
},
|
||||
),
|
||||
ArcgisServiceMap: thenLoadBuilder[Q](
|
||||
"ArcgisServiceMap",
|
||||
func(ctx context.Context, exec bob.Executor, retrieved ArcgisServiceMapLoadInterface, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
||||
return retrieved.LoadArcgisServiceMap(ctx, exec, mods...)
|
||||
},
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
// LoadCachedImages loads the tileService's CachedImages into the .R struct
|
||||
func (o *TileService) LoadCachedImages(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Reset the relationship
|
||||
o.R.CachedImages = nil
|
||||
|
||||
related, err := o.CachedImages(mods...).All(ctx, exec)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, rel := range related {
|
||||
rel.R.Service = o
|
||||
}
|
||||
|
||||
o.R.CachedImages = related
|
||||
return nil
|
||||
}
|
||||
|
||||
// LoadCachedImages loads the tileService's CachedImages into the .R struct
|
||||
func (os TileServiceSlice) LoadCachedImages(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
||||
if len(os) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
tileCachedImages, err := os.CachedImages(mods...).All(ctx, exec)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, o := range os {
|
||||
if o == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
o.R.CachedImages = nil
|
||||
}
|
||||
|
||||
for _, o := range os {
|
||||
if o == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
for _, rel := range tileCachedImages {
|
||||
|
||||
if !(o.ID == rel.ServiceID) {
|
||||
continue
|
||||
}
|
||||
|
||||
rel.R.Service = o
|
||||
|
||||
o.R.CachedImages = append(o.R.CachedImages, rel)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// LoadArcgisServiceMap loads the tileService's ArcgisServiceMap into the .R struct
|
||||
func (o *TileService) LoadArcgisServiceMap(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
||||
if o == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Reset the relationship
|
||||
o.R.ArcgisServiceMap = nil
|
||||
|
||||
related, err := o.ArcgisServiceMap(mods...).One(ctx, exec)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
related.R.ArcgisServices = TileServiceSlice{o}
|
||||
|
||||
o.R.ArcgisServiceMap = related
|
||||
return nil
|
||||
}
|
||||
|
||||
// LoadArcgisServiceMap loads the tileService's ArcgisServiceMap into the .R struct
|
||||
func (os TileServiceSlice) LoadArcgisServiceMap(ctx context.Context, exec bob.Executor, mods ...bob.Mod[*dialect.SelectQuery]) error {
|
||||
if len(os) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
arcgisServiceMaps, err := os.ArcgisServiceMap(mods...).All(ctx, exec)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, o := range os {
|
||||
if o == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
for _, rel := range arcgisServiceMaps {
|
||||
if !o.ArcgisID.IsValue() {
|
||||
continue
|
||||
}
|
||||
|
||||
if !(o.ArcgisID.IsValue() && o.ArcgisID.MustGet() == rel.ArcgisID) {
|
||||
continue
|
||||
}
|
||||
|
||||
rel.R.ArcgisServices = append(rel.R.ArcgisServices, o)
|
||||
|
||||
o.R.ArcgisServiceMap = rel
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue