nidus-sync/db/query/publicreport/water.go
Eli Ribble 5e103f46a0
Fix populating water report from ID, make ContactSimple
ContactSimple is the replacement for ContactReporter, which was the
simplified form of a contact from a report. I made the name more generic
and use it in the general report structures for consistency.
2026-05-21 03:23:10 +00:00

24 lines
875 B
Go

package publicreport
import (
"context"
//"time"
"github.com/Gleipnir-Technology/jet/postgres"
"source.gleipnir.technology/Gleipnir/nidus-sync/db"
"source.gleipnir.technology/Gleipnir/nidus-sync/db/gen/nidus-sync/publicreport/model"
"source.gleipnir.technology/Gleipnir/nidus-sync/db/gen/nidus-sync/publicreport/table"
)
func WaterInsert(ctx context.Context, txn db.Ex, m model.Water) (model.Water, error) {
statement := table.Water.INSERT(table.Water.AllColumns).
MODEL(m).
RETURNING(table.Water.AllColumns)
return db.ExecuteOneTx[model.Water](ctx, txn, statement)
}
func WaterFromReportID(ctx context.Context, txn db.Ex, report_id int64) (model.Water, error) {
statement := table.Water.SELECT(table.Water.AllColumns).
FROM(table.Water).
WHERE(table.Water.ReportID.EQ(postgres.Int(report_id)))
return db.ExecuteOneTx[model.Water](ctx, txn, statement)
}