feat: update medias
This commit is contained in:
39
test/config.toml
Normal file
39
test/config.toml
Normal file
@@ -0,0 +1,39 @@
|
||||
[App]
|
||||
Mode = "development"
|
||||
BaseURI = "https://qvyun.mp.jdwan.com"
|
||||
|
||||
[Http]
|
||||
Port = 9600
|
||||
|
||||
[Database]
|
||||
Host = "10.1.1.3"
|
||||
Database = "qvyun_v2"
|
||||
Password = "xixi0202"
|
||||
|
||||
[Wechat]
|
||||
AppId = "wx45745a8c51091ae0"
|
||||
AppSecret = "2ab33bc79d9b47efa4abef19d66e1977"
|
||||
Token = "W8Xhw5TivYBgY"
|
||||
AesKey = "F6AqCxAV4W1eCrY6llJ2zapphKK49CQN3RgtPDrjhnI"
|
||||
DevMode = true
|
||||
|
||||
[JWT]
|
||||
ExpiresTime = "168h"
|
||||
SigningKey = "LiXi.Y@140202"
|
||||
|
||||
[HashIDs]
|
||||
Salt = "LiXi.Y@140202"
|
||||
|
||||
[Storage]
|
||||
Type = "local"
|
||||
Path = "/mnt/yangpingliang/processed"
|
||||
Asset = "/projects/qvyun/frontend/dist"
|
||||
|
||||
|
||||
[Pay]
|
||||
WechatAppId = "wx45745a8c51091ae0"
|
||||
WechatMechID = ""
|
||||
WechatSubMechID = ""
|
||||
WechatSerialNo = ""
|
||||
WechatApiV3Key = ""
|
||||
WechatPrivateKey = ""
|
||||
40
test/database/database.go
Normal file
40
test/database/database.go
Normal file
@@ -0,0 +1,40 @@
|
||||
package database
|
||||
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
"fmt"
|
||||
|
||||
"github.com/go-jet/jet/v2/qrm"
|
||||
)
|
||||
|
||||
type CtxDB struct{}
|
||||
|
||||
func FromContext(ctx context.Context, db *sql.DB) qrm.DB {
|
||||
if tx, ok := ctx.Value(CtxDB{}).(*sql.Tx); ok {
|
||||
return tx
|
||||
}
|
||||
return db
|
||||
}
|
||||
|
||||
func Truncate(ctx context.Context, db *sql.DB, tableName ...string) error {
|
||||
for _, name := range tableName {
|
||||
sql := fmt.Sprintf("TRUNCATE TABLE %s RESTART IDENTITY", name)
|
||||
if _, err := db.ExecContext(ctx, sql); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func WrapLike(v string) string {
|
||||
return "%" + v + "%"
|
||||
}
|
||||
|
||||
func WrapLikeLeft(v string) string {
|
||||
return "%" + v
|
||||
}
|
||||
|
||||
func WrapLikeRight(v string) string {
|
||||
return "%" + v
|
||||
}
|
||||
23
test/database/models/qvyun_v2/public/model/medias.go
Normal file
23
test/database/models/qvyun_v2/public/model/medias.go
Normal 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 Medias struct {
|
||||
ID int64 `sql:"primary_key" json:"id"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
StorageID int64 `json:"storage_id"`
|
||||
Hash string `json:"hash"`
|
||||
Name string `json:"name"`
|
||||
MimeType string `json:"mime_type"`
|
||||
Size int64 `json:"size"`
|
||||
Path string `json:"path"`
|
||||
}
|
||||
32
test/database/models/qvyun_v2/public/model/orders.go
Normal file
32
test/database/models/qvyun_v2/public/model/orders.go
Normal file
@@ -0,0 +1,32 @@
|
||||
//
|
||||
// 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 Orders struct {
|
||||
ID int64 `sql:"primary_key" json:"id"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
DeletedAt *time.Time `json:"deleted_at"`
|
||||
TenantID int64 `json:"tenant_id"`
|
||||
UserID int64 `json:"user_id"`
|
||||
Type int16 `json:"type"`
|
||||
Status int16 `json:"status"`
|
||||
OrderSerial string `json:"order_serial"`
|
||||
RemoteOrderSerial string `json:"remote_order_serial"`
|
||||
RefundSerial string `json:"refund_serial"`
|
||||
RemoteRefundSerial string `json:"remote_refund_serial"`
|
||||
Amount int64 `json:"amount"`
|
||||
Currency string `json:"currency"`
|
||||
Title string `json:"title"`
|
||||
Description *string `json:"description"`
|
||||
Meta *string `json:"meta"`
|
||||
}
|
||||
34
test/database/models/qvyun_v2/public/model/posts.go
Normal file
34
test/database/models/qvyun_v2/public/model/posts.go
Normal file
@@ -0,0 +1,34 @@
|
||||
//
|
||||
// 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 Posts struct {
|
||||
ID int64 `sql:"primary_key" json:"id"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
DeletedAt *time.Time `json:"deleted_at"`
|
||||
Type int16 `json:"type"`
|
||||
Stage int16 `json:"stage"`
|
||||
Status int16 `json:"status"`
|
||||
TenantID int64 `json:"tenant_id"`
|
||||
UserID int64 `json:"user_id"`
|
||||
Title string `json:"title"`
|
||||
Description string `json:"description"`
|
||||
Content string `json:"content"`
|
||||
Price int64 `json:"price"`
|
||||
Discount int16 `json:"discount"`
|
||||
Views int64 `json:"views"`
|
||||
Likes int64 `json:"likes"`
|
||||
Meta *string `json:"meta"`
|
||||
Tags *string `json:"tags"`
|
||||
Assets *string `json:"assets"`
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
//
|
||||
// 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 "errors"
|
||||
|
||||
type RiverJobState string
|
||||
|
||||
const (
|
||||
RiverJobState_Available RiverJobState = "available"
|
||||
RiverJobState_Cancelled RiverJobState = "cancelled"
|
||||
RiverJobState_Completed RiverJobState = "completed"
|
||||
RiverJobState_Discarded RiverJobState = "discarded"
|
||||
RiverJobState_Pending RiverJobState = "pending"
|
||||
RiverJobState_Retryable RiverJobState = "retryable"
|
||||
RiverJobState_Running RiverJobState = "running"
|
||||
RiverJobState_Scheduled RiverJobState = "scheduled"
|
||||
)
|
||||
|
||||
var RiverJobStateAllValues = []RiverJobState{
|
||||
RiverJobState_Available,
|
||||
RiverJobState_Cancelled,
|
||||
RiverJobState_Completed,
|
||||
RiverJobState_Discarded,
|
||||
RiverJobState_Pending,
|
||||
RiverJobState_Retryable,
|
||||
RiverJobState_Running,
|
||||
RiverJobState_Scheduled,
|
||||
}
|
||||
|
||||
func (e *RiverJobState) Scan(value interface{}) error {
|
||||
var enumValue string
|
||||
switch val := value.(type) {
|
||||
case string:
|
||||
enumValue = val
|
||||
case []byte:
|
||||
enumValue = string(val)
|
||||
default:
|
||||
return errors.New("jet: Invalid scan value for AllTypesEnum enum. Enum value has to be of type string or []byte")
|
||||
}
|
||||
|
||||
switch enumValue {
|
||||
case "available":
|
||||
*e = RiverJobState_Available
|
||||
case "cancelled":
|
||||
*e = RiverJobState_Cancelled
|
||||
case "completed":
|
||||
*e = RiverJobState_Completed
|
||||
case "discarded":
|
||||
*e = RiverJobState_Discarded
|
||||
case "pending":
|
||||
*e = RiverJobState_Pending
|
||||
case "retryable":
|
||||
*e = RiverJobState_Retryable
|
||||
case "running":
|
||||
*e = RiverJobState_Running
|
||||
case "scheduled":
|
||||
*e = RiverJobState_Scheduled
|
||||
default:
|
||||
return errors.New("jet: Invalid scan value '" + enumValue + "' for RiverJobState enum")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (e RiverJobState) String() string {
|
||||
return string(e)
|
||||
}
|
||||
22
test/database/models/qvyun_v2/public/model/storages.go
Normal file
22
test/database/models/qvyun_v2/public/model/storages.go
Normal 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 Storages struct {
|
||||
ID int64 `sql:"primary_key" json:"id"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
IsDefault bool `json:"is_default"`
|
||||
Name string `json:"name"`
|
||||
Type int16 `json:"type"`
|
||||
Config string `json:"config"`
|
||||
}
|
||||
@@ -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 TenantUserBalances struct {
|
||||
ID int64 `sql:"primary_key" json:"id"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
TenantID int64 `json:"tenant_id"`
|
||||
UserID int64 `json:"user_id"`
|
||||
Balance int64 `json:"balance"`
|
||||
}
|
||||
23
test/database/models/qvyun_v2/public/model/tenant_users.go
Normal file
23
test/database/models/qvyun_v2/public/model/tenant_users.go
Normal 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 TenantUsers struct {
|
||||
ID int64 `sql:"primary_key" json:"id"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
DeletedAt *time.Time `json:"deleted_at"`
|
||||
TenantID int64 `json:"tenant_id"`
|
||||
UserID int64 `json:"user_id"`
|
||||
Status int16 `json:"status"`
|
||||
Role int16 `json:"role"`
|
||||
}
|
||||
23
test/database/models/qvyun_v2/public/model/tenants.go
Normal file
23
test/database/models/qvyun_v2/public/model/tenants.go
Normal 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 Tenants struct {
|
||||
ID int64 `sql:"primary_key" json:"id"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
ExpiredAt time.Time `json:"expired_at"`
|
||||
CreatedByUserID int64 `json:"created_by_user_id"`
|
||||
Name string `json:"name"`
|
||||
Slug string `json:"slug"`
|
||||
Description *string `json:"description"`
|
||||
}
|
||||
@@ -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 UserBoughtPosts struct {
|
||||
ID int64 `sql:"primary_key" json:"id"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
TenantID int64 `json:"tenant_id"`
|
||||
UserID int64 `json:"user_id"`
|
||||
PostID int64 `json:"post_id"`
|
||||
Price int64 `json:"price"`
|
||||
Discount int16 `json:"discount"`
|
||||
Meta *string `json:"meta"`
|
||||
}
|
||||
21
test/database/models/qvyun_v2/public/model/user_medias.go
Normal file
21
test/database/models/qvyun_v2/public/model/user_medias.go
Normal 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" json:"id"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
TenantID int64 `json:"tenant_id"`
|
||||
UserID int64 `json:"user_id"`
|
||||
MediaID int64 `json:"media_id"`
|
||||
}
|
||||
27
test/database/models/qvyun_v2/public/model/user_oauths.go
Normal file
27
test/database/models/qvyun_v2/public/model/user_oauths.go
Normal file
@@ -0,0 +1,27 @@
|
||||
//
|
||||
// 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 UserOauths struct {
|
||||
ID int64 `sql:"primary_key" json:"id"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
DeletedAt *time.Time `json:"deleted_at"`
|
||||
Channel int16 `json:"channel"`
|
||||
UserID int64 `json:"user_id"`
|
||||
UnionID *string `json:"union_id"`
|
||||
OpenID string `json:"open_id"`
|
||||
AccessToken string `json:"access_token"`
|
||||
RefreshToken string `json:"refresh_token"`
|
||||
ExpireAt time.Time `json:"expire_at"`
|
||||
Meta *string `json:"meta"`
|
||||
}
|
||||
28
test/database/models/qvyun_v2/public/model/users.go
Normal file
28
test/database/models/qvyun_v2/public/model/users.go
Normal file
@@ -0,0 +1,28 @@
|
||||
//
|
||||
// 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" json:"id"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
DeletedAt *time.Time `json:"deleted_at"`
|
||||
Status int16 `json:"status"`
|
||||
Email string `json:"email"`
|
||||
Phone string `json:"phone"`
|
||||
Username string `json:"username"`
|
||||
Nickname *string `json:"nickname"`
|
||||
Password string `json:"password"`
|
||||
Age int16 `json:"age"`
|
||||
Sex int16 `json:"sex"`
|
||||
Avatar *string `json:"avatar"`
|
||||
}
|
||||
96
test/database/models/qvyun_v2/public/table/medias.go
Normal file
96
test/database/models/qvyun_v2/public/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
|
||||
StorageID postgres.ColumnInteger
|
||||
Hash postgres.ColumnString
|
||||
Name postgres.ColumnString
|
||||
MimeType postgres.ColumnString
|
||||
Size postgres.ColumnInteger
|
||||
Path 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")
|
||||
StorageIDColumn = postgres.IntegerColumn("storage_id")
|
||||
HashColumn = postgres.StringColumn("hash")
|
||||
NameColumn = postgres.StringColumn("name")
|
||||
MimeTypeColumn = postgres.StringColumn("mime_type")
|
||||
SizeColumn = postgres.IntegerColumn("size")
|
||||
PathColumn = postgres.StringColumn("path")
|
||||
allColumns = postgres.ColumnList{IDColumn, CreatedAtColumn, StorageIDColumn, HashColumn, NameColumn, MimeTypeColumn, SizeColumn, PathColumn}
|
||||
mutableColumns = postgres.ColumnList{CreatedAtColumn, StorageIDColumn, HashColumn, NameColumn, MimeTypeColumn, SizeColumn, PathColumn}
|
||||
)
|
||||
|
||||
return mediasTable{
|
||||
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
||||
|
||||
//Columns
|
||||
ID: IDColumn,
|
||||
CreatedAt: CreatedAtColumn,
|
||||
StorageID: StorageIDColumn,
|
||||
Hash: HashColumn,
|
||||
Name: NameColumn,
|
||||
MimeType: MimeTypeColumn,
|
||||
Size: SizeColumn,
|
||||
Path: PathColumn,
|
||||
|
||||
AllColumns: allColumns,
|
||||
MutableColumns: mutableColumns,
|
||||
}
|
||||
}
|
||||
123
test/database/models/qvyun_v2/public/table/orders.go
Normal file
123
test/database/models/qvyun_v2/public/table/orders.go
Normal file
@@ -0,0 +1,123 @@
|
||||
//
|
||||
// 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
|
||||
DeletedAt postgres.ColumnTimestamp
|
||||
TenantID postgres.ColumnInteger
|
||||
UserID postgres.ColumnInteger
|
||||
Type postgres.ColumnInteger
|
||||
Status postgres.ColumnInteger
|
||||
OrderSerial postgres.ColumnString
|
||||
RemoteOrderSerial postgres.ColumnString
|
||||
RefundSerial postgres.ColumnString
|
||||
RemoteRefundSerial postgres.ColumnString
|
||||
Amount postgres.ColumnInteger
|
||||
Currency postgres.ColumnString
|
||||
Title postgres.ColumnString
|
||||
Description postgres.ColumnString
|
||||
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")
|
||||
DeletedAtColumn = postgres.TimestampColumn("deleted_at")
|
||||
TenantIDColumn = postgres.IntegerColumn("tenant_id")
|
||||
UserIDColumn = postgres.IntegerColumn("user_id")
|
||||
TypeColumn = postgres.IntegerColumn("type")
|
||||
StatusColumn = postgres.IntegerColumn("status")
|
||||
OrderSerialColumn = postgres.StringColumn("order_serial")
|
||||
RemoteOrderSerialColumn = postgres.StringColumn("remote_order_serial")
|
||||
RefundSerialColumn = postgres.StringColumn("refund_serial")
|
||||
RemoteRefundSerialColumn = postgres.StringColumn("remote_refund_serial")
|
||||
AmountColumn = postgres.IntegerColumn("amount")
|
||||
CurrencyColumn = postgres.StringColumn("currency")
|
||||
TitleColumn = postgres.StringColumn("title")
|
||||
DescriptionColumn = postgres.StringColumn("description")
|
||||
MetaColumn = postgres.StringColumn("meta")
|
||||
allColumns = postgres.ColumnList{IDColumn, CreatedAtColumn, UpdatedAtColumn, DeletedAtColumn, TenantIDColumn, UserIDColumn, TypeColumn, StatusColumn, OrderSerialColumn, RemoteOrderSerialColumn, RefundSerialColumn, RemoteRefundSerialColumn, AmountColumn, CurrencyColumn, TitleColumn, DescriptionColumn, MetaColumn}
|
||||
mutableColumns = postgres.ColumnList{CreatedAtColumn, UpdatedAtColumn, DeletedAtColumn, TenantIDColumn, UserIDColumn, TypeColumn, StatusColumn, OrderSerialColumn, RemoteOrderSerialColumn, RefundSerialColumn, RemoteRefundSerialColumn, AmountColumn, CurrencyColumn, TitleColumn, DescriptionColumn, MetaColumn}
|
||||
)
|
||||
|
||||
return ordersTable{
|
||||
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
||||
|
||||
//Columns
|
||||
ID: IDColumn,
|
||||
CreatedAt: CreatedAtColumn,
|
||||
UpdatedAt: UpdatedAtColumn,
|
||||
DeletedAt: DeletedAtColumn,
|
||||
TenantID: TenantIDColumn,
|
||||
UserID: UserIDColumn,
|
||||
Type: TypeColumn,
|
||||
Status: StatusColumn,
|
||||
OrderSerial: OrderSerialColumn,
|
||||
RemoteOrderSerial: RemoteOrderSerialColumn,
|
||||
RefundSerial: RefundSerialColumn,
|
||||
RemoteRefundSerial: RemoteRefundSerialColumn,
|
||||
Amount: AmountColumn,
|
||||
Currency: CurrencyColumn,
|
||||
Title: TitleColumn,
|
||||
Description: DescriptionColumn,
|
||||
Meta: MetaColumn,
|
||||
|
||||
AllColumns: allColumns,
|
||||
MutableColumns: mutableColumns,
|
||||
}
|
||||
}
|
||||
129
test/database/models/qvyun_v2/public/table/posts.go
Normal file
129
test/database/models/qvyun_v2/public/table/posts.go
Normal file
@@ -0,0 +1,129 @@
|
||||
//
|
||||
// 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
|
||||
Type postgres.ColumnInteger
|
||||
Stage postgres.ColumnInteger
|
||||
Status postgres.ColumnInteger
|
||||
TenantID postgres.ColumnInteger
|
||||
UserID postgres.ColumnInteger
|
||||
Title postgres.ColumnString
|
||||
Description postgres.ColumnString
|
||||
Content postgres.ColumnString
|
||||
Price postgres.ColumnInteger
|
||||
Discount postgres.ColumnInteger
|
||||
Views postgres.ColumnInteger
|
||||
Likes postgres.ColumnInteger
|
||||
Meta postgres.ColumnString
|
||||
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")
|
||||
TypeColumn = postgres.IntegerColumn("type")
|
||||
StageColumn = postgres.IntegerColumn("stage")
|
||||
StatusColumn = postgres.IntegerColumn("status")
|
||||
TenantIDColumn = postgres.IntegerColumn("tenant_id")
|
||||
UserIDColumn = postgres.IntegerColumn("user_id")
|
||||
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")
|
||||
MetaColumn = postgres.StringColumn("meta")
|
||||
TagsColumn = postgres.StringColumn("tags")
|
||||
AssetsColumn = postgres.StringColumn("assets")
|
||||
allColumns = postgres.ColumnList{IDColumn, CreatedAtColumn, UpdatedAtColumn, DeletedAtColumn, TypeColumn, StageColumn, StatusColumn, TenantIDColumn, UserIDColumn, TitleColumn, DescriptionColumn, ContentColumn, PriceColumn, DiscountColumn, ViewsColumn, LikesColumn, MetaColumn, TagsColumn, AssetsColumn}
|
||||
mutableColumns = postgres.ColumnList{CreatedAtColumn, UpdatedAtColumn, DeletedAtColumn, TypeColumn, StageColumn, StatusColumn, TenantIDColumn, UserIDColumn, TitleColumn, DescriptionColumn, ContentColumn, PriceColumn, DiscountColumn, ViewsColumn, LikesColumn, MetaColumn, TagsColumn, AssetsColumn}
|
||||
)
|
||||
|
||||
return postsTable{
|
||||
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
||||
|
||||
//Columns
|
||||
ID: IDColumn,
|
||||
CreatedAt: CreatedAtColumn,
|
||||
UpdatedAt: UpdatedAtColumn,
|
||||
DeletedAt: DeletedAtColumn,
|
||||
Type: TypeColumn,
|
||||
Stage: StageColumn,
|
||||
Status: StatusColumn,
|
||||
TenantID: TenantIDColumn,
|
||||
UserID: UserIDColumn,
|
||||
Title: TitleColumn,
|
||||
Description: DescriptionColumn,
|
||||
Content: ContentColumn,
|
||||
Price: PriceColumn,
|
||||
Discount: DiscountColumn,
|
||||
Views: ViewsColumn,
|
||||
Likes: LikesColumn,
|
||||
Meta: MetaColumn,
|
||||
Tags: TagsColumn,
|
||||
Assets: AssetsColumn,
|
||||
|
||||
AllColumns: allColumns,
|
||||
MutableColumns: mutableColumns,
|
||||
}
|
||||
}
|
||||
93
test/database/models/qvyun_v2/public/table/storages.go
Normal file
93
test/database/models/qvyun_v2/public/table/storages.go
Normal 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 Storages = newStoragesTable("public", "storages", "")
|
||||
|
||||
type storagesTable struct {
|
||||
postgres.Table
|
||||
|
||||
// Columns
|
||||
ID postgres.ColumnInteger
|
||||
CreatedAt postgres.ColumnTimestamp
|
||||
UpdatedAt postgres.ColumnTimestamp
|
||||
IsDefault postgres.ColumnBool
|
||||
Name postgres.ColumnString
|
||||
Type postgres.ColumnInteger
|
||||
Config postgres.ColumnString
|
||||
|
||||
AllColumns postgres.ColumnList
|
||||
MutableColumns postgres.ColumnList
|
||||
}
|
||||
|
||||
type StoragesTable struct {
|
||||
storagesTable
|
||||
|
||||
EXCLUDED storagesTable
|
||||
}
|
||||
|
||||
// AS creates new StoragesTable with assigned alias
|
||||
func (a StoragesTable) AS(alias string) *StoragesTable {
|
||||
return newStoragesTable(a.SchemaName(), a.TableName(), alias)
|
||||
}
|
||||
|
||||
// Schema creates new StoragesTable with assigned schema name
|
||||
func (a StoragesTable) FromSchema(schemaName string) *StoragesTable {
|
||||
return newStoragesTable(schemaName, a.TableName(), a.Alias())
|
||||
}
|
||||
|
||||
// WithPrefix creates new StoragesTable with assigned table prefix
|
||||
func (a StoragesTable) WithPrefix(prefix string) *StoragesTable {
|
||||
return newStoragesTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
|
||||
}
|
||||
|
||||
// WithSuffix creates new StoragesTable with assigned table suffix
|
||||
func (a StoragesTable) WithSuffix(suffix string) *StoragesTable {
|
||||
return newStoragesTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
|
||||
}
|
||||
|
||||
func newStoragesTable(schemaName, tableName, alias string) *StoragesTable {
|
||||
return &StoragesTable{
|
||||
storagesTable: newStoragesTableImpl(schemaName, tableName, alias),
|
||||
EXCLUDED: newStoragesTableImpl("", "excluded", ""),
|
||||
}
|
||||
}
|
||||
|
||||
func newStoragesTableImpl(schemaName, tableName, alias string) storagesTable {
|
||||
var (
|
||||
IDColumn = postgres.IntegerColumn("id")
|
||||
CreatedAtColumn = postgres.TimestampColumn("created_at")
|
||||
UpdatedAtColumn = postgres.TimestampColumn("updated_at")
|
||||
IsDefaultColumn = postgres.BoolColumn("is_default")
|
||||
NameColumn = postgres.StringColumn("name")
|
||||
TypeColumn = postgres.IntegerColumn("type")
|
||||
ConfigColumn = postgres.StringColumn("config")
|
||||
allColumns = postgres.ColumnList{IDColumn, CreatedAtColumn, UpdatedAtColumn, IsDefaultColumn, NameColumn, TypeColumn, ConfigColumn}
|
||||
mutableColumns = postgres.ColumnList{CreatedAtColumn, UpdatedAtColumn, IsDefaultColumn, NameColumn, TypeColumn, ConfigColumn}
|
||||
)
|
||||
|
||||
return storagesTable{
|
||||
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
||||
|
||||
//Columns
|
||||
ID: IDColumn,
|
||||
CreatedAt: CreatedAtColumn,
|
||||
UpdatedAt: UpdatedAtColumn,
|
||||
IsDefault: IsDefaultColumn,
|
||||
Name: NameColumn,
|
||||
Type: TypeColumn,
|
||||
Config: ConfigColumn,
|
||||
|
||||
AllColumns: allColumns,
|
||||
MutableColumns: mutableColumns,
|
||||
}
|
||||
}
|
||||
@@ -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 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)
|
||||
Orders = Orders.FromSchema(schema)
|
||||
Posts = Posts.FromSchema(schema)
|
||||
Storages = Storages.FromSchema(schema)
|
||||
TenantUserBalances = TenantUserBalances.FromSchema(schema)
|
||||
TenantUsers = TenantUsers.FromSchema(schema)
|
||||
Tenants = Tenants.FromSchema(schema)
|
||||
UserBoughtPosts = UserBoughtPosts.FromSchema(schema)
|
||||
UserMedias = UserMedias.FromSchema(schema)
|
||||
UserOauths = UserOauths.FromSchema(schema)
|
||||
Users = Users.FromSchema(schema)
|
||||
}
|
||||
@@ -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 TenantUserBalances = newTenantUserBalancesTable("public", "tenant_user_balances", "")
|
||||
|
||||
type tenantUserBalancesTable struct {
|
||||
postgres.Table
|
||||
|
||||
// Columns
|
||||
ID postgres.ColumnInteger
|
||||
CreatedAt postgres.ColumnTimestamp
|
||||
UpdatedAt postgres.ColumnTimestamp
|
||||
TenantID postgres.ColumnInteger
|
||||
UserID 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")
|
||||
CreatedAtColumn = postgres.TimestampColumn("created_at")
|
||||
UpdatedAtColumn = postgres.TimestampColumn("updated_at")
|
||||
TenantIDColumn = postgres.IntegerColumn("tenant_id")
|
||||
UserIDColumn = postgres.IntegerColumn("user_id")
|
||||
BalanceColumn = postgres.IntegerColumn("balance")
|
||||
allColumns = postgres.ColumnList{IDColumn, CreatedAtColumn, UpdatedAtColumn, TenantIDColumn, UserIDColumn, BalanceColumn}
|
||||
mutableColumns = postgres.ColumnList{CreatedAtColumn, UpdatedAtColumn, TenantIDColumn, UserIDColumn, BalanceColumn}
|
||||
)
|
||||
|
||||
return tenantUserBalancesTable{
|
||||
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
||||
|
||||
//Columns
|
||||
ID: IDColumn,
|
||||
CreatedAt: CreatedAtColumn,
|
||||
UpdatedAt: UpdatedAtColumn,
|
||||
TenantID: TenantIDColumn,
|
||||
UserID: UserIDColumn,
|
||||
Balance: BalanceColumn,
|
||||
|
||||
AllColumns: allColumns,
|
||||
MutableColumns: mutableColumns,
|
||||
}
|
||||
}
|
||||
96
test/database/models/qvyun_v2/public/table/tenant_users.go
Normal file
96
test/database/models/qvyun_v2/public/table/tenant_users.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 TenantUsers = newTenantUsersTable("public", "tenant_users", "")
|
||||
|
||||
type tenantUsersTable struct {
|
||||
postgres.Table
|
||||
|
||||
// Columns
|
||||
ID postgres.ColumnInteger
|
||||
CreatedAt postgres.ColumnTimestamp
|
||||
UpdatedAt postgres.ColumnTimestamp
|
||||
DeletedAt postgres.ColumnTimestamp
|
||||
TenantID postgres.ColumnInteger
|
||||
UserID postgres.ColumnInteger
|
||||
Status postgres.ColumnInteger
|
||||
Role postgres.ColumnInteger
|
||||
|
||||
AllColumns postgres.ColumnList
|
||||
MutableColumns postgres.ColumnList
|
||||
}
|
||||
|
||||
type TenantUsersTable struct {
|
||||
tenantUsersTable
|
||||
|
||||
EXCLUDED tenantUsersTable
|
||||
}
|
||||
|
||||
// AS creates new TenantUsersTable with assigned alias
|
||||
func (a TenantUsersTable) AS(alias string) *TenantUsersTable {
|
||||
return newTenantUsersTable(a.SchemaName(), a.TableName(), alias)
|
||||
}
|
||||
|
||||
// Schema creates new TenantUsersTable with assigned schema name
|
||||
func (a TenantUsersTable) FromSchema(schemaName string) *TenantUsersTable {
|
||||
return newTenantUsersTable(schemaName, a.TableName(), a.Alias())
|
||||
}
|
||||
|
||||
// WithPrefix creates new TenantUsersTable with assigned table prefix
|
||||
func (a TenantUsersTable) WithPrefix(prefix string) *TenantUsersTable {
|
||||
return newTenantUsersTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
|
||||
}
|
||||
|
||||
// WithSuffix creates new TenantUsersTable with assigned table suffix
|
||||
func (a TenantUsersTable) WithSuffix(suffix string) *TenantUsersTable {
|
||||
return newTenantUsersTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
|
||||
}
|
||||
|
||||
func newTenantUsersTable(schemaName, tableName, alias string) *TenantUsersTable {
|
||||
return &TenantUsersTable{
|
||||
tenantUsersTable: newTenantUsersTableImpl(schemaName, tableName, alias),
|
||||
EXCLUDED: newTenantUsersTableImpl("", "excluded", ""),
|
||||
}
|
||||
}
|
||||
|
||||
func newTenantUsersTableImpl(schemaName, tableName, alias string) tenantUsersTable {
|
||||
var (
|
||||
IDColumn = postgres.IntegerColumn("id")
|
||||
CreatedAtColumn = postgres.TimestampColumn("created_at")
|
||||
UpdatedAtColumn = postgres.TimestampColumn("updated_at")
|
||||
DeletedAtColumn = postgres.TimestampColumn("deleted_at")
|
||||
TenantIDColumn = postgres.IntegerColumn("tenant_id")
|
||||
UserIDColumn = postgres.IntegerColumn("user_id")
|
||||
StatusColumn = postgres.IntegerColumn("status")
|
||||
RoleColumn = postgres.IntegerColumn("role")
|
||||
allColumns = postgres.ColumnList{IDColumn, CreatedAtColumn, UpdatedAtColumn, DeletedAtColumn, TenantIDColumn, UserIDColumn, StatusColumn, RoleColumn}
|
||||
mutableColumns = postgres.ColumnList{CreatedAtColumn, UpdatedAtColumn, DeletedAtColumn, TenantIDColumn, UserIDColumn, StatusColumn, RoleColumn}
|
||||
)
|
||||
|
||||
return tenantUsersTable{
|
||||
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
||||
|
||||
//Columns
|
||||
ID: IDColumn,
|
||||
CreatedAt: CreatedAtColumn,
|
||||
UpdatedAt: UpdatedAtColumn,
|
||||
DeletedAt: DeletedAtColumn,
|
||||
TenantID: TenantIDColumn,
|
||||
UserID: UserIDColumn,
|
||||
Status: StatusColumn,
|
||||
Role: RoleColumn,
|
||||
|
||||
AllColumns: allColumns,
|
||||
MutableColumns: mutableColumns,
|
||||
}
|
||||
}
|
||||
96
test/database/models/qvyun_v2/public/table/tenants.go
Normal file
96
test/database/models/qvyun_v2/public/table/tenants.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 Tenants = newTenantsTable("public", "tenants", "")
|
||||
|
||||
type tenantsTable struct {
|
||||
postgres.Table
|
||||
|
||||
// Columns
|
||||
ID postgres.ColumnInteger
|
||||
CreatedAt postgres.ColumnTimestamp
|
||||
UpdatedAt postgres.ColumnTimestamp
|
||||
ExpiredAt postgres.ColumnTimestamp
|
||||
CreatedByUserID postgres.ColumnInteger
|
||||
Name postgres.ColumnString
|
||||
Slug postgres.ColumnString
|
||||
Description postgres.ColumnString
|
||||
|
||||
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")
|
||||
CreatedAtColumn = postgres.TimestampColumn("created_at")
|
||||
UpdatedAtColumn = postgres.TimestampColumn("updated_at")
|
||||
ExpiredAtColumn = postgres.TimestampColumn("expired_at")
|
||||
CreatedByUserIDColumn = postgres.IntegerColumn("created_by_user_id")
|
||||
NameColumn = postgres.StringColumn("name")
|
||||
SlugColumn = postgres.StringColumn("slug")
|
||||
DescriptionColumn = postgres.StringColumn("description")
|
||||
allColumns = postgres.ColumnList{IDColumn, CreatedAtColumn, UpdatedAtColumn, ExpiredAtColumn, CreatedByUserIDColumn, NameColumn, SlugColumn, DescriptionColumn}
|
||||
mutableColumns = postgres.ColumnList{CreatedAtColumn, UpdatedAtColumn, ExpiredAtColumn, CreatedByUserIDColumn, NameColumn, SlugColumn, DescriptionColumn}
|
||||
)
|
||||
|
||||
return tenantsTable{
|
||||
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
||||
|
||||
//Columns
|
||||
ID: IDColumn,
|
||||
CreatedAt: CreatedAtColumn,
|
||||
UpdatedAt: UpdatedAtColumn,
|
||||
ExpiredAt: ExpiredAtColumn,
|
||||
CreatedByUserID: CreatedByUserIDColumn,
|
||||
Name: NameColumn,
|
||||
Slug: SlugColumn,
|
||||
Description: DescriptionColumn,
|
||||
|
||||
AllColumns: allColumns,
|
||||
MutableColumns: mutableColumns,
|
||||
}
|
||||
}
|
||||
@@ -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 UserBoughtPosts = newUserBoughtPostsTable("public", "user_bought_posts", "")
|
||||
|
||||
type userBoughtPostsTable struct {
|
||||
postgres.Table
|
||||
|
||||
// Columns
|
||||
ID postgres.ColumnInteger
|
||||
CreatedAt postgres.ColumnTimestamp
|
||||
UpdatedAt postgres.ColumnTimestamp
|
||||
TenantID postgres.ColumnInteger
|
||||
UserID postgres.ColumnInteger
|
||||
PostID postgres.ColumnInteger
|
||||
Price postgres.ColumnInteger
|
||||
Discount postgres.ColumnInteger
|
||||
Meta postgres.ColumnString
|
||||
|
||||
AllColumns postgres.ColumnList
|
||||
MutableColumns postgres.ColumnList
|
||||
}
|
||||
|
||||
type UserBoughtPostsTable struct {
|
||||
userBoughtPostsTable
|
||||
|
||||
EXCLUDED userBoughtPostsTable
|
||||
}
|
||||
|
||||
// AS creates new UserBoughtPostsTable with assigned alias
|
||||
func (a UserBoughtPostsTable) AS(alias string) *UserBoughtPostsTable {
|
||||
return newUserBoughtPostsTable(a.SchemaName(), a.TableName(), alias)
|
||||
}
|
||||
|
||||
// Schema creates new UserBoughtPostsTable with assigned schema name
|
||||
func (a UserBoughtPostsTable) FromSchema(schemaName string) *UserBoughtPostsTable {
|
||||
return newUserBoughtPostsTable(schemaName, a.TableName(), a.Alias())
|
||||
}
|
||||
|
||||
// WithPrefix creates new UserBoughtPostsTable with assigned table prefix
|
||||
func (a UserBoughtPostsTable) WithPrefix(prefix string) *UserBoughtPostsTable {
|
||||
return newUserBoughtPostsTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
|
||||
}
|
||||
|
||||
// WithSuffix creates new UserBoughtPostsTable with assigned table suffix
|
||||
func (a UserBoughtPostsTable) WithSuffix(suffix string) *UserBoughtPostsTable {
|
||||
return newUserBoughtPostsTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
|
||||
}
|
||||
|
||||
func newUserBoughtPostsTable(schemaName, tableName, alias string) *UserBoughtPostsTable {
|
||||
return &UserBoughtPostsTable{
|
||||
userBoughtPostsTable: newUserBoughtPostsTableImpl(schemaName, tableName, alias),
|
||||
EXCLUDED: newUserBoughtPostsTableImpl("", "excluded", ""),
|
||||
}
|
||||
}
|
||||
|
||||
func newUserBoughtPostsTableImpl(schemaName, tableName, alias string) userBoughtPostsTable {
|
||||
var (
|
||||
IDColumn = postgres.IntegerColumn("id")
|
||||
CreatedAtColumn = postgres.TimestampColumn("created_at")
|
||||
UpdatedAtColumn = postgres.TimestampColumn("updated_at")
|
||||
TenantIDColumn = postgres.IntegerColumn("tenant_id")
|
||||
UserIDColumn = postgres.IntegerColumn("user_id")
|
||||
PostIDColumn = postgres.IntegerColumn("post_id")
|
||||
PriceColumn = postgres.IntegerColumn("price")
|
||||
DiscountColumn = postgres.IntegerColumn("discount")
|
||||
MetaColumn = postgres.StringColumn("meta")
|
||||
allColumns = postgres.ColumnList{IDColumn, CreatedAtColumn, UpdatedAtColumn, TenantIDColumn, UserIDColumn, PostIDColumn, PriceColumn, DiscountColumn, MetaColumn}
|
||||
mutableColumns = postgres.ColumnList{CreatedAtColumn, UpdatedAtColumn, TenantIDColumn, UserIDColumn, PostIDColumn, PriceColumn, DiscountColumn, MetaColumn}
|
||||
)
|
||||
|
||||
return userBoughtPostsTable{
|
||||
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
||||
|
||||
//Columns
|
||||
ID: IDColumn,
|
||||
CreatedAt: CreatedAtColumn,
|
||||
UpdatedAt: UpdatedAtColumn,
|
||||
TenantID: TenantIDColumn,
|
||||
UserID: UserIDColumn,
|
||||
PostID: PostIDColumn,
|
||||
Price: PriceColumn,
|
||||
Discount: DiscountColumn,
|
||||
Meta: MetaColumn,
|
||||
|
||||
AllColumns: allColumns,
|
||||
MutableColumns: mutableColumns,
|
||||
}
|
||||
}
|
||||
90
test/database/models/qvyun_v2/public/table/user_medias.go
Normal file
90
test/database/models/qvyun_v2/public/table/user_medias.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 UserMedias = newUserMediasTable("public", "user_medias", "")
|
||||
|
||||
type userMediasTable struct {
|
||||
postgres.Table
|
||||
|
||||
// Columns
|
||||
ID postgres.ColumnInteger
|
||||
CreatedAt postgres.ColumnTimestamp
|
||||
UpdatedAt postgres.ColumnTimestamp
|
||||
TenantID postgres.ColumnInteger
|
||||
UserID postgres.ColumnInteger
|
||||
MediaID postgres.ColumnInteger
|
||||
|
||||
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")
|
||||
CreatedAtColumn = postgres.TimestampColumn("created_at")
|
||||
UpdatedAtColumn = postgres.TimestampColumn("updated_at")
|
||||
TenantIDColumn = postgres.IntegerColumn("tenant_id")
|
||||
UserIDColumn = postgres.IntegerColumn("user_id")
|
||||
MediaIDColumn = postgres.IntegerColumn("media_id")
|
||||
allColumns = postgres.ColumnList{IDColumn, CreatedAtColumn, UpdatedAtColumn, TenantIDColumn, UserIDColumn, MediaIDColumn}
|
||||
mutableColumns = postgres.ColumnList{CreatedAtColumn, UpdatedAtColumn, TenantIDColumn, UserIDColumn, MediaIDColumn}
|
||||
)
|
||||
|
||||
return userMediasTable{
|
||||
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
||||
|
||||
//Columns
|
||||
ID: IDColumn,
|
||||
CreatedAt: CreatedAtColumn,
|
||||
UpdatedAt: UpdatedAtColumn,
|
||||
TenantID: TenantIDColumn,
|
||||
UserID: UserIDColumn,
|
||||
MediaID: MediaIDColumn,
|
||||
|
||||
AllColumns: allColumns,
|
||||
MutableColumns: mutableColumns,
|
||||
}
|
||||
}
|
||||
108
test/database/models/qvyun_v2/public/table/user_oauths.go
Normal file
108
test/database/models/qvyun_v2/public/table/user_oauths.go
Normal file
@@ -0,0 +1,108 @@
|
||||
//
|
||||
// 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 UserOauths = newUserOauthsTable("public", "user_oauths", "")
|
||||
|
||||
type userOauthsTable struct {
|
||||
postgres.Table
|
||||
|
||||
// Columns
|
||||
ID postgres.ColumnInteger
|
||||
CreatedAt postgres.ColumnTimestamp
|
||||
UpdatedAt postgres.ColumnTimestamp
|
||||
DeletedAt postgres.ColumnTimestamp
|
||||
Channel postgres.ColumnInteger
|
||||
UserID postgres.ColumnInteger
|
||||
UnionID postgres.ColumnString
|
||||
OpenID postgres.ColumnString
|
||||
AccessToken postgres.ColumnString
|
||||
RefreshToken postgres.ColumnString
|
||||
ExpireAt postgres.ColumnTimestamp
|
||||
Meta postgres.ColumnString
|
||||
|
||||
AllColumns postgres.ColumnList
|
||||
MutableColumns postgres.ColumnList
|
||||
}
|
||||
|
||||
type UserOauthsTable struct {
|
||||
userOauthsTable
|
||||
|
||||
EXCLUDED userOauthsTable
|
||||
}
|
||||
|
||||
// AS creates new UserOauthsTable with assigned alias
|
||||
func (a UserOauthsTable) AS(alias string) *UserOauthsTable {
|
||||
return newUserOauthsTable(a.SchemaName(), a.TableName(), alias)
|
||||
}
|
||||
|
||||
// Schema creates new UserOauthsTable with assigned schema name
|
||||
func (a UserOauthsTable) FromSchema(schemaName string) *UserOauthsTable {
|
||||
return newUserOauthsTable(schemaName, a.TableName(), a.Alias())
|
||||
}
|
||||
|
||||
// WithPrefix creates new UserOauthsTable with assigned table prefix
|
||||
func (a UserOauthsTable) WithPrefix(prefix string) *UserOauthsTable {
|
||||
return newUserOauthsTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
|
||||
}
|
||||
|
||||
// WithSuffix creates new UserOauthsTable with assigned table suffix
|
||||
func (a UserOauthsTable) WithSuffix(suffix string) *UserOauthsTable {
|
||||
return newUserOauthsTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
|
||||
}
|
||||
|
||||
func newUserOauthsTable(schemaName, tableName, alias string) *UserOauthsTable {
|
||||
return &UserOauthsTable{
|
||||
userOauthsTable: newUserOauthsTableImpl(schemaName, tableName, alias),
|
||||
EXCLUDED: newUserOauthsTableImpl("", "excluded", ""),
|
||||
}
|
||||
}
|
||||
|
||||
func newUserOauthsTableImpl(schemaName, tableName, alias string) userOauthsTable {
|
||||
var (
|
||||
IDColumn = postgres.IntegerColumn("id")
|
||||
CreatedAtColumn = postgres.TimestampColumn("created_at")
|
||||
UpdatedAtColumn = postgres.TimestampColumn("updated_at")
|
||||
DeletedAtColumn = postgres.TimestampColumn("deleted_at")
|
||||
ChannelColumn = postgres.IntegerColumn("channel")
|
||||
UserIDColumn = postgres.IntegerColumn("user_id")
|
||||
UnionIDColumn = postgres.StringColumn("union_id")
|
||||
OpenIDColumn = postgres.StringColumn("open_id")
|
||||
AccessTokenColumn = postgres.StringColumn("access_token")
|
||||
RefreshTokenColumn = postgres.StringColumn("refresh_token")
|
||||
ExpireAtColumn = postgres.TimestampColumn("expire_at")
|
||||
MetaColumn = postgres.StringColumn("meta")
|
||||
allColumns = postgres.ColumnList{IDColumn, CreatedAtColumn, UpdatedAtColumn, DeletedAtColumn, ChannelColumn, UserIDColumn, UnionIDColumn, OpenIDColumn, AccessTokenColumn, RefreshTokenColumn, ExpireAtColumn, MetaColumn}
|
||||
mutableColumns = postgres.ColumnList{CreatedAtColumn, UpdatedAtColumn, DeletedAtColumn, ChannelColumn, UserIDColumn, UnionIDColumn, OpenIDColumn, AccessTokenColumn, RefreshTokenColumn, ExpireAtColumn, MetaColumn}
|
||||
)
|
||||
|
||||
return userOauthsTable{
|
||||
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
||||
|
||||
//Columns
|
||||
ID: IDColumn,
|
||||
CreatedAt: CreatedAtColumn,
|
||||
UpdatedAt: UpdatedAtColumn,
|
||||
DeletedAt: DeletedAtColumn,
|
||||
Channel: ChannelColumn,
|
||||
UserID: UserIDColumn,
|
||||
UnionID: UnionIDColumn,
|
||||
OpenID: OpenIDColumn,
|
||||
AccessToken: AccessTokenColumn,
|
||||
RefreshToken: RefreshTokenColumn,
|
||||
ExpireAt: ExpireAtColumn,
|
||||
Meta: MetaColumn,
|
||||
|
||||
AllColumns: allColumns,
|
||||
MutableColumns: mutableColumns,
|
||||
}
|
||||
}
|
||||
111
test/database/models/qvyun_v2/public/table/users.go
Normal file
111
test/database/models/qvyun_v2/public/table/users.go
Normal file
@@ -0,0 +1,111 @@
|
||||
//
|
||||
// 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
|
||||
Email postgres.ColumnString
|
||||
Phone postgres.ColumnString
|
||||
Username postgres.ColumnString
|
||||
Nickname postgres.ColumnString
|
||||
Password postgres.ColumnString
|
||||
Age postgres.ColumnInteger
|
||||
Sex postgres.ColumnInteger
|
||||
Avatar postgres.ColumnString
|
||||
|
||||
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")
|
||||
EmailColumn = postgres.StringColumn("email")
|
||||
PhoneColumn = postgres.StringColumn("phone")
|
||||
UsernameColumn = postgres.StringColumn("username")
|
||||
NicknameColumn = postgres.StringColumn("nickname")
|
||||
PasswordColumn = postgres.StringColumn("password")
|
||||
AgeColumn = postgres.IntegerColumn("age")
|
||||
SexColumn = postgres.IntegerColumn("sex")
|
||||
AvatarColumn = postgres.StringColumn("avatar")
|
||||
allColumns = postgres.ColumnList{IDColumn, CreatedAtColumn, UpdatedAtColumn, DeletedAtColumn, StatusColumn, EmailColumn, PhoneColumn, UsernameColumn, NicknameColumn, PasswordColumn, AgeColumn, SexColumn, AvatarColumn}
|
||||
mutableColumns = postgres.ColumnList{CreatedAtColumn, UpdatedAtColumn, DeletedAtColumn, StatusColumn, EmailColumn, PhoneColumn, UsernameColumn, NicknameColumn, PasswordColumn, AgeColumn, SexColumn, AvatarColumn}
|
||||
)
|
||||
|
||||
return usersTable{
|
||||
Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),
|
||||
|
||||
//Columns
|
||||
ID: IDColumn,
|
||||
CreatedAt: CreatedAtColumn,
|
||||
UpdatedAt: UpdatedAtColumn,
|
||||
DeletedAt: DeletedAtColumn,
|
||||
Status: StatusColumn,
|
||||
Email: EmailColumn,
|
||||
Phone: PhoneColumn,
|
||||
Username: UsernameColumn,
|
||||
Nickname: NicknameColumn,
|
||||
Password: PasswordColumn,
|
||||
Age: AgeColumn,
|
||||
Sex: SexColumn,
|
||||
Avatar: AvatarColumn,
|
||||
|
||||
AllColumns: allColumns,
|
||||
MutableColumns: mutableColumns,
|
||||
}
|
||||
}
|
||||
9
test/database/transform.yaml
Normal file
9
test/database/transform.yaml
Normal file
@@ -0,0 +1,9 @@
|
||||
ignores:
|
||||
- migrations
|
||||
- river_client
|
||||
- river_client_queue
|
||||
- river_job
|
||||
- river_job_state
|
||||
- river_leader
|
||||
- river_queue
|
||||
types:
|
||||
13
test/go.mod
Normal file
13
test/go.mod
Normal file
@@ -0,0 +1,13 @@
|
||||
module test
|
||||
|
||||
go 1.23.2
|
||||
|
||||
require github.com/go-jet/jet/v2 v2.12.0
|
||||
|
||||
require (
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/google/uuid v1.6.0 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/stretchr/testify v1.9.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
16
test/go.sum
Normal file
16
test/go.sum
Normal file
@@ -0,0 +1,16 @@
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/go-jet/jet/v2 v2.12.0 h1:z2JfvBAZgsfxlQz6NXBYdZTXc7ep3jhbszTLtETv1JE=
|
||||
github.com/go-jet/jet/v2 v2.12.0/go.mod h1:ufQVRQeI1mbcO5R8uCEVcVf3Foej9kReBdwDx7YMWUM=
|
||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
||||
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
20
test/main_test.go
Normal file
20
test/main_test.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"test/database/models/qvyun_v2/public/table"
|
||||
|
||||
. "github.com/go-jet/jet/v2/postgres"
|
||||
)
|
||||
|
||||
func Test_Join(t *testing.T) {
|
||||
t1 := table.Medias
|
||||
t2 := table.UserMedias
|
||||
|
||||
stmt := SELECT(t1.AllColumns).
|
||||
FROM(
|
||||
t1.RIGHT_JOIN(t2, t2.UserID.EQ(Int64(10)).AND(t2.TenantID.EQ(Int64(1)).AND(t2.MediaID.EQ(t1.ID)))),
|
||||
)
|
||||
t.Log(stmt.DebugSql())
|
||||
}
|
||||
Reference in New Issue
Block a user