Move database logic into separate subdirectory
I'm trying to see if this speeds up builds a bit. May not without a module boundary, but for now it's nice organization to have as the program grows.
This commit is contained in:
parent
338f90708e
commit
41587c3694
333 changed files with 206 additions and 200 deletions
120
db/models/geography_columns.bob.go
Normal file
120
db/models/geography_columns.bob.go
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
// Code generated by BobGen psql v0.41.1. 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"
|
||||
)
|
||||
|
||||
// GeographyColumn is an object representing the database table.
|
||||
type GeographyColumn 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" `
|
||||
FGeographyColumn null.Val[string] `db:"f_geography_column" `
|
||||
CoordDimension null.Val[int32] `db:"coord_dimension" `
|
||||
Srid null.Val[int32] `db:"srid" `
|
||||
Type null.Val[string] `db:"type" `
|
||||
}
|
||||
|
||||
// GeographyColumnSlice is an alias for a slice of pointers to GeographyColumn.
|
||||
// This should almost always be used instead of []*GeographyColumn.
|
||||
type GeographyColumnSlice []*GeographyColumn
|
||||
|
||||
// GeographyColumns contains methods to work with the geography_columns view
|
||||
var GeographyColumns = psql.NewViewx[*GeographyColumn, GeographyColumnSlice]("", "geography_columns", buildGeographyColumnColumns("geography_columns"))
|
||||
|
||||
// GeographyColumnsQuery is a query on the geography_columns view
|
||||
type GeographyColumnsQuery = *psql.ViewQuery[*GeographyColumn, GeographyColumnSlice]
|
||||
|
||||
func buildGeographyColumnColumns(alias string) geographyColumnColumns {
|
||||
return geographyColumnColumns{
|
||||
ColumnsExpr: expr.NewColumnsExpr(
|
||||
"f_table_catalog", "f_table_schema", "f_table_name", "f_geography_column", "coord_dimension", "srid", "type",
|
||||
).WithParent("geography_columns"),
|
||||
tableAlias: alias,
|
||||
FTableCatalog: psql.Quote(alias, "f_table_catalog"),
|
||||
FTableSchema: psql.Quote(alias, "f_table_schema"),
|
||||
FTableName: psql.Quote(alias, "f_table_name"),
|
||||
FGeographyColumn: psql.Quote(alias, "f_geography_column"),
|
||||
CoordDimension: psql.Quote(alias, "coord_dimension"),
|
||||
Srid: psql.Quote(alias, "srid"),
|
||||
Type: psql.Quote(alias, "type"),
|
||||
}
|
||||
}
|
||||
|
||||
type geographyColumnColumns struct {
|
||||
expr.ColumnsExpr
|
||||
tableAlias string
|
||||
FTableCatalog psql.Expression
|
||||
FTableSchema psql.Expression
|
||||
FTableName psql.Expression
|
||||
FGeographyColumn psql.Expression
|
||||
CoordDimension psql.Expression
|
||||
Srid psql.Expression
|
||||
Type psql.Expression
|
||||
}
|
||||
|
||||
func (c geographyColumnColumns) Alias() string {
|
||||
return c.tableAlias
|
||||
}
|
||||
|
||||
func (geographyColumnColumns) AliasedAs(alias string) geographyColumnColumns {
|
||||
return buildGeographyColumnColumns(alias)
|
||||
}
|
||||
|
||||
// AfterQueryHook is called after GeographyColumn is retrieved from the database
|
||||
func (o *GeographyColumn) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error {
|
||||
var err error
|
||||
|
||||
switch queryType {
|
||||
case bob.QueryTypeSelect:
|
||||
ctx, err = GeographyColumns.AfterSelectHooks.RunHooks(ctx, exec, GeographyColumnSlice{o})
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// AfterQueryHook is called after GeographyColumnSlice is retrieved from the database
|
||||
func (o GeographyColumnSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error {
|
||||
var err error
|
||||
|
||||
switch queryType {
|
||||
case bob.QueryTypeSelect:
|
||||
ctx, err = GeographyColumns.AfterSelectHooks.RunHooks(ctx, exec, o)
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
type geographyColumnWhere[Q psql.Filterable] struct {
|
||||
FTableCatalog psql.WhereNullMod[Q, string]
|
||||
FTableSchema psql.WhereNullMod[Q, string]
|
||||
FTableName psql.WhereNullMod[Q, string]
|
||||
FGeographyColumn psql.WhereNullMod[Q, string]
|
||||
CoordDimension psql.WhereNullMod[Q, int32]
|
||||
Srid psql.WhereNullMod[Q, int32]
|
||||
Type psql.WhereNullMod[Q, string]
|
||||
}
|
||||
|
||||
func (geographyColumnWhere[Q]) AliasedAs(alias string) geographyColumnWhere[Q] {
|
||||
return buildGeographyColumnWhere[Q](buildGeographyColumnColumns(alias))
|
||||
}
|
||||
|
||||
func buildGeographyColumnWhere[Q psql.Filterable](cols geographyColumnColumns) geographyColumnWhere[Q] {
|
||||
return geographyColumnWhere[Q]{
|
||||
FTableCatalog: psql.WhereNull[Q, string](cols.FTableCatalog),
|
||||
FTableSchema: psql.WhereNull[Q, string](cols.FTableSchema),
|
||||
FTableName: psql.WhereNull[Q, string](cols.FTableName),
|
||||
FGeographyColumn: psql.WhereNull[Q, string](cols.FGeographyColumn),
|
||||
CoordDimension: psql.WhereNull[Q, int32](cols.CoordDimension),
|
||||
Srid: psql.WhereNull[Q, int32](cols.Srid),
|
||||
Type: psql.WhereNull[Q, string](cols.Type),
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue