feat: update
This commit is contained in:
96
backend/database/table/medias.go
Normal file
96
backend/database/table/medias.go
Normal file
@@ -0,0 +1,96 @@
|
||||
//
|
||||
// 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 Medias = newMediasTable("public", "medias", "")
|
||||
|
||||
type mediasTable struct {
|
||||
postgres.Table
|
||||
|
||||
// Columns
|
||||
ID postgres.ColumnInteger
|
||||
CreatedAt postgres.ColumnTimestamp
|
||||
Name postgres.ColumnString
|
||||
MimeType postgres.ColumnString
|
||||
Size postgres.ColumnInteger
|
||||
Path postgres.ColumnString
|
||||
Metas postgres.ColumnString
|
||||
Hash postgres.ColumnString
|
||||
|
||||
AllColumns postgres.ColumnList
|
||||
MutableColumns postgres.ColumnList
|
||||
}
|
||||
|
||||
type MediasTable struct {
|
||||
mediasTable
|
||||
|
||||
EXCLUDED mediasTable
|
||||
}
|
||||
|
||||
// AS creates new MediasTable with assigned alias
|
||||
func (a MediasTable) AS(alias string) *MediasTable {
|
||||
return newMediasTable(a.SchemaName(), a.TableName(), alias)
|
||||
}
|
||||
|
||||
// Schema creates new MediasTable with assigned schema name
|
||||
func (a MediasTable) FromSchema(schemaName string) *MediasTable {
|
||||
return newMediasTable(schemaName, a.TableName(), a.Alias())
|
||||
}
|
||||
|
||||
// WithPrefix creates new MediasTable with assigned table prefix
|
||||
func (a MediasTable) WithPrefix(prefix string) *MediasTable {
|
||||
return newMediasTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
|
||||
}
|
||||
|
||||
// WithSuffix creates new MediasTable with assigned table suffix
|
||||
func (a MediasTable) WithSuffix(suffix string) *MediasTable {
|
||||
return newMediasTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
|
||||
}
|
||||
|
||||
func newMediasTable(schemaName, tableName, alias string) *MediasTable {
|
||||
return &MediasTable{
|
||||
mediasTable: newMediasTableImpl(schemaName, tableName, alias),
|
||||
EXCLUDED: newMediasTableImpl("", "excluded", ""),
|
||||
}
|
||||
}
|
||||
|
||||
func newMediasTableImpl(schemaName, tableName, alias string) mediasTable {
|
||||
var (
|
||||
IDColumn = postgres.IntegerColumn("id")
|
||||
CreatedAtColumn = postgres.TimestampColumn("created_at")
|
||||
NameColumn = postgres.StringColumn("name")
|
||||
MimeTypeColumn = postgres.StringColumn("mime_type")
|
||||
SizeColumn = postgres.IntegerColumn("size")
|
||||
PathColumn = postgres.StringColumn("path")
|
||||
MetasColumn = postgres.StringColumn("metas")
|
||||
HashColumn = postgres.StringColumn("hash")
|
||||
allColumns = postgres.ColumnList{IDColumn, CreatedAtColumn, NameColumn, MimeTypeColumn, SizeColumn, PathColumn, MetasColumn, HashColumn}
|
||||
mutableColumns = postgres.ColumnList{CreatedAtColumn, NameColumn, MimeTypeColumn, SizeColumn, PathColumn, MetasColumn, HashColumn}
|
||||
)
|
||||
|
||||
return mediasTable{
|
||||
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
||||
|
||||
//Columns
|
||||
ID: IDColumn,
|
||||
CreatedAt: CreatedAtColumn,
|
||||
Name: NameColumn,
|
||||
MimeType: MimeTypeColumn,
|
||||
Size: SizeColumn,
|
||||
Path: PathColumn,
|
||||
Metas: MetasColumn,
|
||||
Hash: HashColumn,
|
||||
|
||||
AllColumns: allColumns,
|
||||
MutableColumns: mutableColumns,
|
||||
}
|
||||
}
|
||||
84
backend/database/table/migrations.go
Normal file
84
backend/database/table/migrations.go
Normal file
@@ -0,0 +1,84 @@
|
||||
//
|
||||
// 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 Migrations = newMigrationsTable("public", "migrations", "")
|
||||
|
||||
type migrationsTable struct {
|
||||
postgres.Table
|
||||
|
||||
// Columns
|
||||
ID postgres.ColumnInteger
|
||||
VersionID postgres.ColumnInteger
|
||||
IsApplied postgres.ColumnBool
|
||||
Tstamp postgres.ColumnTimestamp
|
||||
|
||||
AllColumns postgres.ColumnList
|
||||
MutableColumns postgres.ColumnList
|
||||
}
|
||||
|
||||
type MigrationsTable struct {
|
||||
migrationsTable
|
||||
|
||||
EXCLUDED migrationsTable
|
||||
}
|
||||
|
||||
// AS creates new MigrationsTable with assigned alias
|
||||
func (a MigrationsTable) AS(alias string) *MigrationsTable {
|
||||
return newMigrationsTable(a.SchemaName(), a.TableName(), alias)
|
||||
}
|
||||
|
||||
// Schema creates new MigrationsTable with assigned schema name
|
||||
func (a MigrationsTable) FromSchema(schemaName string) *MigrationsTable {
|
||||
return newMigrationsTable(schemaName, a.TableName(), a.Alias())
|
||||
}
|
||||
|
||||
// WithPrefix creates new MigrationsTable with assigned table prefix
|
||||
func (a MigrationsTable) WithPrefix(prefix string) *MigrationsTable {
|
||||
return newMigrationsTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
|
||||
}
|
||||
|
||||
// WithSuffix creates new MigrationsTable with assigned table suffix
|
||||
func (a MigrationsTable) WithSuffix(suffix string) *MigrationsTable {
|
||||
return newMigrationsTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
|
||||
}
|
||||
|
||||
func newMigrationsTable(schemaName, tableName, alias string) *MigrationsTable {
|
||||
return &MigrationsTable{
|
||||
migrationsTable: newMigrationsTableImpl(schemaName, tableName, alias),
|
||||
EXCLUDED: newMigrationsTableImpl("", "excluded", ""),
|
||||
}
|
||||
}
|
||||
|
||||
func newMigrationsTableImpl(schemaName, tableName, alias string) migrationsTable {
|
||||
var (
|
||||
IDColumn = postgres.IntegerColumn("id")
|
||||
VersionIDColumn = postgres.IntegerColumn("version_id")
|
||||
IsAppliedColumn = postgres.BoolColumn("is_applied")
|
||||
TstampColumn = postgres.TimestampColumn("tstamp")
|
||||
allColumns = postgres.ColumnList{IDColumn, VersionIDColumn, IsAppliedColumn, TstampColumn}
|
||||
mutableColumns = postgres.ColumnList{VersionIDColumn, IsAppliedColumn, TstampColumn}
|
||||
)
|
||||
|
||||
return migrationsTable{
|
||||
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
||||
|
||||
//Columns
|
||||
ID: IDColumn,
|
||||
VersionID: VersionIDColumn,
|
||||
IsApplied: IsAppliedColumn,
|
||||
Tstamp: TstampColumn,
|
||||
|
||||
AllColumns: allColumns,
|
||||
MutableColumns: mutableColumns,
|
||||
}
|
||||
}
|
||||
117
backend/database/table/orders.go
Normal file
117
backend/database/table/orders.go
Normal file
@@ -0,0 +1,117 @@
|
||||
//
|
||||
// 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 Orders = newOrdersTable("public", "orders", "")
|
||||
|
||||
type ordersTable struct {
|
||||
postgres.Table
|
||||
|
||||
// Columns
|
||||
ID postgres.ColumnInteger
|
||||
CreatedAt postgres.ColumnTimestamp
|
||||
UpdatedAt postgres.ColumnTimestamp
|
||||
OrderNo postgres.ColumnString
|
||||
SubOrderNo postgres.ColumnString
|
||||
TransactionID postgres.ColumnString
|
||||
RefundTransactionID postgres.ColumnString
|
||||
Price postgres.ColumnInteger
|
||||
Discount postgres.ColumnInteger
|
||||
Currency postgres.ColumnString
|
||||
PaymentMethod postgres.ColumnString
|
||||
PostID postgres.ColumnInteger
|
||||
UserID postgres.ColumnInteger
|
||||
Status postgres.ColumnInteger
|
||||
Meta postgres.ColumnString
|
||||
|
||||
AllColumns postgres.ColumnList
|
||||
MutableColumns postgres.ColumnList
|
||||
}
|
||||
|
||||
type OrdersTable struct {
|
||||
ordersTable
|
||||
|
||||
EXCLUDED ordersTable
|
||||
}
|
||||
|
||||
// AS creates new OrdersTable with assigned alias
|
||||
func (a OrdersTable) AS(alias string) *OrdersTable {
|
||||
return newOrdersTable(a.SchemaName(), a.TableName(), alias)
|
||||
}
|
||||
|
||||
// Schema creates new OrdersTable with assigned schema name
|
||||
func (a OrdersTable) FromSchema(schemaName string) *OrdersTable {
|
||||
return newOrdersTable(schemaName, a.TableName(), a.Alias())
|
||||
}
|
||||
|
||||
// WithPrefix creates new OrdersTable with assigned table prefix
|
||||
func (a OrdersTable) WithPrefix(prefix string) *OrdersTable {
|
||||
return newOrdersTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
|
||||
}
|
||||
|
||||
// WithSuffix creates new OrdersTable with assigned table suffix
|
||||
func (a OrdersTable) WithSuffix(suffix string) *OrdersTable {
|
||||
return newOrdersTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
|
||||
}
|
||||
|
||||
func newOrdersTable(schemaName, tableName, alias string) *OrdersTable {
|
||||
return &OrdersTable{
|
||||
ordersTable: newOrdersTableImpl(schemaName, tableName, alias),
|
||||
EXCLUDED: newOrdersTableImpl("", "excluded", ""),
|
||||
}
|
||||
}
|
||||
|
||||
func newOrdersTableImpl(schemaName, tableName, alias string) ordersTable {
|
||||
var (
|
||||
IDColumn = postgres.IntegerColumn("id")
|
||||
CreatedAtColumn = postgres.TimestampColumn("created_at")
|
||||
UpdatedAtColumn = postgres.TimestampColumn("updated_at")
|
||||
OrderNoColumn = postgres.StringColumn("order_no")
|
||||
SubOrderNoColumn = postgres.StringColumn("sub_order_no")
|
||||
TransactionIDColumn = postgres.StringColumn("transaction_id")
|
||||
RefundTransactionIDColumn = postgres.StringColumn("refund_transaction_id")
|
||||
PriceColumn = postgres.IntegerColumn("price")
|
||||
DiscountColumn = postgres.IntegerColumn("discount")
|
||||
CurrencyColumn = postgres.StringColumn("currency")
|
||||
PaymentMethodColumn = postgres.StringColumn("payment_method")
|
||||
PostIDColumn = postgres.IntegerColumn("post_id")
|
||||
UserIDColumn = postgres.IntegerColumn("user_id")
|
||||
StatusColumn = postgres.IntegerColumn("status")
|
||||
MetaColumn = postgres.StringColumn("meta")
|
||||
allColumns = postgres.ColumnList{IDColumn, CreatedAtColumn, UpdatedAtColumn, OrderNoColumn, SubOrderNoColumn, TransactionIDColumn, RefundTransactionIDColumn, PriceColumn, DiscountColumn, CurrencyColumn, PaymentMethodColumn, PostIDColumn, UserIDColumn, StatusColumn, MetaColumn}
|
||||
mutableColumns = postgres.ColumnList{CreatedAtColumn, UpdatedAtColumn, OrderNoColumn, SubOrderNoColumn, TransactionIDColumn, RefundTransactionIDColumn, PriceColumn, DiscountColumn, CurrencyColumn, PaymentMethodColumn, PostIDColumn, UserIDColumn, StatusColumn, MetaColumn}
|
||||
)
|
||||
|
||||
return ordersTable{
|
||||
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
||||
|
||||
//Columns
|
||||
ID: IDColumn,
|
||||
CreatedAt: CreatedAtColumn,
|
||||
UpdatedAt: UpdatedAtColumn,
|
||||
OrderNo: OrderNoColumn,
|
||||
SubOrderNo: SubOrderNoColumn,
|
||||
TransactionID: TransactionIDColumn,
|
||||
RefundTransactionID: RefundTransactionIDColumn,
|
||||
Price: PriceColumn,
|
||||
Discount: DiscountColumn,
|
||||
Currency: CurrencyColumn,
|
||||
PaymentMethod: PaymentMethodColumn,
|
||||
PostID: PostIDColumn,
|
||||
UserID: UserIDColumn,
|
||||
Status: StatusColumn,
|
||||
Meta: MetaColumn,
|
||||
|
||||
AllColumns: allColumns,
|
||||
MutableColumns: mutableColumns,
|
||||
}
|
||||
}
|
||||
117
backend/database/table/posts.go
Normal file
117
backend/database/table/posts.go
Normal file
@@ -0,0 +1,117 @@
|
||||
//
|
||||
// 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
|
||||
HeadImages 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
|
||||
|
||||
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")
|
||||
HeadImagesColumn = postgres.StringColumn("head_images")
|
||||
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")
|
||||
allColumns = postgres.ColumnList{IDColumn, CreatedAtColumn, UpdatedAtColumn, DeletedAtColumn, StatusColumn, TitleColumn, HeadImagesColumn, DescriptionColumn, ContentColumn, PriceColumn, DiscountColumn, ViewsColumn, LikesColumn, TagsColumn, AssetsColumn}
|
||||
mutableColumns = postgres.ColumnList{CreatedAtColumn, UpdatedAtColumn, DeletedAtColumn, StatusColumn, TitleColumn, HeadImagesColumn, DescriptionColumn, ContentColumn, PriceColumn, DiscountColumn, ViewsColumn, LikesColumn, TagsColumn, AssetsColumn}
|
||||
)
|
||||
|
||||
return postsTable{
|
||||
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
||||
|
||||
//Columns
|
||||
ID: IDColumn,
|
||||
CreatedAt: CreatedAtColumn,
|
||||
UpdatedAt: UpdatedAtColumn,
|
||||
DeletedAt: DeletedAtColumn,
|
||||
Status: StatusColumn,
|
||||
Title: TitleColumn,
|
||||
HeadImages: HeadImagesColumn,
|
||||
Description: DescriptionColumn,
|
||||
Content: ContentColumn,
|
||||
Price: PriceColumn,
|
||||
Discount: DiscountColumn,
|
||||
Views: ViewsColumn,
|
||||
Likes: LikesColumn,
|
||||
Tags: TagsColumn,
|
||||
Assets: AssetsColumn,
|
||||
|
||||
AllColumns: allColumns,
|
||||
MutableColumns: mutableColumns,
|
||||
}
|
||||
}
|
||||
19
backend/database/table/table_use_schema.go
Normal file
19
backend/database/table/table_use_schema.go
Normal file
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// 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
|
||||
|
||||
// UseSchema sets a new schema name for all generated table SQL builder types. It is recommended to invoke
|
||||
// this method only once at the beginning of the program.
|
||||
func UseSchema(schema string) {
|
||||
Medias = Medias.FromSchema(schema)
|
||||
Migrations = Migrations.FromSchema(schema)
|
||||
Orders = Orders.FromSchema(schema)
|
||||
Posts = Posts.FromSchema(schema)
|
||||
UserPosts = UserPosts.FromSchema(schema)
|
||||
Users = Users.FromSchema(schema)
|
||||
}
|
||||
90
backend/database/table/user_posts.go
Normal file
90
backend/database/table/user_posts.go
Normal file
@@ -0,0 +1,90 @@
|
||||
//
|
||||
// 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 UserPosts = newUserPostsTable("public", "user_posts", "")
|
||||
|
||||
type userPostsTable struct {
|
||||
postgres.Table
|
||||
|
||||
// Columns
|
||||
ID postgres.ColumnInteger
|
||||
CreatedAt postgres.ColumnTimestamp
|
||||
UpdatedAt postgres.ColumnTimestamp
|
||||
UserID postgres.ColumnInteger
|
||||
PostID postgres.ColumnInteger
|
||||
Price postgres.ColumnInteger
|
||||
|
||||
AllColumns postgres.ColumnList
|
||||
MutableColumns postgres.ColumnList
|
||||
}
|
||||
|
||||
type UserPostsTable struct {
|
||||
userPostsTable
|
||||
|
||||
EXCLUDED userPostsTable
|
||||
}
|
||||
|
||||
// AS creates new UserPostsTable with assigned alias
|
||||
func (a UserPostsTable) AS(alias string) *UserPostsTable {
|
||||
return newUserPostsTable(a.SchemaName(), a.TableName(), alias)
|
||||
}
|
||||
|
||||
// Schema creates new UserPostsTable with assigned schema name
|
||||
func (a UserPostsTable) FromSchema(schemaName string) *UserPostsTable {
|
||||
return newUserPostsTable(schemaName, a.TableName(), a.Alias())
|
||||
}
|
||||
|
||||
// WithPrefix creates new UserPostsTable with assigned table prefix
|
||||
func (a UserPostsTable) WithPrefix(prefix string) *UserPostsTable {
|
||||
return newUserPostsTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
|
||||
}
|
||||
|
||||
// WithSuffix creates new UserPostsTable with assigned table suffix
|
||||
func (a UserPostsTable) WithSuffix(suffix string) *UserPostsTable {
|
||||
return newUserPostsTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
|
||||
}
|
||||
|
||||
func newUserPostsTable(schemaName, tableName, alias string) *UserPostsTable {
|
||||
return &UserPostsTable{
|
||||
userPostsTable: newUserPostsTableImpl(schemaName, tableName, alias),
|
||||
EXCLUDED: newUserPostsTableImpl("", "excluded", ""),
|
||||
}
|
||||
}
|
||||
|
||||
func newUserPostsTableImpl(schemaName, tableName, alias string) userPostsTable {
|
||||
var (
|
||||
IDColumn = postgres.IntegerColumn("id")
|
||||
CreatedAtColumn = postgres.TimestampColumn("created_at")
|
||||
UpdatedAtColumn = postgres.TimestampColumn("updated_at")
|
||||
UserIDColumn = postgres.IntegerColumn("user_id")
|
||||
PostIDColumn = postgres.IntegerColumn("post_id")
|
||||
PriceColumn = postgres.IntegerColumn("price")
|
||||
allColumns = postgres.ColumnList{IDColumn, CreatedAtColumn, UpdatedAtColumn, UserIDColumn, PostIDColumn, PriceColumn}
|
||||
mutableColumns = postgres.ColumnList{CreatedAtColumn, UpdatedAtColumn, UserIDColumn, PostIDColumn, PriceColumn}
|
||||
)
|
||||
|
||||
return userPostsTable{
|
||||
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
||||
|
||||
//Columns
|
||||
ID: IDColumn,
|
||||
CreatedAt: CreatedAtColumn,
|
||||
UpdatedAt: UpdatedAtColumn,
|
||||
UserID: UserIDColumn,
|
||||
PostID: PostIDColumn,
|
||||
Price: PriceColumn,
|
||||
|
||||
AllColumns: allColumns,
|
||||
MutableColumns: mutableColumns,
|
||||
}
|
||||
}
|
||||
105
backend/database/table/users.go
Normal file
105
backend/database/table/users.go
Normal file
@@ -0,0 +1,105 @@
|
||||
//
|
||||
// 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 Users = newUsersTable("public", "users", "")
|
||||
|
||||
type usersTable struct {
|
||||
postgres.Table
|
||||
|
||||
// Columns
|
||||
ID postgres.ColumnInteger
|
||||
CreatedAt postgres.ColumnTimestamp
|
||||
UpdatedAt postgres.ColumnTimestamp
|
||||
DeletedAt postgres.ColumnTimestamp
|
||||
Status postgres.ColumnInteger
|
||||
OpenID postgres.ColumnString
|
||||
Username postgres.ColumnString
|
||||
Avatar postgres.ColumnString
|
||||
Metas postgres.ColumnString
|
||||
AuthToken postgres.ColumnString
|
||||
Balance postgres.ColumnInteger
|
||||
|
||||
AllColumns postgres.ColumnList
|
||||
MutableColumns postgres.ColumnList
|
||||
}
|
||||
|
||||
type UsersTable struct {
|
||||
usersTable
|
||||
|
||||
EXCLUDED usersTable
|
||||
}
|
||||
|
||||
// AS creates new UsersTable with assigned alias
|
||||
func (a UsersTable) AS(alias string) *UsersTable {
|
||||
return newUsersTable(a.SchemaName(), a.TableName(), alias)
|
||||
}
|
||||
|
||||
// Schema creates new UsersTable with assigned schema name
|
||||
func (a UsersTable) FromSchema(schemaName string) *UsersTable {
|
||||
return newUsersTable(schemaName, a.TableName(), a.Alias())
|
||||
}
|
||||
|
||||
// WithPrefix creates new UsersTable with assigned table prefix
|
||||
func (a UsersTable) WithPrefix(prefix string) *UsersTable {
|
||||
return newUsersTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
|
||||
}
|
||||
|
||||
// WithSuffix creates new UsersTable with assigned table suffix
|
||||
func (a UsersTable) WithSuffix(suffix string) *UsersTable {
|
||||
return newUsersTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
|
||||
}
|
||||
|
||||
func newUsersTable(schemaName, tableName, alias string) *UsersTable {
|
||||
return &UsersTable{
|
||||
usersTable: newUsersTableImpl(schemaName, tableName, alias),
|
||||
EXCLUDED: newUsersTableImpl("", "excluded", ""),
|
||||
}
|
||||
}
|
||||
|
||||
func newUsersTableImpl(schemaName, tableName, alias string) usersTable {
|
||||
var (
|
||||
IDColumn = postgres.IntegerColumn("id")
|
||||
CreatedAtColumn = postgres.TimestampColumn("created_at")
|
||||
UpdatedAtColumn = postgres.TimestampColumn("updated_at")
|
||||
DeletedAtColumn = postgres.TimestampColumn("deleted_at")
|
||||
StatusColumn = postgres.IntegerColumn("status")
|
||||
OpenIDColumn = postgres.StringColumn("open_id")
|
||||
UsernameColumn = postgres.StringColumn("username")
|
||||
AvatarColumn = postgres.StringColumn("avatar")
|
||||
MetasColumn = postgres.StringColumn("metas")
|
||||
AuthTokenColumn = postgres.StringColumn("auth_token")
|
||||
BalanceColumn = postgres.IntegerColumn("balance")
|
||||
allColumns = postgres.ColumnList{IDColumn, CreatedAtColumn, UpdatedAtColumn, DeletedAtColumn, StatusColumn, OpenIDColumn, UsernameColumn, AvatarColumn, MetasColumn, AuthTokenColumn, BalanceColumn}
|
||||
mutableColumns = postgres.ColumnList{CreatedAtColumn, UpdatedAtColumn, DeletedAtColumn, StatusColumn, OpenIDColumn, UsernameColumn, AvatarColumn, MetasColumn, AuthTokenColumn, BalanceColumn}
|
||||
)
|
||||
|
||||
return usersTable{
|
||||
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
||||
|
||||
//Columns
|
||||
ID: IDColumn,
|
||||
CreatedAt: CreatedAtColumn,
|
||||
UpdatedAt: UpdatedAtColumn,
|
||||
DeletedAt: DeletedAtColumn,
|
||||
Status: StatusColumn,
|
||||
OpenID: OpenIDColumn,
|
||||
Username: UsernameColumn,
|
||||
Avatar: AvatarColumn,
|
||||
Metas: MetasColumn,
|
||||
AuthToken: AuthTokenColumn,
|
||||
Balance: BalanceColumn,
|
||||
|
||||
AllColumns: allColumns,
|
||||
MutableColumns: mutableColumns,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user