1 Star 0 Fork 0

liuxuezhan/ar-platform

Create your Gitee Account
Explore and code with more than 13.5 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
user_wallet_log.gen.go 13.48 KB
Copy Edit Raw Blame History
liuxuezhan authored 2024-08-13 11:57 +08:00 . 2024-08-13 11:57:13
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package query
import (
"context"
"gorm.io/gorm"
"gorm.io/gorm/clause"
"gorm.io/gorm/schema"
"gorm.io/gen"
"gorm.io/gen/field"
"gorm.io/plugin/dbresolver"
"gitee.com/liuxuezhan/ar-platform/assets-rpc/internal/dao/schema/user"
)
func newUserWalletLog(db *gorm.DB, opts ...gen.DOOption) userWalletLog {
_userWalletLog := userWalletLog{}
_userWalletLog.userWalletLogDo.UseDB(db, opts...)
_userWalletLog.userWalletLogDo.UseModel(&user.UserWalletLog{})
tableName := _userWalletLog.userWalletLogDo.TableName()
_userWalletLog.ALL = field.NewAsterisk(tableName)
_userWalletLog.ID = field.NewInt64(tableName, "id")
_userWalletLog.CreatedAt = field.NewInt64(tableName, "created_at")
_userWalletLog.UpdatedAt = field.NewInt64(tableName, "updated_at")
_userWalletLog.DeletedAt = field.NewInt64(tableName, "deleted_at")
_userWalletLog.OperatorId = field.NewInt64(tableName, "operator_id")
_userWalletLog.TransferType = field.NewInt64(tableName, "transfer_type")
_userWalletLog.UserId = field.NewInt64(tableName, "user_id")
_userWalletLog.Amount = field.NewFloat64(tableName, "amount")
_userWalletLog.BalanceStart = field.NewFloat64(tableName, "balance_start")
_userWalletLog.BalanceEnd = field.NewFloat64(tableName, "balance_end")
_userWalletLog.TypeID = field.NewInt64(tableName, "type_id")
_userWalletLog.TypeName = field.NewString(tableName, "type_name")
_userWalletLog.SourceId = field.NewString(tableName, "source_id")
_userWalletLog.Description = field.NewString(tableName, "description")
_userWalletLog.fillFieldMap()
return _userWalletLog
}
type userWalletLog struct {
userWalletLogDo
ALL field.Asterisk
ID field.Int64
CreatedAt field.Int64
UpdatedAt field.Int64
DeletedAt field.Int64
OperatorId field.Int64
TransferType field.Int64
UserId field.Int64
Amount field.Float64
BalanceStart field.Float64
BalanceEnd field.Float64
TypeID field.Int64
TypeName field.String
SourceId field.String
Description field.String
fieldMap map[string]field.Expr
}
func (u userWalletLog) Table(newTableName string) *userWalletLog {
u.userWalletLogDo.UseTable(newTableName)
return u.updateTableName(newTableName)
}
func (u userWalletLog) As(alias string) *userWalletLog {
u.userWalletLogDo.DO = *(u.userWalletLogDo.As(alias).(*gen.DO))
return u.updateTableName(alias)
}
func (u *userWalletLog) updateTableName(table string) *userWalletLog {
u.ALL = field.NewAsterisk(table)
u.ID = field.NewInt64(table, "id")
u.CreatedAt = field.NewInt64(table, "created_at")
u.UpdatedAt = field.NewInt64(table, "updated_at")
u.DeletedAt = field.NewInt64(table, "deleted_at")
u.OperatorId = field.NewInt64(table, "operator_id")
u.TransferType = field.NewInt64(table, "transfer_type")
u.UserId = field.NewInt64(table, "user_id")
u.Amount = field.NewFloat64(table, "amount")
u.BalanceStart = field.NewFloat64(table, "balance_start")
u.BalanceEnd = field.NewFloat64(table, "balance_end")
u.TypeID = field.NewInt64(table, "type_id")
u.TypeName = field.NewString(table, "type_name")
u.SourceId = field.NewString(table, "source_id")
u.Description = field.NewString(table, "description")
u.fillFieldMap()
return u
}
func (u *userWalletLog) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
_f, ok := u.fieldMap[fieldName]
if !ok || _f == nil {
return nil, false
}
_oe, ok := _f.(field.OrderExpr)
return _oe, ok
}
func (u *userWalletLog) fillFieldMap() {
u.fieldMap = make(map[string]field.Expr, 14)
u.fieldMap["id"] = u.ID
u.fieldMap["created_at"] = u.CreatedAt
u.fieldMap["updated_at"] = u.UpdatedAt
u.fieldMap["deleted_at"] = u.DeletedAt
u.fieldMap["operator_id"] = u.OperatorId
u.fieldMap["transfer_type"] = u.TransferType
u.fieldMap["user_id"] = u.UserId
u.fieldMap["amount"] = u.Amount
u.fieldMap["balance_start"] = u.BalanceStart
u.fieldMap["balance_end"] = u.BalanceEnd
u.fieldMap["type_id"] = u.TypeID
u.fieldMap["type_name"] = u.TypeName
u.fieldMap["source_id"] = u.SourceId
u.fieldMap["description"] = u.Description
}
func (u userWalletLog) clone(db *gorm.DB) userWalletLog {
u.userWalletLogDo.ReplaceConnPool(db.Statement.ConnPool)
return u
}
func (u userWalletLog) replaceDB(db *gorm.DB) userWalletLog {
u.userWalletLogDo.ReplaceDB(db)
return u
}
type userWalletLogDo struct{ gen.DO }
type IUserWalletLogDo interface {
gen.SubQuery
Debug() IUserWalletLogDo
WithContext(ctx context.Context) IUserWalletLogDo
WithResult(fc func(tx gen.Dao)) gen.ResultInfo
ReplaceDB(db *gorm.DB)
ReadDB() IUserWalletLogDo
WriteDB() IUserWalletLogDo
As(alias string) gen.Dao
Session(config *gorm.Session) IUserWalletLogDo
Columns(cols ...field.Expr) gen.Columns
Clauses(conds ...clause.Expression) IUserWalletLogDo
Not(conds ...gen.Condition) IUserWalletLogDo
Or(conds ...gen.Condition) IUserWalletLogDo
Select(conds ...field.Expr) IUserWalletLogDo
Where(conds ...gen.Condition) IUserWalletLogDo
Order(conds ...field.Expr) IUserWalletLogDo
Distinct(cols ...field.Expr) IUserWalletLogDo
Omit(cols ...field.Expr) IUserWalletLogDo
Join(table schema.Tabler, on ...field.Expr) IUserWalletLogDo
LeftJoin(table schema.Tabler, on ...field.Expr) IUserWalletLogDo
RightJoin(table schema.Tabler, on ...field.Expr) IUserWalletLogDo
Group(cols ...field.Expr) IUserWalletLogDo
Having(conds ...gen.Condition) IUserWalletLogDo
Limit(limit int) IUserWalletLogDo
Offset(offset int) IUserWalletLogDo
Count() (count int64, err error)
Scopes(funcs ...func(gen.Dao) gen.Dao) IUserWalletLogDo
Unscoped() IUserWalletLogDo
Create(values ...*user.UserWalletLog) error
CreateInBatches(values []*user.UserWalletLog, batchSize int) error
Save(values ...*user.UserWalletLog) error
First() (*user.UserWalletLog, error)
Take() (*user.UserWalletLog, error)
Last() (*user.UserWalletLog, error)
Find() ([]*user.UserWalletLog, error)
FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*user.UserWalletLog, err error)
FindInBatches(result *[]*user.UserWalletLog, batchSize int, fc func(tx gen.Dao, batch int) error) error
Pluck(column field.Expr, dest interface{}) error
Delete(...*user.UserWalletLog) (info gen.ResultInfo, err error)
Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
Updates(value interface{}) (info gen.ResultInfo, err error)
UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
UpdateColumns(value interface{}) (info gen.ResultInfo, err error)
UpdateFrom(q gen.SubQuery) gen.Dao
Attrs(attrs ...field.AssignExpr) IUserWalletLogDo
Assign(attrs ...field.AssignExpr) IUserWalletLogDo
Joins(fields ...field.RelationField) IUserWalletLogDo
Preload(fields ...field.RelationField) IUserWalletLogDo
FirstOrInit() (*user.UserWalletLog, error)
FirstOrCreate() (*user.UserWalletLog, error)
FindByPage(offset int, limit int) (result []*user.UserWalletLog, count int64, err error)
ScanByPage(result interface{}, offset int, limit int) (count int64, err error)
Scan(result interface{}) (err error)
Returning(value interface{}, columns ...string) IUserWalletLogDo
UnderlyingDB() *gorm.DB
schema.Tabler
}
func (u userWalletLogDo) Debug() IUserWalletLogDo {
return u.withDO(u.DO.Debug())
}
func (u userWalletLogDo) WithContext(ctx context.Context) IUserWalletLogDo {
return u.withDO(u.DO.WithContext(ctx))
}
func (u userWalletLogDo) ReadDB() IUserWalletLogDo {
return u.Clauses(dbresolver.Read)
}
func (u userWalletLogDo) WriteDB() IUserWalletLogDo {
return u.Clauses(dbresolver.Write)
}
func (u userWalletLogDo) Session(config *gorm.Session) IUserWalletLogDo {
return u.withDO(u.DO.Session(config))
}
func (u userWalletLogDo) Clauses(conds ...clause.Expression) IUserWalletLogDo {
return u.withDO(u.DO.Clauses(conds...))
}
func (u userWalletLogDo) Returning(value interface{}, columns ...string) IUserWalletLogDo {
return u.withDO(u.DO.Returning(value, columns...))
}
func (u userWalletLogDo) Not(conds ...gen.Condition) IUserWalletLogDo {
return u.withDO(u.DO.Not(conds...))
}
func (u userWalletLogDo) Or(conds ...gen.Condition) IUserWalletLogDo {
return u.withDO(u.DO.Or(conds...))
}
func (u userWalletLogDo) Select(conds ...field.Expr) IUserWalletLogDo {
return u.withDO(u.DO.Select(conds...))
}
func (u userWalletLogDo) Where(conds ...gen.Condition) IUserWalletLogDo {
return u.withDO(u.DO.Where(conds...))
}
func (u userWalletLogDo) Order(conds ...field.Expr) IUserWalletLogDo {
return u.withDO(u.DO.Order(conds...))
}
func (u userWalletLogDo) Distinct(cols ...field.Expr) IUserWalletLogDo {
return u.withDO(u.DO.Distinct(cols...))
}
func (u userWalletLogDo) Omit(cols ...field.Expr) IUserWalletLogDo {
return u.withDO(u.DO.Omit(cols...))
}
func (u userWalletLogDo) Join(table schema.Tabler, on ...field.Expr) IUserWalletLogDo {
return u.withDO(u.DO.Join(table, on...))
}
func (u userWalletLogDo) LeftJoin(table schema.Tabler, on ...field.Expr) IUserWalletLogDo {
return u.withDO(u.DO.LeftJoin(table, on...))
}
func (u userWalletLogDo) RightJoin(table schema.Tabler, on ...field.Expr) IUserWalletLogDo {
return u.withDO(u.DO.RightJoin(table, on...))
}
func (u userWalletLogDo) Group(cols ...field.Expr) IUserWalletLogDo {
return u.withDO(u.DO.Group(cols...))
}
func (u userWalletLogDo) Having(conds ...gen.Condition) IUserWalletLogDo {
return u.withDO(u.DO.Having(conds...))
}
func (u userWalletLogDo) Limit(limit int) IUserWalletLogDo {
return u.withDO(u.DO.Limit(limit))
}
func (u userWalletLogDo) Offset(offset int) IUserWalletLogDo {
return u.withDO(u.DO.Offset(offset))
}
func (u userWalletLogDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IUserWalletLogDo {
return u.withDO(u.DO.Scopes(funcs...))
}
func (u userWalletLogDo) Unscoped() IUserWalletLogDo {
return u.withDO(u.DO.Unscoped())
}
func (u userWalletLogDo) Create(values ...*user.UserWalletLog) error {
if len(values) == 0 {
return nil
}
return u.DO.Create(values)
}
func (u userWalletLogDo) CreateInBatches(values []*user.UserWalletLog, batchSize int) error {
return u.DO.CreateInBatches(values, batchSize)
}
// Save : !!! underlying implementation is different with GORM
// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values)
func (u userWalletLogDo) Save(values ...*user.UserWalletLog) error {
if len(values) == 0 {
return nil
}
return u.DO.Save(values)
}
func (u userWalletLogDo) First() (*user.UserWalletLog, error) {
if result, err := u.DO.First(); err != nil {
return nil, err
} else {
return result.(*user.UserWalletLog), nil
}
}
func (u userWalletLogDo) Take() (*user.UserWalletLog, error) {
if result, err := u.DO.Take(); err != nil {
return nil, err
} else {
return result.(*user.UserWalletLog), nil
}
}
func (u userWalletLogDo) Last() (*user.UserWalletLog, error) {
if result, err := u.DO.Last(); err != nil {
return nil, err
} else {
return result.(*user.UserWalletLog), nil
}
}
func (u userWalletLogDo) Find() ([]*user.UserWalletLog, error) {
result, err := u.DO.Find()
return result.([]*user.UserWalletLog), err
}
func (u userWalletLogDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*user.UserWalletLog, err error) {
buf := make([]*user.UserWalletLog, 0, batchSize)
err = u.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error {
defer func() { results = append(results, buf...) }()
return fc(tx, batch)
})
return results, err
}
func (u userWalletLogDo) FindInBatches(result *[]*user.UserWalletLog, batchSize int, fc func(tx gen.Dao, batch int) error) error {
return u.DO.FindInBatches(result, batchSize, fc)
}
func (u userWalletLogDo) Attrs(attrs ...field.AssignExpr) IUserWalletLogDo {
return u.withDO(u.DO.Attrs(attrs...))
}
func (u userWalletLogDo) Assign(attrs ...field.AssignExpr) IUserWalletLogDo {
return u.withDO(u.DO.Assign(attrs...))
}
func (u userWalletLogDo) Joins(fields ...field.RelationField) IUserWalletLogDo {
for _, _f := range fields {
u = *u.withDO(u.DO.Joins(_f))
}
return &u
}
func (u userWalletLogDo) Preload(fields ...field.RelationField) IUserWalletLogDo {
for _, _f := range fields {
u = *u.withDO(u.DO.Preload(_f))
}
return &u
}
func (u userWalletLogDo) FirstOrInit() (*user.UserWalletLog, error) {
if result, err := u.DO.FirstOrInit(); err != nil {
return nil, err
} else {
return result.(*user.UserWalletLog), nil
}
}
func (u userWalletLogDo) FirstOrCreate() (*user.UserWalletLog, error) {
if result, err := u.DO.FirstOrCreate(); err != nil {
return nil, err
} else {
return result.(*user.UserWalletLog), nil
}
}
func (u userWalletLogDo) FindByPage(offset int, limit int) (result []*user.UserWalletLog, count int64, err error) {
result, err = u.Offset(offset).Limit(limit).Find()
if err != nil {
return
}
if size := len(result); 0 < limit && 0 < size && size < limit {
count = int64(size + offset)
return
}
count, err = u.Offset(-1).Limit(-1).Count()
return
}
func (u userWalletLogDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
count, err = u.Count()
if err != nil {
return
}
err = u.Offset(offset).Limit(limit).Scan(result)
return
}
func (u userWalletLogDo) Scan(result interface{}) (err error) {
return u.DO.Scan(result)
}
func (u userWalletLogDo) Delete(models ...*user.UserWalletLog) (result gen.ResultInfo, err error) {
return u.DO.Delete(models)
}
func (u *userWalletLogDo) withDO(do gen.Dao) *userWalletLogDo {
u.DO = *do.(*gen.DO)
return u
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/liuxuezhan/ar-platform.git
git@gitee.com:liuxuezhan/ar-platform.git
liuxuezhan
ar-platform
ar-platform
0818f1fff479

Search