nidus-sync/db/query/arcgis/user.go
Eli Ribble fcd95f1a25
Get back to compiling, but using new jet for publicreport
This was an epically long change, and a terrible idea, but it compiles.
This was essentially a cascade that came about because I can't blend jet
and bob in the same transaction. In for a penny, I guess...
2026-05-07 10:39:17 +00:00

24 lines
815 B
Go

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 UserFromID(ctx context.Context, id string) (model.User, error) {
statement := table.User.SELECT(table.User.AllColumns).
FROM(table.User).
WHERE(table.User.ID.EQ(postgres.String(id)))
return db.ExecuteOne[model.User](ctx, statement)
}
func UserInsert(ctx context.Context, txn bob.Tx, m *model.User) (model.User, error) {
statement := table.User.INSERT(table.User.MutableColumns).
MODEL(m).
RETURNING(table.User.AllColumns)
return db.ExecuteOneTxBob[model.User](ctx, txn, statement)
}