nidus-sync/db/query/publicreport/notify_phone.go

27 lines
904 B
Go
Raw Normal View History

package publicreport
import (
"context"
"time"
"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"
//"github.com/Gleipnir-Technology/jet/postgres"
)
func NotifyPhoneInsert(ctx context.Context, txn db.Ex, m model.NotifyPhone) (model.NotifyPhone, error) {
statement := table.NotifyPhone.INSERT(table.NotifyPhone.MutableColumns).
MODEL(m).
RETURNING(table.NotifyPhone.AllColumns)
return db.ExecuteOneTx[model.NotifyPhone](ctx, txn, statement)
}
func NotifyPhoneCreate(ctx context.Context, txn db.Ex, report_id int32, destination string) (model.NotifyPhone, error) {
return NotifyPhoneInsert(ctx, txn, model.NotifyPhone{
Created: time.Now(),
Deleted: nil,
PhoneE164: destination,
ReportID: report_id,
})
}