91 lines
2.6 KiB
Go
91 lines
2.6 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 Lists = newListsTable("haystack", "lists", "")
|
|
|
|
type listsTable struct {
|
|
postgres.Table
|
|
|
|
// Columns
|
|
ID postgres.ColumnString
|
|
UserID postgres.ColumnString
|
|
Name postgres.ColumnString
|
|
Description postgres.ColumnString
|
|
CreatedAt postgres.ColumnTimestampz
|
|
|
|
AllColumns postgres.ColumnList
|
|
MutableColumns postgres.ColumnList
|
|
DefaultColumns postgres.ColumnList
|
|
}
|
|
|
|
type ListsTable struct {
|
|
listsTable
|
|
|
|
EXCLUDED listsTable
|
|
}
|
|
|
|
// AS creates new ListsTable with assigned alias
|
|
func (a ListsTable) AS(alias string) *ListsTable {
|
|
return newListsTable(a.SchemaName(), a.TableName(), alias)
|
|
}
|
|
|
|
// Schema creates new ListsTable with assigned schema name
|
|
func (a ListsTable) FromSchema(schemaName string) *ListsTable {
|
|
return newListsTable(schemaName, a.TableName(), a.Alias())
|
|
}
|
|
|
|
// WithPrefix creates new ListsTable with assigned table prefix
|
|
func (a ListsTable) WithPrefix(prefix string) *ListsTable {
|
|
return newListsTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
|
|
}
|
|
|
|
// WithSuffix creates new ListsTable with assigned table suffix
|
|
func (a ListsTable) WithSuffix(suffix string) *ListsTable {
|
|
return newListsTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
|
|
}
|
|
|
|
func newListsTable(schemaName, tableName, alias string) *ListsTable {
|
|
return &ListsTable{
|
|
listsTable: newListsTableImpl(schemaName, tableName, alias),
|
|
EXCLUDED: newListsTableImpl("", "excluded", ""),
|
|
}
|
|
}
|
|
|
|
func newListsTableImpl(schemaName, tableName, alias string) listsTable {
|
|
var (
|
|
IDColumn = postgres.StringColumn("id")
|
|
UserIDColumn = postgres.StringColumn("user_id")
|
|
NameColumn = postgres.StringColumn("name")
|
|
DescriptionColumn = postgres.StringColumn("description")
|
|
CreatedAtColumn = postgres.TimestampzColumn("created_at")
|
|
allColumns = postgres.ColumnList{IDColumn, UserIDColumn, NameColumn, DescriptionColumn, CreatedAtColumn}
|
|
mutableColumns = postgres.ColumnList{UserIDColumn, NameColumn, DescriptionColumn, CreatedAtColumn}
|
|
defaultColumns = postgres.ColumnList{IDColumn, CreatedAtColumn}
|
|
)
|
|
|
|
return listsTable{
|
|
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
|
|
|
//Columns
|
|
ID: IDColumn,
|
|
UserID: UserIDColumn,
|
|
Name: NameColumn,
|
|
Description: DescriptionColumn,
|
|
CreatedAt: CreatedAtColumn,
|
|
|
|
AllColumns: allColumns,
|
|
MutableColumns: mutableColumns,
|
|
DefaultColumns: defaultColumns,
|
|
}
|
|
}
|