88 lines
2.5 KiB
Go
88 lines
2.5 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 Contacts = newContactsTable("haystack", "contacts", "")
|
|
|
|
type contactsTable struct {
|
|
postgres.Table
|
|
|
|
// Columns
|
|
ID postgres.ColumnString
|
|
Name postgres.ColumnString
|
|
Description postgres.ColumnString
|
|
PhoneNumber postgres.ColumnString
|
|
Email postgres.ColumnString
|
|
|
|
AllColumns postgres.ColumnList
|
|
MutableColumns postgres.ColumnList
|
|
}
|
|
|
|
type ContactsTable struct {
|
|
contactsTable
|
|
|
|
EXCLUDED contactsTable
|
|
}
|
|
|
|
// AS creates new ContactsTable with assigned alias
|
|
func (a ContactsTable) AS(alias string) *ContactsTable {
|
|
return newContactsTable(a.SchemaName(), a.TableName(), alias)
|
|
}
|
|
|
|
// Schema creates new ContactsTable with assigned schema name
|
|
func (a ContactsTable) FromSchema(schemaName string) *ContactsTable {
|
|
return newContactsTable(schemaName, a.TableName(), a.Alias())
|
|
}
|
|
|
|
// WithPrefix creates new ContactsTable with assigned table prefix
|
|
func (a ContactsTable) WithPrefix(prefix string) *ContactsTable {
|
|
return newContactsTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
|
|
}
|
|
|
|
// WithSuffix creates new ContactsTable with assigned table suffix
|
|
func (a ContactsTable) WithSuffix(suffix string) *ContactsTable {
|
|
return newContactsTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
|
|
}
|
|
|
|
func newContactsTable(schemaName, tableName, alias string) *ContactsTable {
|
|
return &ContactsTable{
|
|
contactsTable: newContactsTableImpl(schemaName, tableName, alias),
|
|
EXCLUDED: newContactsTableImpl("", "excluded", ""),
|
|
}
|
|
}
|
|
|
|
func newContactsTableImpl(schemaName, tableName, alias string) contactsTable {
|
|
var (
|
|
IDColumn = postgres.StringColumn("id")
|
|
NameColumn = postgres.StringColumn("name")
|
|
DescriptionColumn = postgres.StringColumn("description")
|
|
PhoneNumberColumn = postgres.StringColumn("phone_number")
|
|
EmailColumn = postgres.StringColumn("email")
|
|
allColumns = postgres.ColumnList{IDColumn, NameColumn, DescriptionColumn, PhoneNumberColumn, EmailColumn}
|
|
mutableColumns = postgres.ColumnList{NameColumn, DescriptionColumn, PhoneNumberColumn, EmailColumn}
|
|
)
|
|
|
|
return contactsTable{
|
|
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
|
|
|
//Columns
|
|
ID: IDColumn,
|
|
Name: NameColumn,
|
|
Description: DescriptionColumn,
|
|
PhoneNumber: PhoneNumberColumn,
|
|
Email: EmailColumn,
|
|
|
|
AllColumns: allColumns,
|
|
MutableColumns: mutableColumns,
|
|
}
|
|
}
|