85 lines
2.4 KiB
Go
85 lines
2.4 KiB
Go
//
|
|
// Code generated by go-jet DO NOT EDIT.
|
|
//
|
|
// WARNING: Changes to this file may cause incorrect behavior
|
|
// and will be lost if the code is regenerated
|
|
//
|
|
|
|
package table
|
|
|
|
import (
|
|
"github.com/go-jet/jet/v2/postgres"
|
|
)
|
|
|
|
var Locations = newLocationsTable("haystack", "locations", "")
|
|
|
|
type locationsTable struct {
|
|
postgres.Table
|
|
|
|
// Columns
|
|
ID postgres.ColumnString
|
|
Name postgres.ColumnString
|
|
Address postgres.ColumnString
|
|
Description postgres.ColumnString
|
|
|
|
AllColumns postgres.ColumnList
|
|
MutableColumns postgres.ColumnList
|
|
}
|
|
|
|
type LocationsTable struct {
|
|
locationsTable
|
|
|
|
EXCLUDED locationsTable
|
|
}
|
|
|
|
// AS creates new LocationsTable with assigned alias
|
|
func (a LocationsTable) AS(alias string) *LocationsTable {
|
|
return newLocationsTable(a.SchemaName(), a.TableName(), alias)
|
|
}
|
|
|
|
// Schema creates new LocationsTable with assigned schema name
|
|
func (a LocationsTable) FromSchema(schemaName string) *LocationsTable {
|
|
return newLocationsTable(schemaName, a.TableName(), a.Alias())
|
|
}
|
|
|
|
// WithPrefix creates new LocationsTable with assigned table prefix
|
|
func (a LocationsTable) WithPrefix(prefix string) *LocationsTable {
|
|
return newLocationsTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
|
|
}
|
|
|
|
// WithSuffix creates new LocationsTable with assigned table suffix
|
|
func (a LocationsTable) WithSuffix(suffix string) *LocationsTable {
|
|
return newLocationsTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
|
|
}
|
|
|
|
func newLocationsTable(schemaName, tableName, alias string) *LocationsTable {
|
|
return &LocationsTable{
|
|
locationsTable: newLocationsTableImpl(schemaName, tableName, alias),
|
|
EXCLUDED: newLocationsTableImpl("", "excluded", ""),
|
|
}
|
|
}
|
|
|
|
func newLocationsTableImpl(schemaName, tableName, alias string) locationsTable {
|
|
var (
|
|
IDColumn = postgres.StringColumn("id")
|
|
NameColumn = postgres.StringColumn("name")
|
|
AddressColumn = postgres.StringColumn("address")
|
|
DescriptionColumn = postgres.StringColumn("description")
|
|
allColumns = postgres.ColumnList{IDColumn, NameColumn, AddressColumn, DescriptionColumn}
|
|
mutableColumns = postgres.ColumnList{NameColumn, AddressColumn, DescriptionColumn}
|
|
)
|
|
|
|
return locationsTable{
|
|
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
|
|
|
//Columns
|
|
ID: IDColumn,
|
|
Name: NameColumn,
|
|
Address: AddressColumn,
|
|
Description: DescriptionColumn,
|
|
|
|
AllColumns: allColumns,
|
|
MutableColumns: mutableColumns,
|
|
}
|
|
}
|