🚧 developing...
This commit is contained in:
@@ -119,6 +119,7 @@ func main() {
|
||||
scaStorageShare := g.GenerateModel("sca_storage_share", fieldOpts...)
|
||||
scaStorageShareVisit := g.GenerateModel("sca_storage_share_visit", fieldOpts...)
|
||||
scaStorageExtra := g.GenerateModel("sca_storage_extra", fieldOpts...)
|
||||
scaStorageImgBed := g.GenerateModel("sca_storage_img_bed", fieldOpts...)
|
||||
|
||||
g.ApplyBasic(
|
||||
scaAuthMenu,
|
||||
@@ -141,6 +142,7 @@ func main() {
|
||||
scaStorageShare,
|
||||
scaStorageShareVisit,
|
||||
scaStorageExtra,
|
||||
scaStorageImgBed,
|
||||
)
|
||||
|
||||
g.Execute()
|
||||
|
36
app/auth/model/mysql/model/sca_storage_img_bed.gen.go
Normal file
36
app/auth/model/mysql/model/sca_storage_img_bed.gen.go
Normal file
@@ -0,0 +1,36 @@
|
||||
// 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 model
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
const TableNameScaStorageImgBed = "sca_storage_img_bed"
|
||||
|
||||
// ScaStorageImgBed mapped from table <sca_storage_img_bed>
|
||||
type ScaStorageImgBed struct {
|
||||
ID int64 `gorm:"column:id;type:bigint(20);primaryKey;autoIncrement:true;comment:主键;primary_key" json:"id,string"` // 主键
|
||||
UserID string `gorm:"column:user_id;type:varchar(50);comment:用户ID" json:"user_id"` // 用户ID
|
||||
Provider string `gorm:"column:provider;type:varchar(50);comment:供应商" json:"provider"` // 供应商
|
||||
Bucket string `gorm:"column:bucket;type:varchar(100);comment:存储桶" json:"bucket"` // 存储桶
|
||||
Path string `gorm:"column:path;type:text;comment:路径" json:"path"` // 路径
|
||||
ThumbPath string `gorm:"column:thumb_path;type:text;comment:缩略图路径" json:"thumb_path"` // 缩略图路径
|
||||
FileName string `gorm:"column:file_name;type:varchar(100);comment:文件名称" json:"file_name"` // 文件名称
|
||||
FileSize int64 `gorm:"column:file_size;type:bigint(20);comment:文件大小" json:"file_size"` // 文件大小
|
||||
FileType string `gorm:"column:file_type;type:varchar(50);comment:文件类型" json:"file_type"` // 文件类型
|
||||
Width float64 `gorm:"column:width;type:double;comment:宽" json:"width"` // 宽
|
||||
Height float64 `gorm:"column:height;type:double;comment:高" json:"height"` // 高
|
||||
CreatedAt time.Time `gorm:"column:created_at;type:timestamp;autoCreateTime;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt time.Time `gorm:"column:updated_at;type:timestamp;autoUpdateTime;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:timestamp;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
}
|
||||
|
||||
// TableName ScaStorageImgBed's table name
|
||||
func (*ScaStorageImgBed) TableName() string {
|
||||
return TableNameScaStorageImgBed
|
||||
}
|
@@ -29,6 +29,7 @@ var (
|
||||
ScaStorageAlbum *scaStorageAlbum
|
||||
ScaStorageConfig *scaStorageConfig
|
||||
ScaStorageExtra *scaStorageExtra
|
||||
ScaStorageImgBed *scaStorageImgBed
|
||||
ScaStorageInfo *scaStorageInfo
|
||||
ScaStorageLocation *scaStorageLocation
|
||||
ScaStorageShare *scaStorageShare
|
||||
@@ -53,6 +54,7 @@ func SetDefault(db *gorm.DB, opts ...gen.DOOption) {
|
||||
ScaStorageAlbum = &Q.ScaStorageAlbum
|
||||
ScaStorageConfig = &Q.ScaStorageConfig
|
||||
ScaStorageExtra = &Q.ScaStorageExtra
|
||||
ScaStorageImgBed = &Q.ScaStorageImgBed
|
||||
ScaStorageInfo = &Q.ScaStorageInfo
|
||||
ScaStorageLocation = &Q.ScaStorageLocation
|
||||
ScaStorageShare = &Q.ScaStorageShare
|
||||
@@ -78,6 +80,7 @@ func Use(db *gorm.DB, opts ...gen.DOOption) *Query {
|
||||
ScaStorageAlbum: newScaStorageAlbum(db, opts...),
|
||||
ScaStorageConfig: newScaStorageConfig(db, opts...),
|
||||
ScaStorageExtra: newScaStorageExtra(db, opts...),
|
||||
ScaStorageImgBed: newScaStorageImgBed(db, opts...),
|
||||
ScaStorageInfo: newScaStorageInfo(db, opts...),
|
||||
ScaStorageLocation: newScaStorageLocation(db, opts...),
|
||||
ScaStorageShare: newScaStorageShare(db, opts...),
|
||||
@@ -104,6 +107,7 @@ type Query struct {
|
||||
ScaStorageAlbum scaStorageAlbum
|
||||
ScaStorageConfig scaStorageConfig
|
||||
ScaStorageExtra scaStorageExtra
|
||||
ScaStorageImgBed scaStorageImgBed
|
||||
ScaStorageInfo scaStorageInfo
|
||||
ScaStorageLocation scaStorageLocation
|
||||
ScaStorageShare scaStorageShare
|
||||
@@ -131,6 +135,7 @@ func (q *Query) clone(db *gorm.DB) *Query {
|
||||
ScaStorageAlbum: q.ScaStorageAlbum.clone(db),
|
||||
ScaStorageConfig: q.ScaStorageConfig.clone(db),
|
||||
ScaStorageExtra: q.ScaStorageExtra.clone(db),
|
||||
ScaStorageImgBed: q.ScaStorageImgBed.clone(db),
|
||||
ScaStorageInfo: q.ScaStorageInfo.clone(db),
|
||||
ScaStorageLocation: q.ScaStorageLocation.clone(db),
|
||||
ScaStorageShare: q.ScaStorageShare.clone(db),
|
||||
@@ -165,6 +170,7 @@ func (q *Query) ReplaceDB(db *gorm.DB) *Query {
|
||||
ScaStorageAlbum: q.ScaStorageAlbum.replaceDB(db),
|
||||
ScaStorageConfig: q.ScaStorageConfig.replaceDB(db),
|
||||
ScaStorageExtra: q.ScaStorageExtra.replaceDB(db),
|
||||
ScaStorageImgBed: q.ScaStorageImgBed.replaceDB(db),
|
||||
ScaStorageInfo: q.ScaStorageInfo.replaceDB(db),
|
||||
ScaStorageLocation: q.ScaStorageLocation.replaceDB(db),
|
||||
ScaStorageShare: q.ScaStorageShare.replaceDB(db),
|
||||
@@ -189,6 +195,7 @@ type queryCtx struct {
|
||||
ScaStorageAlbum IScaStorageAlbumDo
|
||||
ScaStorageConfig IScaStorageConfigDo
|
||||
ScaStorageExtra IScaStorageExtraDo
|
||||
ScaStorageImgBed IScaStorageImgBedDo
|
||||
ScaStorageInfo IScaStorageInfoDo
|
||||
ScaStorageLocation IScaStorageLocationDo
|
||||
ScaStorageShare IScaStorageShareDo
|
||||
@@ -213,6 +220,7 @@ func (q *Query) WithContext(ctx context.Context) *queryCtx {
|
||||
ScaStorageAlbum: q.ScaStorageAlbum.WithContext(ctx),
|
||||
ScaStorageConfig: q.ScaStorageConfig.WithContext(ctx),
|
||||
ScaStorageExtra: q.ScaStorageExtra.WithContext(ctx),
|
||||
ScaStorageImgBed: q.ScaStorageImgBed.WithContext(ctx),
|
||||
ScaStorageInfo: q.ScaStorageInfo.WithContext(ctx),
|
||||
ScaStorageLocation: q.ScaStorageLocation.WithContext(ctx),
|
||||
ScaStorageShare: q.ScaStorageShare.WithContext(ctx),
|
||||
|
432
app/auth/model/mysql/query/sca_storage_img_bed.gen.go
Normal file
432
app/auth/model/mysql/query/sca_storage_img_bed.gen.go
Normal file
@@ -0,0 +1,432 @@
|
||||
// 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"
|
||||
|
||||
"schisandra-album-cloud-microservices/app/auth/model/mysql/model"
|
||||
)
|
||||
|
||||
func newScaStorageImgBed(db *gorm.DB, opts ...gen.DOOption) scaStorageImgBed {
|
||||
_scaStorageImgBed := scaStorageImgBed{}
|
||||
|
||||
_scaStorageImgBed.scaStorageImgBedDo.UseDB(db, opts...)
|
||||
_scaStorageImgBed.scaStorageImgBedDo.UseModel(&model.ScaStorageImgBed{})
|
||||
|
||||
tableName := _scaStorageImgBed.scaStorageImgBedDo.TableName()
|
||||
_scaStorageImgBed.ALL = field.NewAsterisk(tableName)
|
||||
_scaStorageImgBed.ID = field.NewInt64(tableName, "id")
|
||||
_scaStorageImgBed.UserID = field.NewString(tableName, "user_id")
|
||||
_scaStorageImgBed.Provider = field.NewString(tableName, "provider")
|
||||
_scaStorageImgBed.Bucket = field.NewString(tableName, "bucket")
|
||||
_scaStorageImgBed.Path = field.NewString(tableName, "path")
|
||||
_scaStorageImgBed.ThumbPath = field.NewString(tableName, "thumb_path")
|
||||
_scaStorageImgBed.FileName = field.NewString(tableName, "file_name")
|
||||
_scaStorageImgBed.FileSize = field.NewInt64(tableName, "file_size")
|
||||
_scaStorageImgBed.FileType = field.NewString(tableName, "file_type")
|
||||
_scaStorageImgBed.Width = field.NewFloat64(tableName, "width")
|
||||
_scaStorageImgBed.Height = field.NewFloat64(tableName, "height")
|
||||
_scaStorageImgBed.CreatedAt = field.NewTime(tableName, "created_at")
|
||||
_scaStorageImgBed.UpdatedAt = field.NewTime(tableName, "updated_at")
|
||||
_scaStorageImgBed.DeletedAt = field.NewField(tableName, "deleted_at")
|
||||
|
||||
_scaStorageImgBed.fillFieldMap()
|
||||
|
||||
return _scaStorageImgBed
|
||||
}
|
||||
|
||||
type scaStorageImgBed struct {
|
||||
scaStorageImgBedDo
|
||||
|
||||
ALL field.Asterisk
|
||||
ID field.Int64 // 主键
|
||||
UserID field.String // 用户ID
|
||||
Provider field.String // 供应商
|
||||
Bucket field.String // 存储桶
|
||||
Path field.String // 路径
|
||||
ThumbPath field.String // 缩略图路径
|
||||
FileName field.String // 文件名称
|
||||
FileSize field.Int64 // 文件大小
|
||||
FileType field.String // 文件类型
|
||||
Width field.Float64 // 宽
|
||||
Height field.Float64 // 高
|
||||
CreatedAt field.Time // 创建时间
|
||||
UpdatedAt field.Time // 更新时间
|
||||
DeletedAt field.Field // 删除时间
|
||||
|
||||
fieldMap map[string]field.Expr
|
||||
}
|
||||
|
||||
func (s scaStorageImgBed) Table(newTableName string) *scaStorageImgBed {
|
||||
s.scaStorageImgBedDo.UseTable(newTableName)
|
||||
return s.updateTableName(newTableName)
|
||||
}
|
||||
|
||||
func (s scaStorageImgBed) As(alias string) *scaStorageImgBed {
|
||||
s.scaStorageImgBedDo.DO = *(s.scaStorageImgBedDo.As(alias).(*gen.DO))
|
||||
return s.updateTableName(alias)
|
||||
}
|
||||
|
||||
func (s *scaStorageImgBed) updateTableName(table string) *scaStorageImgBed {
|
||||
s.ALL = field.NewAsterisk(table)
|
||||
s.ID = field.NewInt64(table, "id")
|
||||
s.UserID = field.NewString(table, "user_id")
|
||||
s.Provider = field.NewString(table, "provider")
|
||||
s.Bucket = field.NewString(table, "bucket")
|
||||
s.Path = field.NewString(table, "path")
|
||||
s.ThumbPath = field.NewString(table, "thumb_path")
|
||||
s.FileName = field.NewString(table, "file_name")
|
||||
s.FileSize = field.NewInt64(table, "file_size")
|
||||
s.FileType = field.NewString(table, "file_type")
|
||||
s.Width = field.NewFloat64(table, "width")
|
||||
s.Height = field.NewFloat64(table, "height")
|
||||
s.CreatedAt = field.NewTime(table, "created_at")
|
||||
s.UpdatedAt = field.NewTime(table, "updated_at")
|
||||
s.DeletedAt = field.NewField(table, "deleted_at")
|
||||
|
||||
s.fillFieldMap()
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *scaStorageImgBed) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
||||
_f, ok := s.fieldMap[fieldName]
|
||||
if !ok || _f == nil {
|
||||
return nil, false
|
||||
}
|
||||
_oe, ok := _f.(field.OrderExpr)
|
||||
return _oe, ok
|
||||
}
|
||||
|
||||
func (s *scaStorageImgBed) fillFieldMap() {
|
||||
s.fieldMap = make(map[string]field.Expr, 14)
|
||||
s.fieldMap["id"] = s.ID
|
||||
s.fieldMap["user_id"] = s.UserID
|
||||
s.fieldMap["provider"] = s.Provider
|
||||
s.fieldMap["bucket"] = s.Bucket
|
||||
s.fieldMap["path"] = s.Path
|
||||
s.fieldMap["thumb_path"] = s.ThumbPath
|
||||
s.fieldMap["file_name"] = s.FileName
|
||||
s.fieldMap["file_size"] = s.FileSize
|
||||
s.fieldMap["file_type"] = s.FileType
|
||||
s.fieldMap["width"] = s.Width
|
||||
s.fieldMap["height"] = s.Height
|
||||
s.fieldMap["created_at"] = s.CreatedAt
|
||||
s.fieldMap["updated_at"] = s.UpdatedAt
|
||||
s.fieldMap["deleted_at"] = s.DeletedAt
|
||||
}
|
||||
|
||||
func (s scaStorageImgBed) clone(db *gorm.DB) scaStorageImgBed {
|
||||
s.scaStorageImgBedDo.ReplaceConnPool(db.Statement.ConnPool)
|
||||
return s
|
||||
}
|
||||
|
||||
func (s scaStorageImgBed) replaceDB(db *gorm.DB) scaStorageImgBed {
|
||||
s.scaStorageImgBedDo.ReplaceDB(db)
|
||||
return s
|
||||
}
|
||||
|
||||
type scaStorageImgBedDo struct{ gen.DO }
|
||||
|
||||
type IScaStorageImgBedDo interface {
|
||||
gen.SubQuery
|
||||
Debug() IScaStorageImgBedDo
|
||||
WithContext(ctx context.Context) IScaStorageImgBedDo
|
||||
WithResult(fc func(tx gen.Dao)) gen.ResultInfo
|
||||
ReplaceDB(db *gorm.DB)
|
||||
ReadDB() IScaStorageImgBedDo
|
||||
WriteDB() IScaStorageImgBedDo
|
||||
As(alias string) gen.Dao
|
||||
Session(config *gorm.Session) IScaStorageImgBedDo
|
||||
Columns(cols ...field.Expr) gen.Columns
|
||||
Clauses(conds ...clause.Expression) IScaStorageImgBedDo
|
||||
Not(conds ...gen.Condition) IScaStorageImgBedDo
|
||||
Or(conds ...gen.Condition) IScaStorageImgBedDo
|
||||
Select(conds ...field.Expr) IScaStorageImgBedDo
|
||||
Where(conds ...gen.Condition) IScaStorageImgBedDo
|
||||
Order(conds ...field.Expr) IScaStorageImgBedDo
|
||||
Distinct(cols ...field.Expr) IScaStorageImgBedDo
|
||||
Omit(cols ...field.Expr) IScaStorageImgBedDo
|
||||
Join(table schema.Tabler, on ...field.Expr) IScaStorageImgBedDo
|
||||
LeftJoin(table schema.Tabler, on ...field.Expr) IScaStorageImgBedDo
|
||||
RightJoin(table schema.Tabler, on ...field.Expr) IScaStorageImgBedDo
|
||||
Group(cols ...field.Expr) IScaStorageImgBedDo
|
||||
Having(conds ...gen.Condition) IScaStorageImgBedDo
|
||||
Limit(limit int) IScaStorageImgBedDo
|
||||
Offset(offset int) IScaStorageImgBedDo
|
||||
Count() (count int64, err error)
|
||||
Scopes(funcs ...func(gen.Dao) gen.Dao) IScaStorageImgBedDo
|
||||
Unscoped() IScaStorageImgBedDo
|
||||
Create(values ...*model.ScaStorageImgBed) error
|
||||
CreateInBatches(values []*model.ScaStorageImgBed, batchSize int) error
|
||||
Save(values ...*model.ScaStorageImgBed) error
|
||||
First() (*model.ScaStorageImgBed, error)
|
||||
Take() (*model.ScaStorageImgBed, error)
|
||||
Last() (*model.ScaStorageImgBed, error)
|
||||
Find() ([]*model.ScaStorageImgBed, error)
|
||||
FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ScaStorageImgBed, err error)
|
||||
FindInBatches(result *[]*model.ScaStorageImgBed, batchSize int, fc func(tx gen.Dao, batch int) error) error
|
||||
Pluck(column field.Expr, dest interface{}) error
|
||||
Delete(...*model.ScaStorageImgBed) (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) IScaStorageImgBedDo
|
||||
Assign(attrs ...field.AssignExpr) IScaStorageImgBedDo
|
||||
Joins(fields ...field.RelationField) IScaStorageImgBedDo
|
||||
Preload(fields ...field.RelationField) IScaStorageImgBedDo
|
||||
FirstOrInit() (*model.ScaStorageImgBed, error)
|
||||
FirstOrCreate() (*model.ScaStorageImgBed, error)
|
||||
FindByPage(offset int, limit int) (result []*model.ScaStorageImgBed, 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) IScaStorageImgBedDo
|
||||
UnderlyingDB() *gorm.DB
|
||||
schema.Tabler
|
||||
}
|
||||
|
||||
func (s scaStorageImgBedDo) Debug() IScaStorageImgBedDo {
|
||||
return s.withDO(s.DO.Debug())
|
||||
}
|
||||
|
||||
func (s scaStorageImgBedDo) WithContext(ctx context.Context) IScaStorageImgBedDo {
|
||||
return s.withDO(s.DO.WithContext(ctx))
|
||||
}
|
||||
|
||||
func (s scaStorageImgBedDo) ReadDB() IScaStorageImgBedDo {
|
||||
return s.Clauses(dbresolver.Read)
|
||||
}
|
||||
|
||||
func (s scaStorageImgBedDo) WriteDB() IScaStorageImgBedDo {
|
||||
return s.Clauses(dbresolver.Write)
|
||||
}
|
||||
|
||||
func (s scaStorageImgBedDo) Session(config *gorm.Session) IScaStorageImgBedDo {
|
||||
return s.withDO(s.DO.Session(config))
|
||||
}
|
||||
|
||||
func (s scaStorageImgBedDo) Clauses(conds ...clause.Expression) IScaStorageImgBedDo {
|
||||
return s.withDO(s.DO.Clauses(conds...))
|
||||
}
|
||||
|
||||
func (s scaStorageImgBedDo) Returning(value interface{}, columns ...string) IScaStorageImgBedDo {
|
||||
return s.withDO(s.DO.Returning(value, columns...))
|
||||
}
|
||||
|
||||
func (s scaStorageImgBedDo) Not(conds ...gen.Condition) IScaStorageImgBedDo {
|
||||
return s.withDO(s.DO.Not(conds...))
|
||||
}
|
||||
|
||||
func (s scaStorageImgBedDo) Or(conds ...gen.Condition) IScaStorageImgBedDo {
|
||||
return s.withDO(s.DO.Or(conds...))
|
||||
}
|
||||
|
||||
func (s scaStorageImgBedDo) Select(conds ...field.Expr) IScaStorageImgBedDo {
|
||||
return s.withDO(s.DO.Select(conds...))
|
||||
}
|
||||
|
||||
func (s scaStorageImgBedDo) Where(conds ...gen.Condition) IScaStorageImgBedDo {
|
||||
return s.withDO(s.DO.Where(conds...))
|
||||
}
|
||||
|
||||
func (s scaStorageImgBedDo) Order(conds ...field.Expr) IScaStorageImgBedDo {
|
||||
return s.withDO(s.DO.Order(conds...))
|
||||
}
|
||||
|
||||
func (s scaStorageImgBedDo) Distinct(cols ...field.Expr) IScaStorageImgBedDo {
|
||||
return s.withDO(s.DO.Distinct(cols...))
|
||||
}
|
||||
|
||||
func (s scaStorageImgBedDo) Omit(cols ...field.Expr) IScaStorageImgBedDo {
|
||||
return s.withDO(s.DO.Omit(cols...))
|
||||
}
|
||||
|
||||
func (s scaStorageImgBedDo) Join(table schema.Tabler, on ...field.Expr) IScaStorageImgBedDo {
|
||||
return s.withDO(s.DO.Join(table, on...))
|
||||
}
|
||||
|
||||
func (s scaStorageImgBedDo) LeftJoin(table schema.Tabler, on ...field.Expr) IScaStorageImgBedDo {
|
||||
return s.withDO(s.DO.LeftJoin(table, on...))
|
||||
}
|
||||
|
||||
func (s scaStorageImgBedDo) RightJoin(table schema.Tabler, on ...field.Expr) IScaStorageImgBedDo {
|
||||
return s.withDO(s.DO.RightJoin(table, on...))
|
||||
}
|
||||
|
||||
func (s scaStorageImgBedDo) Group(cols ...field.Expr) IScaStorageImgBedDo {
|
||||
return s.withDO(s.DO.Group(cols...))
|
||||
}
|
||||
|
||||
func (s scaStorageImgBedDo) Having(conds ...gen.Condition) IScaStorageImgBedDo {
|
||||
return s.withDO(s.DO.Having(conds...))
|
||||
}
|
||||
|
||||
func (s scaStorageImgBedDo) Limit(limit int) IScaStorageImgBedDo {
|
||||
return s.withDO(s.DO.Limit(limit))
|
||||
}
|
||||
|
||||
func (s scaStorageImgBedDo) Offset(offset int) IScaStorageImgBedDo {
|
||||
return s.withDO(s.DO.Offset(offset))
|
||||
}
|
||||
|
||||
func (s scaStorageImgBedDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IScaStorageImgBedDo {
|
||||
return s.withDO(s.DO.Scopes(funcs...))
|
||||
}
|
||||
|
||||
func (s scaStorageImgBedDo) Unscoped() IScaStorageImgBedDo {
|
||||
return s.withDO(s.DO.Unscoped())
|
||||
}
|
||||
|
||||
func (s scaStorageImgBedDo) Create(values ...*model.ScaStorageImgBed) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return s.DO.Create(values)
|
||||
}
|
||||
|
||||
func (s scaStorageImgBedDo) CreateInBatches(values []*model.ScaStorageImgBed, batchSize int) error {
|
||||
return s.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 (s scaStorageImgBedDo) Save(values ...*model.ScaStorageImgBed) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return s.DO.Save(values)
|
||||
}
|
||||
|
||||
func (s scaStorageImgBedDo) First() (*model.ScaStorageImgBed, error) {
|
||||
if result, err := s.DO.First(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaStorageImgBed), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaStorageImgBedDo) Take() (*model.ScaStorageImgBed, error) {
|
||||
if result, err := s.DO.Take(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaStorageImgBed), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaStorageImgBedDo) Last() (*model.ScaStorageImgBed, error) {
|
||||
if result, err := s.DO.Last(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaStorageImgBed), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaStorageImgBedDo) Find() ([]*model.ScaStorageImgBed, error) {
|
||||
result, err := s.DO.Find()
|
||||
return result.([]*model.ScaStorageImgBed), err
|
||||
}
|
||||
|
||||
func (s scaStorageImgBedDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ScaStorageImgBed, err error) {
|
||||
buf := make([]*model.ScaStorageImgBed, 0, batchSize)
|
||||
err = s.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 (s scaStorageImgBedDo) FindInBatches(result *[]*model.ScaStorageImgBed, batchSize int, fc func(tx gen.Dao, batch int) error) error {
|
||||
return s.DO.FindInBatches(result, batchSize, fc)
|
||||
}
|
||||
|
||||
func (s scaStorageImgBedDo) Attrs(attrs ...field.AssignExpr) IScaStorageImgBedDo {
|
||||
return s.withDO(s.DO.Attrs(attrs...))
|
||||
}
|
||||
|
||||
func (s scaStorageImgBedDo) Assign(attrs ...field.AssignExpr) IScaStorageImgBedDo {
|
||||
return s.withDO(s.DO.Assign(attrs...))
|
||||
}
|
||||
|
||||
func (s scaStorageImgBedDo) Joins(fields ...field.RelationField) IScaStorageImgBedDo {
|
||||
for _, _f := range fields {
|
||||
s = *s.withDO(s.DO.Joins(_f))
|
||||
}
|
||||
return &s
|
||||
}
|
||||
|
||||
func (s scaStorageImgBedDo) Preload(fields ...field.RelationField) IScaStorageImgBedDo {
|
||||
for _, _f := range fields {
|
||||
s = *s.withDO(s.DO.Preload(_f))
|
||||
}
|
||||
return &s
|
||||
}
|
||||
|
||||
func (s scaStorageImgBedDo) FirstOrInit() (*model.ScaStorageImgBed, error) {
|
||||
if result, err := s.DO.FirstOrInit(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaStorageImgBed), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaStorageImgBedDo) FirstOrCreate() (*model.ScaStorageImgBed, error) {
|
||||
if result, err := s.DO.FirstOrCreate(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaStorageImgBed), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaStorageImgBedDo) FindByPage(offset int, limit int) (result []*model.ScaStorageImgBed, count int64, err error) {
|
||||
result, err = s.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 = s.Offset(-1).Limit(-1).Count()
|
||||
return
|
||||
}
|
||||
|
||||
func (s scaStorageImgBedDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
|
||||
count, err = s.Count()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = s.Offset(offset).Limit(limit).Scan(result)
|
||||
return
|
||||
}
|
||||
|
||||
func (s scaStorageImgBedDo) Scan(result interface{}) (err error) {
|
||||
return s.DO.Scan(result)
|
||||
}
|
||||
|
||||
func (s scaStorageImgBedDo) Delete(models ...*model.ScaStorageImgBed) (result gen.ResultInfo, err error) {
|
||||
return s.DO.Delete(models)
|
||||
}
|
||||
|
||||
func (s *scaStorageImgBedDo) withDO(do gen.Dao) *scaStorageImgBedDo {
|
||||
s.DO = *do.(*gen.DO)
|
||||
return s
|
||||
}
|
Reference in New Issue
Block a user