This is an intermediate step between shifting from the old fs_* prefixed table names to an entire fieldseeker schema. At this point we have both, and we aren't doing much with the new schema but compiling.
120 lines
4.3 KiB
Go
120 lines
4.3 KiB
Go
// Code generated by BobGen psql v0.42.0. DO NOT EDIT.
|
|
// This file is meant to be re-generated in place and/or deleted at any time.
|
|
|
|
package models
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/aarondl/opt/null"
|
|
"github.com/stephenafamo/bob"
|
|
"github.com/stephenafamo/bob/dialect/psql"
|
|
"github.com/stephenafamo/bob/expr"
|
|
)
|
|
|
|
// GeometryColumn is an object representing the database table.
|
|
type GeometryColumn struct {
|
|
FTableCatalog null.Val[string] `db:"f_table_catalog" `
|
|
FTableSchema null.Val[string] `db:"f_table_schema" `
|
|
FTableName null.Val[string] `db:"f_table_name" `
|
|
FGeometryColumn null.Val[string] `db:"f_geometry_column" `
|
|
CoordDimension null.Val[int32] `db:"coord_dimension" `
|
|
Srid null.Val[int32] `db:"srid" `
|
|
Type null.Val[string] `db:"type" `
|
|
}
|
|
|
|
// GeometryColumnSlice is an alias for a slice of pointers to GeometryColumn.
|
|
// This should almost always be used instead of []*GeometryColumn.
|
|
type GeometryColumnSlice []*GeometryColumn
|
|
|
|
// GeometryColumns contains methods to work with the geometry_columns view
|
|
var GeometryColumns = psql.NewViewx[*GeometryColumn, GeometryColumnSlice]("", "geometry_columns", buildGeometryColumnColumns("geometry_columns"))
|
|
|
|
// GeometryColumnsQuery is a query on the geometry_columns view
|
|
type GeometryColumnsQuery = *psql.ViewQuery[*GeometryColumn, GeometryColumnSlice]
|
|
|
|
func buildGeometryColumnColumns(alias string) geometryColumnColumns {
|
|
return geometryColumnColumns{
|
|
ColumnsExpr: expr.NewColumnsExpr(
|
|
"f_table_catalog", "f_table_schema", "f_table_name", "f_geometry_column", "coord_dimension", "srid", "type",
|
|
).WithParent("geometry_columns"),
|
|
tableAlias: alias,
|
|
FTableCatalog: psql.Quote(alias, "f_table_catalog"),
|
|
FTableSchema: psql.Quote(alias, "f_table_schema"),
|
|
FTableName: psql.Quote(alias, "f_table_name"),
|
|
FGeometryColumn: psql.Quote(alias, "f_geometry_column"),
|
|
CoordDimension: psql.Quote(alias, "coord_dimension"),
|
|
Srid: psql.Quote(alias, "srid"),
|
|
Type: psql.Quote(alias, "type"),
|
|
}
|
|
}
|
|
|
|
type geometryColumnColumns struct {
|
|
expr.ColumnsExpr
|
|
tableAlias string
|
|
FTableCatalog psql.Expression
|
|
FTableSchema psql.Expression
|
|
FTableName psql.Expression
|
|
FGeometryColumn psql.Expression
|
|
CoordDimension psql.Expression
|
|
Srid psql.Expression
|
|
Type psql.Expression
|
|
}
|
|
|
|
func (c geometryColumnColumns) Alias() string {
|
|
return c.tableAlias
|
|
}
|
|
|
|
func (geometryColumnColumns) AliasedAs(alias string) geometryColumnColumns {
|
|
return buildGeometryColumnColumns(alias)
|
|
}
|
|
|
|
// AfterQueryHook is called after GeometryColumn is retrieved from the database
|
|
func (o *GeometryColumn) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error {
|
|
var err error
|
|
|
|
switch queryType {
|
|
case bob.QueryTypeSelect:
|
|
ctx, err = GeometryColumns.AfterSelectHooks.RunHooks(ctx, exec, GeometryColumnSlice{o})
|
|
}
|
|
|
|
return err
|
|
}
|
|
|
|
// AfterQueryHook is called after GeometryColumnSlice is retrieved from the database
|
|
func (o GeometryColumnSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error {
|
|
var err error
|
|
|
|
switch queryType {
|
|
case bob.QueryTypeSelect:
|
|
ctx, err = GeometryColumns.AfterSelectHooks.RunHooks(ctx, exec, o)
|
|
}
|
|
|
|
return err
|
|
}
|
|
|
|
type geometryColumnWhere[Q psql.Filterable] struct {
|
|
FTableCatalog psql.WhereNullMod[Q, string]
|
|
FTableSchema psql.WhereNullMod[Q, string]
|
|
FTableName psql.WhereNullMod[Q, string]
|
|
FGeometryColumn psql.WhereNullMod[Q, string]
|
|
CoordDimension psql.WhereNullMod[Q, int32]
|
|
Srid psql.WhereNullMod[Q, int32]
|
|
Type psql.WhereNullMod[Q, string]
|
|
}
|
|
|
|
func (geometryColumnWhere[Q]) AliasedAs(alias string) geometryColumnWhere[Q] {
|
|
return buildGeometryColumnWhere[Q](buildGeometryColumnColumns(alias))
|
|
}
|
|
|
|
func buildGeometryColumnWhere[Q psql.Filterable](cols geometryColumnColumns) geometryColumnWhere[Q] {
|
|
return geometryColumnWhere[Q]{
|
|
FTableCatalog: psql.WhereNull[Q, string](cols.FTableCatalog),
|
|
FTableSchema: psql.WhereNull[Q, string](cols.FTableSchema),
|
|
FTableName: psql.WhereNull[Q, string](cols.FTableName),
|
|
FGeometryColumn: psql.WhereNull[Q, string](cols.FGeometryColumn),
|
|
CoordDimension: psql.WhereNull[Q, int32](cols.CoordDimension),
|
|
Srid: psql.WhereNull[Q, int32](cols.Srid),
|
|
Type: psql.WhereNull[Q, string](cols.Type),
|
|
}
|
|
}
|