Port all of the arcgis schema to using jet
Have not tested anything at this point, it just compiles.
This commit is contained in:
parent
89ed2003fa
commit
bab3200b6c
52 changed files with 479 additions and 13585 deletions
31
db/query/arcgis/service_map.go
Normal file
31
db/query/arcgis/service_map.go
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
package arcgis
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/Gleipnir-Technology/bob"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/db"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/db/gen/nidus-sync/arcgis/model"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/db/gen/nidus-sync/arcgis/table"
|
||||
"github.com/go-jet/jet/v2/postgres"
|
||||
)
|
||||
|
||||
func ServiceMapFromID(ctx context.Context, id string) (*model.ServiceMap, error) {
|
||||
statement := table.ServiceMap.SELECT(
|
||||
table.ServiceMap.AllColumns,
|
||||
).FROM(table.ServiceMap).
|
||||
WHERE(table.ServiceMap.ArcgisID.EQ(postgres.String(id)))
|
||||
return db.ExecuteOne[model.ServiceMap](ctx, statement)
|
||||
}
|
||||
func ServiceMapsFromAccountID(ctx context.Context, account_id string) ([]*model.ServiceMap, error) {
|
||||
statement := table.ServiceMap.SELECT(
|
||||
table.ServiceMap.AllColumns,
|
||||
).FROM(table.ServiceMap).
|
||||
WHERE(table.ServiceMap.AccountID.EQ(postgres.String(account_id)))
|
||||
return db.ExecuteMany[model.ServiceMap](ctx, statement)
|
||||
}
|
||||
func ServiceMapInsert(ctx context.Context, txn bob.Tx, m *model.ServiceMap) error {
|
||||
statement := table.ServiceMap.INSERT(table.ServiceMap.MutableColumns).
|
||||
MODEL(m)
|
||||
return db.ExecuteNoneTx(ctx, txn, statement)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue