nidus-sync/db/models/publicreport.report_location.bob.go

153 lines
6.9 KiB
Go
Raw Normal View History

// 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"
"time"
"github.com/Gleipnir-Technology/bob"
"github.com/Gleipnir-Technology/bob/dialect/psql"
"github.com/Gleipnir-Technology/bob/expr"
enums "github.com/Gleipnir-Technology/nidus-sync/db/enums"
"github.com/aarondl/opt/null"
)
// PublicreportReportLocation is an object representing the database table.
type PublicreportReportLocation struct {
ID null.Val[int64] `db:"id" `
TableName null.Val[string] `db:"table_name" `
AddressID null.Val[int32] `db:"address_id" `
AddressRaw null.Val[string] `db:"address_raw" `
Created null.Val[time.Time] `db:"created" `
Location null.Val[string] `db:"location" `
LocationLatitude null.Val[float64] `db:"location_latitude" `
LocationLongitude null.Val[float64] `db:"location_longitude" `
OrganizationID null.Val[int32] `db:"organization_id" `
PublicID null.Val[string] `db:"public_id" `
ReporterEmail null.Val[string] `db:"reporter_email" `
ReporterPhone null.Val[string] `db:"reporter_phone" `
Status null.Val[enums.PublicreportReportstatustype] `db:"status" `
}
// PublicreportReportLocationSlice is an alias for a slice of pointers to PublicreportReportLocation.
// This should almost always be used instead of []*PublicreportReportLocation.
type PublicreportReportLocationSlice []*PublicreportReportLocation
// PublicreportReportLocations contains methods to work with the report_location view
var PublicreportReportLocations = psql.NewViewx[*PublicreportReportLocation, PublicreportReportLocationSlice]("publicreport", "report_location", buildPublicreportReportLocationColumns("publicreport.report_location"))
// PublicreportReportLocationsQuery is a query on the report_location view
type PublicreportReportLocationsQuery = *psql.ViewQuery[*PublicreportReportLocation, PublicreportReportLocationSlice]
func buildPublicreportReportLocationColumns(alias string) publicreportReportLocationColumns {
return publicreportReportLocationColumns{
ColumnsExpr: expr.NewColumnsExpr(
"id", "table_name", "address_id", "address_raw", "created", "location", "location_latitude", "location_longitude", "organization_id", "public_id", "reporter_email", "reporter_phone", "status",
).WithParent("publicreport.report_location"),
tableAlias: alias,
ID: psql.Quote(alias, "id"),
TableName: psql.Quote(alias, "table_name"),
AddressID: psql.Quote(alias, "address_id"),
AddressRaw: psql.Quote(alias, "address_raw"),
Created: psql.Quote(alias, "created"),
Location: psql.Quote(alias, "location"),
LocationLatitude: psql.Quote(alias, "location_latitude"),
LocationLongitude: psql.Quote(alias, "location_longitude"),
OrganizationID: psql.Quote(alias, "organization_id"),
PublicID: psql.Quote(alias, "public_id"),
ReporterEmail: psql.Quote(alias, "reporter_email"),
ReporterPhone: psql.Quote(alias, "reporter_phone"),
Status: psql.Quote(alias, "status"),
}
}
type publicreportReportLocationColumns struct {
expr.ColumnsExpr
tableAlias string
ID psql.Expression
TableName psql.Expression
AddressID psql.Expression
AddressRaw psql.Expression
Created psql.Expression
Location psql.Expression
LocationLatitude psql.Expression
LocationLongitude psql.Expression
OrganizationID psql.Expression
PublicID psql.Expression
ReporterEmail psql.Expression
ReporterPhone psql.Expression
Status psql.Expression
}
func (c publicreportReportLocationColumns) Alias() string {
return c.tableAlias
}
func (publicreportReportLocationColumns) AliasedAs(alias string) publicreportReportLocationColumns {
return buildPublicreportReportLocationColumns(alias)
}
// AfterQueryHook is called after PublicreportReportLocation is retrieved from the database
func (o *PublicreportReportLocation) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error {
var err error
switch queryType {
case bob.QueryTypeSelect:
ctx, err = PublicreportReportLocations.AfterSelectHooks.RunHooks(ctx, exec, PublicreportReportLocationSlice{o})
}
return err
}
// AfterQueryHook is called after PublicreportReportLocationSlice is retrieved from the database
func (o PublicreportReportLocationSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error {
var err error
switch queryType {
case bob.QueryTypeSelect:
ctx, err = PublicreportReportLocations.AfterSelectHooks.RunHooks(ctx, exec, o)
}
return err
}
type publicreportReportLocationWhere[Q psql.Filterable] struct {
ID psql.WhereNullMod[Q, int64]
TableName psql.WhereNullMod[Q, string]
AddressID psql.WhereNullMod[Q, int32]
AddressRaw psql.WhereNullMod[Q, string]
Created psql.WhereNullMod[Q, time.Time]
Location psql.WhereNullMod[Q, string]
LocationLatitude psql.WhereNullMod[Q, float64]
LocationLongitude psql.WhereNullMod[Q, float64]
OrganizationID psql.WhereNullMod[Q, int32]
PublicID psql.WhereNullMod[Q, string]
ReporterEmail psql.WhereNullMod[Q, string]
ReporterPhone psql.WhereNullMod[Q, string]
Status psql.WhereNullMod[Q, enums.PublicreportReportstatustype]
}
func (publicreportReportLocationWhere[Q]) AliasedAs(alias string) publicreportReportLocationWhere[Q] {
return buildPublicreportReportLocationWhere[Q](buildPublicreportReportLocationColumns(alias))
}
func buildPublicreportReportLocationWhere[Q psql.Filterable](cols publicreportReportLocationColumns) publicreportReportLocationWhere[Q] {
return publicreportReportLocationWhere[Q]{
ID: psql.WhereNull[Q, int64](cols.ID),
TableName: psql.WhereNull[Q, string](cols.TableName),
AddressID: psql.WhereNull[Q, int32](cols.AddressID),
AddressRaw: psql.WhereNull[Q, string](cols.AddressRaw),
Created: psql.WhereNull[Q, time.Time](cols.Created),
Location: psql.WhereNull[Q, string](cols.Location),
LocationLatitude: psql.WhereNull[Q, float64](cols.LocationLatitude),
LocationLongitude: psql.WhereNull[Q, float64](cols.LocationLongitude),
OrganizationID: psql.WhereNull[Q, int32](cols.OrganizationID),
PublicID: psql.WhereNull[Q, string](cols.PublicID),
ReporterEmail: psql.WhereNull[Q, string](cols.ReporterEmail),
ReporterPhone: psql.WhereNull[Q, string](cols.ReporterPhone),
Status: psql.WhereNull[Q, enums.PublicreportReportstatustype](cols.Status),
}
}