118 lines
3.9 KiB
Go
118 lines
3.9 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 Posts = newPostsTable("public", "posts", "")
|
|
|
|
type postsTable struct {
|
|
postgres.Table
|
|
|
|
// Columns
|
|
ID postgres.ColumnInteger
|
|
CreatedAt postgres.ColumnTimestamp
|
|
UpdatedAt postgres.ColumnTimestamp
|
|
DeletedAt postgres.ColumnTimestamp
|
|
Status postgres.ColumnInteger
|
|
Title postgres.ColumnString
|
|
Description postgres.ColumnString
|
|
Content postgres.ColumnString
|
|
Price postgres.ColumnInteger
|
|
Discount postgres.ColumnInteger
|
|
Views postgres.ColumnInteger
|
|
Likes postgres.ColumnInteger
|
|
Tags postgres.ColumnString
|
|
Assets postgres.ColumnString
|
|
HeadImages postgres.ColumnString
|
|
|
|
AllColumns postgres.ColumnList
|
|
MutableColumns postgres.ColumnList
|
|
}
|
|
|
|
type PostsTable struct {
|
|
postsTable
|
|
|
|
EXCLUDED postsTable
|
|
}
|
|
|
|
// AS creates new PostsTable with assigned alias
|
|
func (a PostsTable) AS(alias string) *PostsTable {
|
|
return newPostsTable(a.SchemaName(), a.TableName(), alias)
|
|
}
|
|
|
|
// Schema creates new PostsTable with assigned schema name
|
|
func (a PostsTable) FromSchema(schemaName string) *PostsTable {
|
|
return newPostsTable(schemaName, a.TableName(), a.Alias())
|
|
}
|
|
|
|
// WithPrefix creates new PostsTable with assigned table prefix
|
|
func (a PostsTable) WithPrefix(prefix string) *PostsTable {
|
|
return newPostsTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
|
|
}
|
|
|
|
// WithSuffix creates new PostsTable with assigned table suffix
|
|
func (a PostsTable) WithSuffix(suffix string) *PostsTable {
|
|
return newPostsTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
|
|
}
|
|
|
|
func newPostsTable(schemaName, tableName, alias string) *PostsTable {
|
|
return &PostsTable{
|
|
postsTable: newPostsTableImpl(schemaName, tableName, alias),
|
|
EXCLUDED: newPostsTableImpl("", "excluded", ""),
|
|
}
|
|
}
|
|
|
|
func newPostsTableImpl(schemaName, tableName, alias string) postsTable {
|
|
var (
|
|
IDColumn = postgres.IntegerColumn("id")
|
|
CreatedAtColumn = postgres.TimestampColumn("created_at")
|
|
UpdatedAtColumn = postgres.TimestampColumn("updated_at")
|
|
DeletedAtColumn = postgres.TimestampColumn("deleted_at")
|
|
StatusColumn = postgres.IntegerColumn("status")
|
|
TitleColumn = postgres.StringColumn("title")
|
|
DescriptionColumn = postgres.StringColumn("description")
|
|
ContentColumn = postgres.StringColumn("content")
|
|
PriceColumn = postgres.IntegerColumn("price")
|
|
DiscountColumn = postgres.IntegerColumn("discount")
|
|
ViewsColumn = postgres.IntegerColumn("views")
|
|
LikesColumn = postgres.IntegerColumn("likes")
|
|
TagsColumn = postgres.StringColumn("tags")
|
|
AssetsColumn = postgres.StringColumn("assets")
|
|
HeadImagesColumn = postgres.StringColumn("head_images")
|
|
allColumns = postgres.ColumnList{IDColumn, CreatedAtColumn, UpdatedAtColumn, DeletedAtColumn, StatusColumn, TitleColumn, DescriptionColumn, ContentColumn, PriceColumn, DiscountColumn, ViewsColumn, LikesColumn, TagsColumn, AssetsColumn, HeadImagesColumn}
|
|
mutableColumns = postgres.ColumnList{CreatedAtColumn, UpdatedAtColumn, DeletedAtColumn, StatusColumn, TitleColumn, DescriptionColumn, ContentColumn, PriceColumn, DiscountColumn, ViewsColumn, LikesColumn, TagsColumn, AssetsColumn, HeadImagesColumn}
|
|
)
|
|
|
|
return postsTable{
|
|
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
|
|
|
//Columns
|
|
ID: IDColumn,
|
|
CreatedAt: CreatedAtColumn,
|
|
UpdatedAt: UpdatedAtColumn,
|
|
DeletedAt: DeletedAtColumn,
|
|
Status: StatusColumn,
|
|
Title: TitleColumn,
|
|
Description: DescriptionColumn,
|
|
Content: ContentColumn,
|
|
Price: PriceColumn,
|
|
Discount: DiscountColumn,
|
|
Views: ViewsColumn,
|
|
Likes: LikesColumn,
|
|
Tags: TagsColumn,
|
|
Assets: AssetsColumn,
|
|
HeadImages: HeadImagesColumn,
|
|
|
|
AllColumns: allColumns,
|
|
MutableColumns: mutableColumns,
|
|
}
|
|
}
|