This calculates the summary information of data in h3 nodes and puts it in the database for fast lookup.
171 lines
6.9 KiB
Go
171 lines
6.9 KiB
Go
// 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/lib/pq"
|
|
"github.com/stephenafamo/bob"
|
|
"github.com/stephenafamo/bob/dialect/psql"
|
|
"github.com/stephenafamo/bob/expr"
|
|
)
|
|
|
|
// RasterColumn is an object representing the database table.
|
|
type RasterColumn struct {
|
|
RTableCatalog null.Val[string] `db:"r_table_catalog" `
|
|
RTableSchema null.Val[string] `db:"r_table_schema" `
|
|
RTableName null.Val[string] `db:"r_table_name" `
|
|
RRasterColumn null.Val[string] `db:"r_raster_column" `
|
|
Srid null.Val[int32] `db:"srid" `
|
|
ScaleX null.Val[float64] `db:"scale_x" `
|
|
ScaleY null.Val[float64] `db:"scale_y" `
|
|
BlocksizeX null.Val[int32] `db:"blocksize_x" `
|
|
BlocksizeY null.Val[int32] `db:"blocksize_y" `
|
|
SameAlignment null.Val[bool] `db:"same_alignment" `
|
|
RegularBlocking null.Val[bool] `db:"regular_blocking" `
|
|
NumBands null.Val[int32] `db:"num_bands" `
|
|
PixelTypes null.Val[pq.StringArray] `db:"pixel_types" `
|
|
NodataValues null.Val[pq.Float64Array] `db:"nodata_values" `
|
|
OutDB null.Val[pq.BoolArray] `db:"out_db" `
|
|
Extent null.Val[string] `db:"extent" `
|
|
SpatialIndex null.Val[bool] `db:"spatial_index" `
|
|
}
|
|
|
|
// RasterColumnSlice is an alias for a slice of pointers to RasterColumn.
|
|
// This should almost always be used instead of []*RasterColumn.
|
|
type RasterColumnSlice []*RasterColumn
|
|
|
|
// RasterColumns contains methods to work with the raster_columns view
|
|
var RasterColumns = psql.NewViewx[*RasterColumn, RasterColumnSlice]("", "raster_columns", buildRasterColumnColumns("raster_columns"))
|
|
|
|
// RasterColumnsQuery is a query on the raster_columns view
|
|
type RasterColumnsQuery = *psql.ViewQuery[*RasterColumn, RasterColumnSlice]
|
|
|
|
func buildRasterColumnColumns(alias string) rasterColumnColumns {
|
|
return rasterColumnColumns{
|
|
ColumnsExpr: expr.NewColumnsExpr(
|
|
"r_table_catalog", "r_table_schema", "r_table_name", "r_raster_column", "srid", "scale_x", "scale_y", "blocksize_x", "blocksize_y", "same_alignment", "regular_blocking", "num_bands", "pixel_types", "nodata_values", "out_db", "extent", "spatial_index",
|
|
).WithParent("raster_columns"),
|
|
tableAlias: alias,
|
|
RTableCatalog: psql.Quote(alias, "r_table_catalog"),
|
|
RTableSchema: psql.Quote(alias, "r_table_schema"),
|
|
RTableName: psql.Quote(alias, "r_table_name"),
|
|
RRasterColumn: psql.Quote(alias, "r_raster_column"),
|
|
Srid: psql.Quote(alias, "srid"),
|
|
ScaleX: psql.Quote(alias, "scale_x"),
|
|
ScaleY: psql.Quote(alias, "scale_y"),
|
|
BlocksizeX: psql.Quote(alias, "blocksize_x"),
|
|
BlocksizeY: psql.Quote(alias, "blocksize_y"),
|
|
SameAlignment: psql.Quote(alias, "same_alignment"),
|
|
RegularBlocking: psql.Quote(alias, "regular_blocking"),
|
|
NumBands: psql.Quote(alias, "num_bands"),
|
|
PixelTypes: psql.Quote(alias, "pixel_types"),
|
|
NodataValues: psql.Quote(alias, "nodata_values"),
|
|
OutDB: psql.Quote(alias, "out_db"),
|
|
Extent: psql.Quote(alias, "extent"),
|
|
SpatialIndex: psql.Quote(alias, "spatial_index"),
|
|
}
|
|
}
|
|
|
|
type rasterColumnColumns struct {
|
|
expr.ColumnsExpr
|
|
tableAlias string
|
|
RTableCatalog psql.Expression
|
|
RTableSchema psql.Expression
|
|
RTableName psql.Expression
|
|
RRasterColumn psql.Expression
|
|
Srid psql.Expression
|
|
ScaleX psql.Expression
|
|
ScaleY psql.Expression
|
|
BlocksizeX psql.Expression
|
|
BlocksizeY psql.Expression
|
|
SameAlignment psql.Expression
|
|
RegularBlocking psql.Expression
|
|
NumBands psql.Expression
|
|
PixelTypes psql.Expression
|
|
NodataValues psql.Expression
|
|
OutDB psql.Expression
|
|
Extent psql.Expression
|
|
SpatialIndex psql.Expression
|
|
}
|
|
|
|
func (c rasterColumnColumns) Alias() string {
|
|
return c.tableAlias
|
|
}
|
|
|
|
func (rasterColumnColumns) AliasedAs(alias string) rasterColumnColumns {
|
|
return buildRasterColumnColumns(alias)
|
|
}
|
|
|
|
// AfterQueryHook is called after RasterColumn is retrieved from the database
|
|
func (o *RasterColumn) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error {
|
|
var err error
|
|
|
|
switch queryType {
|
|
case bob.QueryTypeSelect:
|
|
ctx, err = RasterColumns.AfterSelectHooks.RunHooks(ctx, exec, RasterColumnSlice{o})
|
|
}
|
|
|
|
return err
|
|
}
|
|
|
|
// AfterQueryHook is called after RasterColumnSlice is retrieved from the database
|
|
func (o RasterColumnSlice) AfterQueryHook(ctx context.Context, exec bob.Executor, queryType bob.QueryType) error {
|
|
var err error
|
|
|
|
switch queryType {
|
|
case bob.QueryTypeSelect:
|
|
ctx, err = RasterColumns.AfterSelectHooks.RunHooks(ctx, exec, o)
|
|
}
|
|
|
|
return err
|
|
}
|
|
|
|
type rasterColumnWhere[Q psql.Filterable] struct {
|
|
RTableCatalog psql.WhereNullMod[Q, string]
|
|
RTableSchema psql.WhereNullMod[Q, string]
|
|
RTableName psql.WhereNullMod[Q, string]
|
|
RRasterColumn psql.WhereNullMod[Q, string]
|
|
Srid psql.WhereNullMod[Q, int32]
|
|
ScaleX psql.WhereNullMod[Q, float64]
|
|
ScaleY psql.WhereNullMod[Q, float64]
|
|
BlocksizeX psql.WhereNullMod[Q, int32]
|
|
BlocksizeY psql.WhereNullMod[Q, int32]
|
|
SameAlignment psql.WhereNullMod[Q, bool]
|
|
RegularBlocking psql.WhereNullMod[Q, bool]
|
|
NumBands psql.WhereNullMod[Q, int32]
|
|
PixelTypes psql.WhereNullMod[Q, pq.StringArray]
|
|
NodataValues psql.WhereNullMod[Q, pq.Float64Array]
|
|
OutDB psql.WhereNullMod[Q, pq.BoolArray]
|
|
Extent psql.WhereNullMod[Q, string]
|
|
SpatialIndex psql.WhereNullMod[Q, bool]
|
|
}
|
|
|
|
func (rasterColumnWhere[Q]) AliasedAs(alias string) rasterColumnWhere[Q] {
|
|
return buildRasterColumnWhere[Q](buildRasterColumnColumns(alias))
|
|
}
|
|
|
|
func buildRasterColumnWhere[Q psql.Filterable](cols rasterColumnColumns) rasterColumnWhere[Q] {
|
|
return rasterColumnWhere[Q]{
|
|
RTableCatalog: psql.WhereNull[Q, string](cols.RTableCatalog),
|
|
RTableSchema: psql.WhereNull[Q, string](cols.RTableSchema),
|
|
RTableName: psql.WhereNull[Q, string](cols.RTableName),
|
|
RRasterColumn: psql.WhereNull[Q, string](cols.RRasterColumn),
|
|
Srid: psql.WhereNull[Q, int32](cols.Srid),
|
|
ScaleX: psql.WhereNull[Q, float64](cols.ScaleX),
|
|
ScaleY: psql.WhereNull[Q, float64](cols.ScaleY),
|
|
BlocksizeX: psql.WhereNull[Q, int32](cols.BlocksizeX),
|
|
BlocksizeY: psql.WhereNull[Q, int32](cols.BlocksizeY),
|
|
SameAlignment: psql.WhereNull[Q, bool](cols.SameAlignment),
|
|
RegularBlocking: psql.WhereNull[Q, bool](cols.RegularBlocking),
|
|
NumBands: psql.WhereNull[Q, int32](cols.NumBands),
|
|
PixelTypes: psql.WhereNull[Q, pq.StringArray](cols.PixelTypes),
|
|
NodataValues: psql.WhereNull[Q, pq.Float64Array](cols.NodataValues),
|
|
OutDB: psql.WhereNull[Q, pq.BoolArray](cols.OutDB),
|
|
Extent: psql.WhereNull[Q, string](cols.Extent),
|
|
SpatialIndex: psql.WhereNull[Q, bool](cols.SpatialIndex),
|
|
}
|
|
}
|