Some checks failed
Build docker and publish / linux (1.24.5) (push) Failing after 25s
feat(admin): 新增工会管理功能 feat(activity): 添加活动管理相关服务 feat(user): 实现用户道具卡和积分管理 feat(guild): 新增工会成员管理功能 fix: 修复数据库连接配置 fix: 修正jwtoken导入路径 fix: 解决端口冲突问题 style: 统一代码格式和注释风格 style: 更新项目常量命名 docs: 添加项目框架和开发规范文档 docs: 更新接口文档注释 chore: 移除无用代码和文件 chore: 更新Makefile和配置文件 chore: 清理日志文件 test: 添加道具卡测试脚本
341 lines
8.9 KiB
Go
341 lines
8.9 KiB
Go
// 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 dao
|
||
|
||
import (
|
||
"context"
|
||
|
||
"gorm.io/gorm"
|
||
"gorm.io/gorm/clause"
|
||
"gorm.io/gorm/schema"
|
||
|
||
"gorm.io/gen"
|
||
"gorm.io/gen/field"
|
||
|
||
"gorm.io/plugin/dbresolver"
|
||
|
||
"bindbox-game/internal/repository/mysql/model"
|
||
)
|
||
|
||
func newGuildBoxes(db *gorm.DB, opts ...gen.DOOption) guildBoxes {
|
||
_guildBoxes := guildBoxes{}
|
||
|
||
_guildBoxes.guildBoxesDo.UseDB(db, opts...)
|
||
_guildBoxes.guildBoxesDo.UseModel(&model.GuildBoxes{})
|
||
|
||
tableName := _guildBoxes.guildBoxesDo.TableName()
|
||
_guildBoxes.ALL = field.NewAsterisk(tableName)
|
||
_guildBoxes.ID = field.NewInt64(tableName, "id")
|
||
_guildBoxes.CreatedAt = field.NewTime(tableName, "created_at")
|
||
_guildBoxes.GuildID = field.NewInt64(tableName, "guild_id")
|
||
_guildBoxes.KindID = field.NewInt64(tableName, "kind_id")
|
||
_guildBoxes.Value = field.NewInt64(tableName, "value")
|
||
_guildBoxes.KindType = field.NewInt32(tableName, "kind_type")
|
||
|
||
_guildBoxes.fillFieldMap()
|
||
|
||
return _guildBoxes
|
||
}
|
||
|
||
// guildBoxes 公会盲盒玩法聚合
|
||
type guildBoxes struct {
|
||
guildBoxesDo
|
||
|
||
ALL field.Asterisk
|
||
ID field.Int64 // 主键ID
|
||
CreatedAt field.Time // 创建时间
|
||
GuildID field.Int64 // 公会ID(guild_main.id)
|
||
KindID field.Int64 // 奖品id( 如果是 积分可以 空; 商品ID 道具卡ID)
|
||
Value field.Int64 // 累计价值/积分等(业务自定义-可以为空)
|
||
KindType field.Int32 // 奖品类型: 0 积分 1 优惠券 2 道具卡
|
||
|
||
fieldMap map[string]field.Expr
|
||
}
|
||
|
||
func (g guildBoxes) Table(newTableName string) *guildBoxes {
|
||
g.guildBoxesDo.UseTable(newTableName)
|
||
return g.updateTableName(newTableName)
|
||
}
|
||
|
||
func (g guildBoxes) As(alias string) *guildBoxes {
|
||
g.guildBoxesDo.DO = *(g.guildBoxesDo.As(alias).(*gen.DO))
|
||
return g.updateTableName(alias)
|
||
}
|
||
|
||
func (g *guildBoxes) updateTableName(table string) *guildBoxes {
|
||
g.ALL = field.NewAsterisk(table)
|
||
g.ID = field.NewInt64(table, "id")
|
||
g.CreatedAt = field.NewTime(table, "created_at")
|
||
g.GuildID = field.NewInt64(table, "guild_id")
|
||
g.KindID = field.NewInt64(table, "kind_id")
|
||
g.Value = field.NewInt64(table, "value")
|
||
g.KindType = field.NewInt32(table, "kind_type")
|
||
|
||
g.fillFieldMap()
|
||
|
||
return g
|
||
}
|
||
|
||
func (g *guildBoxes) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
||
_f, ok := g.fieldMap[fieldName]
|
||
if !ok || _f == nil {
|
||
return nil, false
|
||
}
|
||
_oe, ok := _f.(field.OrderExpr)
|
||
return _oe, ok
|
||
}
|
||
|
||
func (g *guildBoxes) fillFieldMap() {
|
||
g.fieldMap = make(map[string]field.Expr, 6)
|
||
g.fieldMap["id"] = g.ID
|
||
g.fieldMap["created_at"] = g.CreatedAt
|
||
g.fieldMap["guild_id"] = g.GuildID
|
||
g.fieldMap["kind_id"] = g.KindID
|
||
g.fieldMap["value"] = g.Value
|
||
g.fieldMap["kind_type"] = g.KindType
|
||
}
|
||
|
||
func (g guildBoxes) clone(db *gorm.DB) guildBoxes {
|
||
g.guildBoxesDo.ReplaceConnPool(db.Statement.ConnPool)
|
||
return g
|
||
}
|
||
|
||
func (g guildBoxes) replaceDB(db *gorm.DB) guildBoxes {
|
||
g.guildBoxesDo.ReplaceDB(db)
|
||
return g
|
||
}
|
||
|
||
type guildBoxesDo struct{ gen.DO }
|
||
|
||
func (g guildBoxesDo) Debug() *guildBoxesDo {
|
||
return g.withDO(g.DO.Debug())
|
||
}
|
||
|
||
func (g guildBoxesDo) WithContext(ctx context.Context) *guildBoxesDo {
|
||
return g.withDO(g.DO.WithContext(ctx))
|
||
}
|
||
|
||
func (g guildBoxesDo) ReadDB() *guildBoxesDo {
|
||
return g.Clauses(dbresolver.Read)
|
||
}
|
||
|
||
func (g guildBoxesDo) WriteDB() *guildBoxesDo {
|
||
return g.Clauses(dbresolver.Write)
|
||
}
|
||
|
||
func (g guildBoxesDo) Session(config *gorm.Session) *guildBoxesDo {
|
||
return g.withDO(g.DO.Session(config))
|
||
}
|
||
|
||
func (g guildBoxesDo) Clauses(conds ...clause.Expression) *guildBoxesDo {
|
||
return g.withDO(g.DO.Clauses(conds...))
|
||
}
|
||
|
||
func (g guildBoxesDo) Returning(value interface{}, columns ...string) *guildBoxesDo {
|
||
return g.withDO(g.DO.Returning(value, columns...))
|
||
}
|
||
|
||
func (g guildBoxesDo) Not(conds ...gen.Condition) *guildBoxesDo {
|
||
return g.withDO(g.DO.Not(conds...))
|
||
}
|
||
|
||
func (g guildBoxesDo) Or(conds ...gen.Condition) *guildBoxesDo {
|
||
return g.withDO(g.DO.Or(conds...))
|
||
}
|
||
|
||
func (g guildBoxesDo) Select(conds ...field.Expr) *guildBoxesDo {
|
||
return g.withDO(g.DO.Select(conds...))
|
||
}
|
||
|
||
func (g guildBoxesDo) Where(conds ...gen.Condition) *guildBoxesDo {
|
||
return g.withDO(g.DO.Where(conds...))
|
||
}
|
||
|
||
func (g guildBoxesDo) Order(conds ...field.Expr) *guildBoxesDo {
|
||
return g.withDO(g.DO.Order(conds...))
|
||
}
|
||
|
||
func (g guildBoxesDo) Distinct(cols ...field.Expr) *guildBoxesDo {
|
||
return g.withDO(g.DO.Distinct(cols...))
|
||
}
|
||
|
||
func (g guildBoxesDo) Omit(cols ...field.Expr) *guildBoxesDo {
|
||
return g.withDO(g.DO.Omit(cols...))
|
||
}
|
||
|
||
func (g guildBoxesDo) Join(table schema.Tabler, on ...field.Expr) *guildBoxesDo {
|
||
return g.withDO(g.DO.Join(table, on...))
|
||
}
|
||
|
||
func (g guildBoxesDo) LeftJoin(table schema.Tabler, on ...field.Expr) *guildBoxesDo {
|
||
return g.withDO(g.DO.LeftJoin(table, on...))
|
||
}
|
||
|
||
func (g guildBoxesDo) RightJoin(table schema.Tabler, on ...field.Expr) *guildBoxesDo {
|
||
return g.withDO(g.DO.RightJoin(table, on...))
|
||
}
|
||
|
||
func (g guildBoxesDo) Group(cols ...field.Expr) *guildBoxesDo {
|
||
return g.withDO(g.DO.Group(cols...))
|
||
}
|
||
|
||
func (g guildBoxesDo) Having(conds ...gen.Condition) *guildBoxesDo {
|
||
return g.withDO(g.DO.Having(conds...))
|
||
}
|
||
|
||
func (g guildBoxesDo) Limit(limit int) *guildBoxesDo {
|
||
return g.withDO(g.DO.Limit(limit))
|
||
}
|
||
|
||
func (g guildBoxesDo) Offset(offset int) *guildBoxesDo {
|
||
return g.withDO(g.DO.Offset(offset))
|
||
}
|
||
|
||
func (g guildBoxesDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *guildBoxesDo {
|
||
return g.withDO(g.DO.Scopes(funcs...))
|
||
}
|
||
|
||
func (g guildBoxesDo) Unscoped() *guildBoxesDo {
|
||
return g.withDO(g.DO.Unscoped())
|
||
}
|
||
|
||
func (g guildBoxesDo) Create(values ...*model.GuildBoxes) error {
|
||
if len(values) == 0 {
|
||
return nil
|
||
}
|
||
return g.DO.Create(values)
|
||
}
|
||
|
||
func (g guildBoxesDo) CreateInBatches(values []*model.GuildBoxes, batchSize int) error {
|
||
return g.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 (g guildBoxesDo) Save(values ...*model.GuildBoxes) error {
|
||
if len(values) == 0 {
|
||
return nil
|
||
}
|
||
return g.DO.Save(values)
|
||
}
|
||
|
||
func (g guildBoxesDo) First() (*model.GuildBoxes, error) {
|
||
if result, err := g.DO.First(); err != nil {
|
||
return nil, err
|
||
} else {
|
||
return result.(*model.GuildBoxes), nil
|
||
}
|
||
}
|
||
|
||
func (g guildBoxesDo) Take() (*model.GuildBoxes, error) {
|
||
if result, err := g.DO.Take(); err != nil {
|
||
return nil, err
|
||
} else {
|
||
return result.(*model.GuildBoxes), nil
|
||
}
|
||
}
|
||
|
||
func (g guildBoxesDo) Last() (*model.GuildBoxes, error) {
|
||
if result, err := g.DO.Last(); err != nil {
|
||
return nil, err
|
||
} else {
|
||
return result.(*model.GuildBoxes), nil
|
||
}
|
||
}
|
||
|
||
func (g guildBoxesDo) Find() ([]*model.GuildBoxes, error) {
|
||
result, err := g.DO.Find()
|
||
return result.([]*model.GuildBoxes), err
|
||
}
|
||
|
||
func (g guildBoxesDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.GuildBoxes, err error) {
|
||
buf := make([]*model.GuildBoxes, 0, batchSize)
|
||
err = g.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 (g guildBoxesDo) FindInBatches(result *[]*model.GuildBoxes, batchSize int, fc func(tx gen.Dao, batch int) error) error {
|
||
return g.DO.FindInBatches(result, batchSize, fc)
|
||
}
|
||
|
||
func (g guildBoxesDo) Attrs(attrs ...field.AssignExpr) *guildBoxesDo {
|
||
return g.withDO(g.DO.Attrs(attrs...))
|
||
}
|
||
|
||
func (g guildBoxesDo) Assign(attrs ...field.AssignExpr) *guildBoxesDo {
|
||
return g.withDO(g.DO.Assign(attrs...))
|
||
}
|
||
|
||
func (g guildBoxesDo) Joins(fields ...field.RelationField) *guildBoxesDo {
|
||
for _, _f := range fields {
|
||
g = *g.withDO(g.DO.Joins(_f))
|
||
}
|
||
return &g
|
||
}
|
||
|
||
func (g guildBoxesDo) Preload(fields ...field.RelationField) *guildBoxesDo {
|
||
for _, _f := range fields {
|
||
g = *g.withDO(g.DO.Preload(_f))
|
||
}
|
||
return &g
|
||
}
|
||
|
||
func (g guildBoxesDo) FirstOrInit() (*model.GuildBoxes, error) {
|
||
if result, err := g.DO.FirstOrInit(); err != nil {
|
||
return nil, err
|
||
} else {
|
||
return result.(*model.GuildBoxes), nil
|
||
}
|
||
}
|
||
|
||
func (g guildBoxesDo) FirstOrCreate() (*model.GuildBoxes, error) {
|
||
if result, err := g.DO.FirstOrCreate(); err != nil {
|
||
return nil, err
|
||
} else {
|
||
return result.(*model.GuildBoxes), nil
|
||
}
|
||
}
|
||
|
||
func (g guildBoxesDo) FindByPage(offset int, limit int) (result []*model.GuildBoxes, count int64, err error) {
|
||
result, err = g.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 = g.Offset(-1).Limit(-1).Count()
|
||
return
|
||
}
|
||
|
||
func (g guildBoxesDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
|
||
count, err = g.Count()
|
||
if err != nil {
|
||
return
|
||
}
|
||
|
||
err = g.Offset(offset).Limit(limit).Scan(result)
|
||
return
|
||
}
|
||
|
||
func (g guildBoxesDo) Scan(result interface{}) (err error) {
|
||
return g.DO.Scan(result)
|
||
}
|
||
|
||
func (g guildBoxesDo) Delete(models ...*model.GuildBoxes) (result gen.ResultInfo, err error) {
|
||
return g.DO.Delete(models)
|
||
}
|
||
|
||
func (g *guildBoxesDo) withDO(do gen.Dao) *guildBoxesDo {
|
||
g.DO = *do.(*gen.DO)
|
||
return g
|
||
}
|