Files
schisandra-album-cloud-micr…/app/auth/model/mysql/query/sca_storage_location.gen.go

426 lines
14 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 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 newScaStorageLocation(db *gorm.DB, opts ...gen.DOOption) scaStorageLocation {
_scaStorageLocation := scaStorageLocation{}
_scaStorageLocation.scaStorageLocationDo.UseDB(db, opts...)
_scaStorageLocation.scaStorageLocationDo.UseModel(&model.ScaStorageLocation{})
tableName := _scaStorageLocation.scaStorageLocationDo.TableName()
_scaStorageLocation.ALL = field.NewAsterisk(tableName)
_scaStorageLocation.ID = field.NewInt64(tableName, "id")
_scaStorageLocation.UserID = field.NewString(tableName, "user_id")
_scaStorageLocation.Country = field.NewString(tableName, "country")
_scaStorageLocation.Province = field.NewString(tableName, "province")
_scaStorageLocation.City = field.NewString(tableName, "city")
_scaStorageLocation.Latitude = field.NewString(tableName, "latitude")
_scaStorageLocation.Longitude = field.NewString(tableName, "longitude")
_scaStorageLocation.CoverImage = field.NewString(tableName, "cover_image")
_scaStorageLocation.Version = field.NewField(tableName, "version")
_scaStorageLocation.CreatedAt = field.NewTime(tableName, "created_at")
_scaStorageLocation.UpdatedAt = field.NewTime(tableName, "updated_at")
_scaStorageLocation.DeletedAt = field.NewField(tableName, "deleted_at")
_scaStorageLocation.fillFieldMap()
return _scaStorageLocation
}
// scaStorageLocation 文件地理位置信息表
type scaStorageLocation struct {
scaStorageLocationDo
ALL field.Asterisk
ID field.Int64 // 主键
UserID field.String // 用户id
Country field.String // 国家
Province field.String // 省
City field.String // 城市
Latitude field.String // 纬度
Longitude field.String // 经度
CoverImage field.String // 封面图片
Version field.Field // 版本
CreatedAt field.Time // 创建时间
UpdatedAt field.Time // 更新时间
DeletedAt field.Field // 删除时间
fieldMap map[string]field.Expr
}
func (s scaStorageLocation) Table(newTableName string) *scaStorageLocation {
s.scaStorageLocationDo.UseTable(newTableName)
return s.updateTableName(newTableName)
}
func (s scaStorageLocation) As(alias string) *scaStorageLocation {
s.scaStorageLocationDo.DO = *(s.scaStorageLocationDo.As(alias).(*gen.DO))
return s.updateTableName(alias)
}
func (s *scaStorageLocation) updateTableName(table string) *scaStorageLocation {
s.ALL = field.NewAsterisk(table)
s.ID = field.NewInt64(table, "id")
s.UserID = field.NewString(table, "user_id")
s.Country = field.NewString(table, "country")
s.Province = field.NewString(table, "province")
s.City = field.NewString(table, "city")
s.Latitude = field.NewString(table, "latitude")
s.Longitude = field.NewString(table, "longitude")
s.CoverImage = field.NewString(table, "cover_image")
s.Version = field.NewField(table, "version")
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 *scaStorageLocation) 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 *scaStorageLocation) fillFieldMap() {
s.fieldMap = make(map[string]field.Expr, 12)
s.fieldMap["id"] = s.ID
s.fieldMap["user_id"] = s.UserID
s.fieldMap["country"] = s.Country
s.fieldMap["province"] = s.Province
s.fieldMap["city"] = s.City
s.fieldMap["latitude"] = s.Latitude
s.fieldMap["longitude"] = s.Longitude
s.fieldMap["cover_image"] = s.CoverImage
s.fieldMap["version"] = s.Version
s.fieldMap["created_at"] = s.CreatedAt
s.fieldMap["updated_at"] = s.UpdatedAt
s.fieldMap["deleted_at"] = s.DeletedAt
}
func (s scaStorageLocation) clone(db *gorm.DB) scaStorageLocation {
s.scaStorageLocationDo.ReplaceConnPool(db.Statement.ConnPool)
return s
}
func (s scaStorageLocation) replaceDB(db *gorm.DB) scaStorageLocation {
s.scaStorageLocationDo.ReplaceDB(db)
return s
}
type scaStorageLocationDo struct{ gen.DO }
type IScaStorageLocationDo interface {
gen.SubQuery
Debug() IScaStorageLocationDo
WithContext(ctx context.Context) IScaStorageLocationDo
WithResult(fc func(tx gen.Dao)) gen.ResultInfo
ReplaceDB(db *gorm.DB)
ReadDB() IScaStorageLocationDo
WriteDB() IScaStorageLocationDo
As(alias string) gen.Dao
Session(config *gorm.Session) IScaStorageLocationDo
Columns(cols ...field.Expr) gen.Columns
Clauses(conds ...clause.Expression) IScaStorageLocationDo
Not(conds ...gen.Condition) IScaStorageLocationDo
Or(conds ...gen.Condition) IScaStorageLocationDo
Select(conds ...field.Expr) IScaStorageLocationDo
Where(conds ...gen.Condition) IScaStorageLocationDo
Order(conds ...field.Expr) IScaStorageLocationDo
Distinct(cols ...field.Expr) IScaStorageLocationDo
Omit(cols ...field.Expr) IScaStorageLocationDo
Join(table schema.Tabler, on ...field.Expr) IScaStorageLocationDo
LeftJoin(table schema.Tabler, on ...field.Expr) IScaStorageLocationDo
RightJoin(table schema.Tabler, on ...field.Expr) IScaStorageLocationDo
Group(cols ...field.Expr) IScaStorageLocationDo
Having(conds ...gen.Condition) IScaStorageLocationDo
Limit(limit int) IScaStorageLocationDo
Offset(offset int) IScaStorageLocationDo
Count() (count int64, err error)
Scopes(funcs ...func(gen.Dao) gen.Dao) IScaStorageLocationDo
Unscoped() IScaStorageLocationDo
Create(values ...*model.ScaStorageLocation) error
CreateInBatches(values []*model.ScaStorageLocation, batchSize int) error
Save(values ...*model.ScaStorageLocation) error
First() (*model.ScaStorageLocation, error)
Take() (*model.ScaStorageLocation, error)
Last() (*model.ScaStorageLocation, error)
Find() ([]*model.ScaStorageLocation, error)
FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ScaStorageLocation, err error)
FindInBatches(result *[]*model.ScaStorageLocation, batchSize int, fc func(tx gen.Dao, batch int) error) error
Pluck(column field.Expr, dest interface{}) error
Delete(...*model.ScaStorageLocation) (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) IScaStorageLocationDo
Assign(attrs ...field.AssignExpr) IScaStorageLocationDo
Joins(fields ...field.RelationField) IScaStorageLocationDo
Preload(fields ...field.RelationField) IScaStorageLocationDo
FirstOrInit() (*model.ScaStorageLocation, error)
FirstOrCreate() (*model.ScaStorageLocation, error)
FindByPage(offset int, limit int) (result []*model.ScaStorageLocation, 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) IScaStorageLocationDo
UnderlyingDB() *gorm.DB
schema.Tabler
}
func (s scaStorageLocationDo) Debug() IScaStorageLocationDo {
return s.withDO(s.DO.Debug())
}
func (s scaStorageLocationDo) WithContext(ctx context.Context) IScaStorageLocationDo {
return s.withDO(s.DO.WithContext(ctx))
}
func (s scaStorageLocationDo) ReadDB() IScaStorageLocationDo {
return s.Clauses(dbresolver.Read)
}
func (s scaStorageLocationDo) WriteDB() IScaStorageLocationDo {
return s.Clauses(dbresolver.Write)
}
func (s scaStorageLocationDo) Session(config *gorm.Session) IScaStorageLocationDo {
return s.withDO(s.DO.Session(config))
}
func (s scaStorageLocationDo) Clauses(conds ...clause.Expression) IScaStorageLocationDo {
return s.withDO(s.DO.Clauses(conds...))
}
func (s scaStorageLocationDo) Returning(value interface{}, columns ...string) IScaStorageLocationDo {
return s.withDO(s.DO.Returning(value, columns...))
}
func (s scaStorageLocationDo) Not(conds ...gen.Condition) IScaStorageLocationDo {
return s.withDO(s.DO.Not(conds...))
}
func (s scaStorageLocationDo) Or(conds ...gen.Condition) IScaStorageLocationDo {
return s.withDO(s.DO.Or(conds...))
}
func (s scaStorageLocationDo) Select(conds ...field.Expr) IScaStorageLocationDo {
return s.withDO(s.DO.Select(conds...))
}
func (s scaStorageLocationDo) Where(conds ...gen.Condition) IScaStorageLocationDo {
return s.withDO(s.DO.Where(conds...))
}
func (s scaStorageLocationDo) Order(conds ...field.Expr) IScaStorageLocationDo {
return s.withDO(s.DO.Order(conds...))
}
func (s scaStorageLocationDo) Distinct(cols ...field.Expr) IScaStorageLocationDo {
return s.withDO(s.DO.Distinct(cols...))
}
func (s scaStorageLocationDo) Omit(cols ...field.Expr) IScaStorageLocationDo {
return s.withDO(s.DO.Omit(cols...))
}
func (s scaStorageLocationDo) Join(table schema.Tabler, on ...field.Expr) IScaStorageLocationDo {
return s.withDO(s.DO.Join(table, on...))
}
func (s scaStorageLocationDo) LeftJoin(table schema.Tabler, on ...field.Expr) IScaStorageLocationDo {
return s.withDO(s.DO.LeftJoin(table, on...))
}
func (s scaStorageLocationDo) RightJoin(table schema.Tabler, on ...field.Expr) IScaStorageLocationDo {
return s.withDO(s.DO.RightJoin(table, on...))
}
func (s scaStorageLocationDo) Group(cols ...field.Expr) IScaStorageLocationDo {
return s.withDO(s.DO.Group(cols...))
}
func (s scaStorageLocationDo) Having(conds ...gen.Condition) IScaStorageLocationDo {
return s.withDO(s.DO.Having(conds...))
}
func (s scaStorageLocationDo) Limit(limit int) IScaStorageLocationDo {
return s.withDO(s.DO.Limit(limit))
}
func (s scaStorageLocationDo) Offset(offset int) IScaStorageLocationDo {
return s.withDO(s.DO.Offset(offset))
}
func (s scaStorageLocationDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IScaStorageLocationDo {
return s.withDO(s.DO.Scopes(funcs...))
}
func (s scaStorageLocationDo) Unscoped() IScaStorageLocationDo {
return s.withDO(s.DO.Unscoped())
}
func (s scaStorageLocationDo) Create(values ...*model.ScaStorageLocation) error {
if len(values) == 0 {
return nil
}
return s.DO.Create(values)
}
func (s scaStorageLocationDo) CreateInBatches(values []*model.ScaStorageLocation, 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 scaStorageLocationDo) Save(values ...*model.ScaStorageLocation) error {
if len(values) == 0 {
return nil
}
return s.DO.Save(values)
}
func (s scaStorageLocationDo) First() (*model.ScaStorageLocation, error) {
if result, err := s.DO.First(); err != nil {
return nil, err
} else {
return result.(*model.ScaStorageLocation), nil
}
}
func (s scaStorageLocationDo) Take() (*model.ScaStorageLocation, error) {
if result, err := s.DO.Take(); err != nil {
return nil, err
} else {
return result.(*model.ScaStorageLocation), nil
}
}
func (s scaStorageLocationDo) Last() (*model.ScaStorageLocation, error) {
if result, err := s.DO.Last(); err != nil {
return nil, err
} else {
return result.(*model.ScaStorageLocation), nil
}
}
func (s scaStorageLocationDo) Find() ([]*model.ScaStorageLocation, error) {
result, err := s.DO.Find()
return result.([]*model.ScaStorageLocation), err
}
func (s scaStorageLocationDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ScaStorageLocation, err error) {
buf := make([]*model.ScaStorageLocation, 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 scaStorageLocationDo) FindInBatches(result *[]*model.ScaStorageLocation, batchSize int, fc func(tx gen.Dao, batch int) error) error {
return s.DO.FindInBatches(result, batchSize, fc)
}
func (s scaStorageLocationDo) Attrs(attrs ...field.AssignExpr) IScaStorageLocationDo {
return s.withDO(s.DO.Attrs(attrs...))
}
func (s scaStorageLocationDo) Assign(attrs ...field.AssignExpr) IScaStorageLocationDo {
return s.withDO(s.DO.Assign(attrs...))
}
func (s scaStorageLocationDo) Joins(fields ...field.RelationField) IScaStorageLocationDo {
for _, _f := range fields {
s = *s.withDO(s.DO.Joins(_f))
}
return &s
}
func (s scaStorageLocationDo) Preload(fields ...field.RelationField) IScaStorageLocationDo {
for _, _f := range fields {
s = *s.withDO(s.DO.Preload(_f))
}
return &s
}
func (s scaStorageLocationDo) FirstOrInit() (*model.ScaStorageLocation, error) {
if result, err := s.DO.FirstOrInit(); err != nil {
return nil, err
} else {
return result.(*model.ScaStorageLocation), nil
}
}
func (s scaStorageLocationDo) FirstOrCreate() (*model.ScaStorageLocation, error) {
if result, err := s.DO.FirstOrCreate(); err != nil {
return nil, err
} else {
return result.(*model.ScaStorageLocation), nil
}
}
func (s scaStorageLocationDo) FindByPage(offset int, limit int) (result []*model.ScaStorageLocation, 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 scaStorageLocationDo) 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 scaStorageLocationDo) Scan(result interface{}) (err error) {
return s.DO.Scan(result)
}
func (s scaStorageLocationDo) Delete(models ...*model.ScaStorageLocation) (result gen.ResultInfo, err error) {
return s.DO.Delete(models)
}
func (s *scaStorageLocationDo) withDO(do gen.Dao) *scaStorageLocationDo {
s.DO = *do.(*gen.DO)
return s
}