feat: add models

This commit is contained in:
Rogee
2024-11-28 16:49:57 +08:00
parent 451192a2ca
commit 77e962b668
23 changed files with 995 additions and 235 deletions

View File

@@ -0,0 +1,23 @@
//
// 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 model
import (
"time"
)
type MediaResources struct {
ID int64 `sql:"primary_key"`
MediaID int64
Type string
Source *string
Size int64
Publish bool
CreatedAt time.Time
UpdatedAt time.Time
}

View File

@@ -0,0 +1,24 @@
//
// 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 model
import (
"time"
)
type Medias struct {
ID int64 `sql:"primary_key"`
TenantID int64
Title string
Description string
Price int64
Discount int64
Publish bool
CreatedAt time.Time
UpdatedAt time.Time
}

View 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 model
import (
"time"
)
type Migrations struct {
ID int32 `sql:"primary_key"`
VersionID int64
IsApplied bool
Tstamp time.Time
}

View File

@@ -0,0 +1,15 @@
//
// 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 model
type TenantUserBalances struct {
ID int64 `sql:"primary_key"`
UserID int64
TenantID int64
Balance int64
}

View File

@@ -0,0 +1,22 @@
//
// 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 model
import (
"time"
)
type Tenants struct {
ID int64 `sql:"primary_key"`
Name string
Slug string
Description *string
ExpireAt time.Time
CreatedAt time.Time
UpdatedAt time.Time
}

View File

@@ -0,0 +1,22 @@
//
// 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 model
import (
"time"
)
type UserBalanceHistories struct {
ID int64 `sql:"primary_key"`
UserID int64
TenantID int64
Balance int64
Target *string
Type string
CreatedAt time.Time
}

View File

@@ -0,0 +1,21 @@
//
// 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 model
import (
"time"
)
type UserMedias struct {
ID int64 `sql:"primary_key"`
UserID int64
TenantID int64
MediaID int64
Price int64
CreatedAt time.Time
}

View File

@@ -0,0 +1,22 @@
//
// 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 model
import (
"time"
)
type Users struct {
ID int64 `sql:"primary_key"`
OpenID string
UnionID *string
OAuth *string
ExpireIn time.Time
CreatedAt time.Time
UpdatedAt time.Time
}

View 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 model
import (
"time"
)
type UsersTenants struct {
ID int64 `sql:"primary_key"`
UserID int64
TenantID int64
CreatedAt time.Time
}

View 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 MediaResources = newMediaResourcesTable("public", "media_resources", "")
type mediaResourcesTable struct {
postgres.Table
// Columns
ID postgres.ColumnInteger
MediaID postgres.ColumnInteger
Type postgres.ColumnString
Source postgres.ColumnString
Size postgres.ColumnInteger
Publish postgres.ColumnBool
CreatedAt postgres.ColumnTimestamp
UpdatedAt postgres.ColumnTimestamp
AllColumns postgres.ColumnList
MutableColumns postgres.ColumnList
}
type MediaResourcesTable struct {
mediaResourcesTable
EXCLUDED mediaResourcesTable
}
// AS creates new MediaResourcesTable with assigned alias
func (a MediaResourcesTable) AS(alias string) *MediaResourcesTable {
return newMediaResourcesTable(a.SchemaName(), a.TableName(), alias)
}
// Schema creates new MediaResourcesTable with assigned schema name
func (a MediaResourcesTable) FromSchema(schemaName string) *MediaResourcesTable {
return newMediaResourcesTable(schemaName, a.TableName(), a.Alias())
}
// WithPrefix creates new MediaResourcesTable with assigned table prefix
func (a MediaResourcesTable) WithPrefix(prefix string) *MediaResourcesTable {
return newMediaResourcesTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
}
// WithSuffix creates new MediaResourcesTable with assigned table suffix
func (a MediaResourcesTable) WithSuffix(suffix string) *MediaResourcesTable {
return newMediaResourcesTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
}
func newMediaResourcesTable(schemaName, tableName, alias string) *MediaResourcesTable {
return &MediaResourcesTable{
mediaResourcesTable: newMediaResourcesTableImpl(schemaName, tableName, alias),
EXCLUDED: newMediaResourcesTableImpl("", "excluded", ""),
}
}
func newMediaResourcesTableImpl(schemaName, tableName, alias string) mediaResourcesTable {
var (
IDColumn = postgres.IntegerColumn("id")
MediaIDColumn = postgres.IntegerColumn("media_id")
TypeColumn = postgres.StringColumn("type")
SourceColumn = postgres.StringColumn("source")
SizeColumn = postgres.IntegerColumn("size")
PublishColumn = postgres.BoolColumn("publish")
CreatedAtColumn = postgres.TimestampColumn("created_at")
UpdatedAtColumn = postgres.TimestampColumn("updated_at")
allColumns = postgres.ColumnList{IDColumn, MediaIDColumn, TypeColumn, SourceColumn, SizeColumn, PublishColumn, CreatedAtColumn, UpdatedAtColumn}
mutableColumns = postgres.ColumnList{MediaIDColumn, TypeColumn, SourceColumn, SizeColumn, PublishColumn, CreatedAtColumn, UpdatedAtColumn}
)
return mediaResourcesTable{
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
//Columns
ID: IDColumn,
MediaID: MediaIDColumn,
Type: TypeColumn,
Source: SourceColumn,
Size: SizeColumn,
Publish: PublishColumn,
CreatedAt: CreatedAtColumn,
UpdatedAt: UpdatedAtColumn,
AllColumns: allColumns,
MutableColumns: mutableColumns,
}
}

View File

@@ -0,0 +1,99 @@
//
// 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
TenantID postgres.ColumnInteger
Title postgres.ColumnString
Description postgres.ColumnString
Price postgres.ColumnInteger
Discount postgres.ColumnInteger
Publish postgres.ColumnBool
CreatedAt postgres.ColumnTimestamp
UpdatedAt postgres.ColumnTimestamp
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")
TenantIDColumn = postgres.IntegerColumn("tenant_id")
TitleColumn = postgres.StringColumn("title")
DescriptionColumn = postgres.StringColumn("description")
PriceColumn = postgres.IntegerColumn("price")
DiscountColumn = postgres.IntegerColumn("discount")
PublishColumn = postgres.BoolColumn("publish")
CreatedAtColumn = postgres.TimestampColumn("created_at")
UpdatedAtColumn = postgres.TimestampColumn("updated_at")
allColumns = postgres.ColumnList{IDColumn, TenantIDColumn, TitleColumn, DescriptionColumn, PriceColumn, DiscountColumn, PublishColumn, CreatedAtColumn, UpdatedAtColumn}
mutableColumns = postgres.ColumnList{TenantIDColumn, TitleColumn, DescriptionColumn, PriceColumn, DiscountColumn, PublishColumn, CreatedAtColumn, UpdatedAtColumn}
)
return mediasTable{
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
//Columns
ID: IDColumn,
TenantID: TenantIDColumn,
Title: TitleColumn,
Description: DescriptionColumn,
Price: PriceColumn,
Discount: DiscountColumn,
Publish: PublishColumn,
CreatedAt: CreatedAtColumn,
UpdatedAt: UpdatedAtColumn,
AllColumns: allColumns,
MutableColumns: mutableColumns,
}
}

View 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,
}
}

View File

@@ -0,0 +1,22 @@
//
// 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) {
MediaResources = MediaResources.FromSchema(schema)
Medias = Medias.FromSchema(schema)
Migrations = Migrations.FromSchema(schema)
TenantUserBalances = TenantUserBalances.FromSchema(schema)
Tenants = Tenants.FromSchema(schema)
UserBalanceHistories = UserBalanceHistories.FromSchema(schema)
UserMedias = UserMedias.FromSchema(schema)
Users = Users.FromSchema(schema)
UsersTenants = UsersTenants.FromSchema(schema)
}

View 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 TenantUserBalances = newTenantUserBalancesTable("public", "tenant_user_balances", "")
type tenantUserBalancesTable struct {
postgres.Table
// Columns
ID postgres.ColumnInteger
UserID postgres.ColumnInteger
TenantID postgres.ColumnInteger
Balance postgres.ColumnInteger
AllColumns postgres.ColumnList
MutableColumns postgres.ColumnList
}
type TenantUserBalancesTable struct {
tenantUserBalancesTable
EXCLUDED tenantUserBalancesTable
}
// AS creates new TenantUserBalancesTable with assigned alias
func (a TenantUserBalancesTable) AS(alias string) *TenantUserBalancesTable {
return newTenantUserBalancesTable(a.SchemaName(), a.TableName(), alias)
}
// Schema creates new TenantUserBalancesTable with assigned schema name
func (a TenantUserBalancesTable) FromSchema(schemaName string) *TenantUserBalancesTable {
return newTenantUserBalancesTable(schemaName, a.TableName(), a.Alias())
}
// WithPrefix creates new TenantUserBalancesTable with assigned table prefix
func (a TenantUserBalancesTable) WithPrefix(prefix string) *TenantUserBalancesTable {
return newTenantUserBalancesTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
}
// WithSuffix creates new TenantUserBalancesTable with assigned table suffix
func (a TenantUserBalancesTable) WithSuffix(suffix string) *TenantUserBalancesTable {
return newTenantUserBalancesTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
}
func newTenantUserBalancesTable(schemaName, tableName, alias string) *TenantUserBalancesTable {
return &TenantUserBalancesTable{
tenantUserBalancesTable: newTenantUserBalancesTableImpl(schemaName, tableName, alias),
EXCLUDED: newTenantUserBalancesTableImpl("", "excluded", ""),
}
}
func newTenantUserBalancesTableImpl(schemaName, tableName, alias string) tenantUserBalancesTable {
var (
IDColumn = postgres.IntegerColumn("id")
UserIDColumn = postgres.IntegerColumn("user_id")
TenantIDColumn = postgres.IntegerColumn("tenant_id")
BalanceColumn = postgres.IntegerColumn("balance")
allColumns = postgres.ColumnList{IDColumn, UserIDColumn, TenantIDColumn, BalanceColumn}
mutableColumns = postgres.ColumnList{UserIDColumn, TenantIDColumn, BalanceColumn}
)
return tenantUserBalancesTable{
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
//Columns
ID: IDColumn,
UserID: UserIDColumn,
TenantID: TenantIDColumn,
Balance: BalanceColumn,
AllColumns: allColumns,
MutableColumns: mutableColumns,
}
}

View File

@@ -0,0 +1,93 @@
//
// 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 Tenants = newTenantsTable("public", "tenants", "")
type tenantsTable struct {
postgres.Table
// Columns
ID postgres.ColumnInteger
Name postgres.ColumnString
Slug postgres.ColumnString
Description postgres.ColumnString
ExpireAt postgres.ColumnTimestamp
CreatedAt postgres.ColumnTimestamp
UpdatedAt postgres.ColumnTimestamp
AllColumns postgres.ColumnList
MutableColumns postgres.ColumnList
}
type TenantsTable struct {
tenantsTable
EXCLUDED tenantsTable
}
// AS creates new TenantsTable with assigned alias
func (a TenantsTable) AS(alias string) *TenantsTable {
return newTenantsTable(a.SchemaName(), a.TableName(), alias)
}
// Schema creates new TenantsTable with assigned schema name
func (a TenantsTable) FromSchema(schemaName string) *TenantsTable {
return newTenantsTable(schemaName, a.TableName(), a.Alias())
}
// WithPrefix creates new TenantsTable with assigned table prefix
func (a TenantsTable) WithPrefix(prefix string) *TenantsTable {
return newTenantsTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
}
// WithSuffix creates new TenantsTable with assigned table suffix
func (a TenantsTable) WithSuffix(suffix string) *TenantsTable {
return newTenantsTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
}
func newTenantsTable(schemaName, tableName, alias string) *TenantsTable {
return &TenantsTable{
tenantsTable: newTenantsTableImpl(schemaName, tableName, alias),
EXCLUDED: newTenantsTableImpl("", "excluded", ""),
}
}
func newTenantsTableImpl(schemaName, tableName, alias string) tenantsTable {
var (
IDColumn = postgres.IntegerColumn("id")
NameColumn = postgres.StringColumn("name")
SlugColumn = postgres.StringColumn("slug")
DescriptionColumn = postgres.StringColumn("description")
ExpireAtColumn = postgres.TimestampColumn("expire_at")
CreatedAtColumn = postgres.TimestampColumn("created_at")
UpdatedAtColumn = postgres.TimestampColumn("updated_at")
allColumns = postgres.ColumnList{IDColumn, NameColumn, SlugColumn, DescriptionColumn, ExpireAtColumn, CreatedAtColumn, UpdatedAtColumn}
mutableColumns = postgres.ColumnList{NameColumn, SlugColumn, DescriptionColumn, ExpireAtColumn, CreatedAtColumn, UpdatedAtColumn}
)
return tenantsTable{
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
//Columns
ID: IDColumn,
Name: NameColumn,
Slug: SlugColumn,
Description: DescriptionColumn,
ExpireAt: ExpireAtColumn,
CreatedAt: CreatedAtColumn,
UpdatedAt: UpdatedAtColumn,
AllColumns: allColumns,
MutableColumns: mutableColumns,
}
}

View File

@@ -0,0 +1,93 @@
//
// 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 UserBalanceHistories = newUserBalanceHistoriesTable("public", "user_balance_histories", "")
type userBalanceHistoriesTable struct {
postgres.Table
// Columns
ID postgres.ColumnInteger
UserID postgres.ColumnInteger
TenantID postgres.ColumnInteger
Balance postgres.ColumnInteger
Target postgres.ColumnString
Type postgres.ColumnString
CreatedAt postgres.ColumnTimestamp
AllColumns postgres.ColumnList
MutableColumns postgres.ColumnList
}
type UserBalanceHistoriesTable struct {
userBalanceHistoriesTable
EXCLUDED userBalanceHistoriesTable
}
// AS creates new UserBalanceHistoriesTable with assigned alias
func (a UserBalanceHistoriesTable) AS(alias string) *UserBalanceHistoriesTable {
return newUserBalanceHistoriesTable(a.SchemaName(), a.TableName(), alias)
}
// Schema creates new UserBalanceHistoriesTable with assigned schema name
func (a UserBalanceHistoriesTable) FromSchema(schemaName string) *UserBalanceHistoriesTable {
return newUserBalanceHistoriesTable(schemaName, a.TableName(), a.Alias())
}
// WithPrefix creates new UserBalanceHistoriesTable with assigned table prefix
func (a UserBalanceHistoriesTable) WithPrefix(prefix string) *UserBalanceHistoriesTable {
return newUserBalanceHistoriesTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
}
// WithSuffix creates new UserBalanceHistoriesTable with assigned table suffix
func (a UserBalanceHistoriesTable) WithSuffix(suffix string) *UserBalanceHistoriesTable {
return newUserBalanceHistoriesTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
}
func newUserBalanceHistoriesTable(schemaName, tableName, alias string) *UserBalanceHistoriesTable {
return &UserBalanceHistoriesTable{
userBalanceHistoriesTable: newUserBalanceHistoriesTableImpl(schemaName, tableName, alias),
EXCLUDED: newUserBalanceHistoriesTableImpl("", "excluded", ""),
}
}
func newUserBalanceHistoriesTableImpl(schemaName, tableName, alias string) userBalanceHistoriesTable {
var (
IDColumn = postgres.IntegerColumn("id")
UserIDColumn = postgres.IntegerColumn("user_id")
TenantIDColumn = postgres.IntegerColumn("tenant_id")
BalanceColumn = postgres.IntegerColumn("balance")
TargetColumn = postgres.StringColumn("target")
TypeColumn = postgres.StringColumn("type")
CreatedAtColumn = postgres.TimestampColumn("created_at")
allColumns = postgres.ColumnList{IDColumn, UserIDColumn, TenantIDColumn, BalanceColumn, TargetColumn, TypeColumn, CreatedAtColumn}
mutableColumns = postgres.ColumnList{UserIDColumn, TenantIDColumn, BalanceColumn, TargetColumn, TypeColumn, CreatedAtColumn}
)
return userBalanceHistoriesTable{
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
//Columns
ID: IDColumn,
UserID: UserIDColumn,
TenantID: TenantIDColumn,
Balance: BalanceColumn,
Target: TargetColumn,
Type: TypeColumn,
CreatedAt: CreatedAtColumn,
AllColumns: allColumns,
MutableColumns: mutableColumns,
}
}

View 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 UserMedias = newUserMediasTable("public", "user_medias", "")
type userMediasTable struct {
postgres.Table
// Columns
ID postgres.ColumnInteger
UserID postgres.ColumnInteger
TenantID postgres.ColumnInteger
MediaID postgres.ColumnInteger
Price postgres.ColumnInteger
CreatedAt postgres.ColumnTimestamp
AllColumns postgres.ColumnList
MutableColumns postgres.ColumnList
}
type UserMediasTable struct {
userMediasTable
EXCLUDED userMediasTable
}
// AS creates new UserMediasTable with assigned alias
func (a UserMediasTable) AS(alias string) *UserMediasTable {
return newUserMediasTable(a.SchemaName(), a.TableName(), alias)
}
// Schema creates new UserMediasTable with assigned schema name
func (a UserMediasTable) FromSchema(schemaName string) *UserMediasTable {
return newUserMediasTable(schemaName, a.TableName(), a.Alias())
}
// WithPrefix creates new UserMediasTable with assigned table prefix
func (a UserMediasTable) WithPrefix(prefix string) *UserMediasTable {
return newUserMediasTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
}
// WithSuffix creates new UserMediasTable with assigned table suffix
func (a UserMediasTable) WithSuffix(suffix string) *UserMediasTable {
return newUserMediasTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
}
func newUserMediasTable(schemaName, tableName, alias string) *UserMediasTable {
return &UserMediasTable{
userMediasTable: newUserMediasTableImpl(schemaName, tableName, alias),
EXCLUDED: newUserMediasTableImpl("", "excluded", ""),
}
}
func newUserMediasTableImpl(schemaName, tableName, alias string) userMediasTable {
var (
IDColumn = postgres.IntegerColumn("id")
UserIDColumn = postgres.IntegerColumn("user_id")
TenantIDColumn = postgres.IntegerColumn("tenant_id")
MediaIDColumn = postgres.IntegerColumn("media_id")
PriceColumn = postgres.IntegerColumn("price")
CreatedAtColumn = postgres.TimestampColumn("created_at")
allColumns = postgres.ColumnList{IDColumn, UserIDColumn, TenantIDColumn, MediaIDColumn, PriceColumn, CreatedAtColumn}
mutableColumns = postgres.ColumnList{UserIDColumn, TenantIDColumn, MediaIDColumn, PriceColumn, CreatedAtColumn}
)
return userMediasTable{
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
//Columns
ID: IDColumn,
UserID: UserIDColumn,
TenantID: TenantIDColumn,
MediaID: MediaIDColumn,
Price: PriceColumn,
CreatedAt: CreatedAtColumn,
AllColumns: allColumns,
MutableColumns: mutableColumns,
}
}

View File

@@ -0,0 +1,93 @@
//
// 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
OpenID postgres.ColumnString
UnionID postgres.ColumnString
OAuth postgres.ColumnString
ExpireIn postgres.ColumnTimestamp
CreatedAt postgres.ColumnTimestamp
UpdatedAt postgres.ColumnTimestamp
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")
OpenIDColumn = postgres.StringColumn("open_id")
UnionIDColumn = postgres.StringColumn("union_id")
OAuthColumn = postgres.StringColumn("oauth")
ExpireInColumn = postgres.TimestampColumn("expire_in")
CreatedAtColumn = postgres.TimestampColumn("created_at")
UpdatedAtColumn = postgres.TimestampColumn("updated_at")
allColumns = postgres.ColumnList{IDColumn, OpenIDColumn, UnionIDColumn, OAuthColumn, ExpireInColumn, CreatedAtColumn, UpdatedAtColumn}
mutableColumns = postgres.ColumnList{OpenIDColumn, UnionIDColumn, OAuthColumn, ExpireInColumn, CreatedAtColumn, UpdatedAtColumn}
)
return usersTable{
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
//Columns
ID: IDColumn,
OpenID: OpenIDColumn,
UnionID: UnionIDColumn,
OAuth: OAuthColumn,
ExpireIn: ExpireInColumn,
CreatedAt: CreatedAtColumn,
UpdatedAt: UpdatedAtColumn,
AllColumns: allColumns,
MutableColumns: mutableColumns,
}
}

View 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 UsersTenants = newUsersTenantsTable("public", "users_tenants", "")
type usersTenantsTable struct {
postgres.Table
// Columns
ID postgres.ColumnInteger
UserID postgres.ColumnInteger
TenantID postgres.ColumnInteger
CreatedAt postgres.ColumnTimestamp
AllColumns postgres.ColumnList
MutableColumns postgres.ColumnList
}
type UsersTenantsTable struct {
usersTenantsTable
EXCLUDED usersTenantsTable
}
// AS creates new UsersTenantsTable with assigned alias
func (a UsersTenantsTable) AS(alias string) *UsersTenantsTable {
return newUsersTenantsTable(a.SchemaName(), a.TableName(), alias)
}
// Schema creates new UsersTenantsTable with assigned schema name
func (a UsersTenantsTable) FromSchema(schemaName string) *UsersTenantsTable {
return newUsersTenantsTable(schemaName, a.TableName(), a.Alias())
}
// WithPrefix creates new UsersTenantsTable with assigned table prefix
func (a UsersTenantsTable) WithPrefix(prefix string) *UsersTenantsTable {
return newUsersTenantsTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
}
// WithSuffix creates new UsersTenantsTable with assigned table suffix
func (a UsersTenantsTable) WithSuffix(suffix string) *UsersTenantsTable {
return newUsersTenantsTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
}
func newUsersTenantsTable(schemaName, tableName, alias string) *UsersTenantsTable {
return &UsersTenantsTable{
usersTenantsTable: newUsersTenantsTableImpl(schemaName, tableName, alias),
EXCLUDED: newUsersTenantsTableImpl("", "excluded", ""),
}
}
func newUsersTenantsTableImpl(schemaName, tableName, alias string) usersTenantsTable {
var (
IDColumn = postgres.IntegerColumn("id")
UserIDColumn = postgres.IntegerColumn("user_id")
TenantIDColumn = postgres.IntegerColumn("tenant_id")
CreatedAtColumn = postgres.TimestampColumn("created_at")
allColumns = postgres.ColumnList{IDColumn, UserIDColumn, TenantIDColumn, CreatedAtColumn}
mutableColumns = postgres.ColumnList{UserIDColumn, TenantIDColumn, CreatedAtColumn}
)
return usersTenantsTable{
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
//Columns
ID: IDColumn,
UserID: UserIDColumn,
TenantID: TenantIDColumn,
CreatedAt: CreatedAtColumn,
AllColumns: allColumns,
MutableColumns: mutableColumns,
}
}