✨ develop basic APIs / override reverse geolocation
This commit is contained in:
@@ -116,6 +116,7 @@ func main() {
|
||||
scaUserLevel := g.GenerateModel("sca_user_level", fieldOpts...)
|
||||
scaUserMessage := g.GenerateModel("sca_user_message", fieldOpts...)
|
||||
scaStorageAlbum := g.GenerateModel("sca_storage_album", fieldOpts...)
|
||||
scaStorageLocation := g.GenerateModel("sca_storage_location", fieldOpts...)
|
||||
|
||||
g.ApplyBasic(
|
||||
scaAuthMenu,
|
||||
@@ -135,6 +136,7 @@ func main() {
|
||||
scaUserLevel,
|
||||
scaUserMessage,
|
||||
scaStorageAlbum,
|
||||
scaStorageLocation,
|
||||
)
|
||||
|
||||
g.Execute()
|
||||
|
@@ -27,16 +27,15 @@ type ScaStorageInfo struct {
|
||||
Category string `gorm:"column:category;type:varchar(50);comment:分类" json:"category"` // 分类
|
||||
Tags string `gorm:"column:tags;type:varchar(255);comment:标签" json:"tags"` // 标签
|
||||
Type string `gorm:"column:type;type:varchar(50);comment:类型" json:"type"` // 类型
|
||||
Location string `gorm:"column:location;type:varchar(100);comment:地址" json:"location"` // 地址
|
||||
LocationID int64 `gorm:"column:location_id;type:bigint(20);comment:地址ID" json:"location_id"` // 地址ID
|
||||
Hash string `gorm:"column:hash;type:varchar(255);comment:哈希值" json:"hash"` // 哈希值
|
||||
Anime string `gorm:"column:anime;type:varchar(50);comment:是否是动漫图片" json:"anime"` // 是否是动漫图片
|
||||
FaceID int64 `gorm:"column:face_id;type:bigint(20);comment:人像ID" json:"face_id"` // 人像ID
|
||||
Landscape string `gorm:"column:landscape;type:varchar(50);comment:风景类型" json:"landscape"` // 风景类型
|
||||
OriginalTime string `gorm:"column:original_time;type:varchar(50);comment:拍摄时间" json:"original_time"` // 拍摄时间
|
||||
Gps string `gorm:"column:gps;type:varchar(255);comment:GPS" json:"gps"` // GPS
|
||||
Screenshot string `gorm:"column:screenshot;type:varchar(50);comment:是否是截图" json:"screenshot"` // 是否是截图
|
||||
Exif string `gorm:"column:exif;type:json;comment:exif 信息" json:"exif"` // exif 信息
|
||||
Show string `gorm:"column:show;type:varchar(50);comment:是否隐藏(0 不隐藏 1 隐藏)" json:"show"` // 是否隐藏(0 不隐藏 1 隐藏)
|
||||
ImgShow int64 `gorm:"column:img_show;type:tinyint(4);comment:是否隐藏(0 不隐藏 1 隐藏)" json:"img_show"` // 是否隐藏(0 不隐藏 1 隐藏)
|
||||
AlbumID int64 `gorm:"column:album_id;type:bigint(20);comment:相册ID" json:"album_id"` // 相册ID
|
||||
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"` // 更新时间
|
||||
|
35
app/auth/model/mysql/model/sca_storage_location.gen.go
Normal file
35
app/auth/model/mysql/model/sca_storage_location.gen.go
Normal file
@@ -0,0 +1,35 @@
|
||||
// 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"
|
||||
"gorm.io/plugin/optimisticlock"
|
||||
)
|
||||
|
||||
const TableNameScaStorageLocation = "sca_storage_location"
|
||||
|
||||
// ScaStorageLocation mapped from table <sca_storage_location>
|
||||
type ScaStorageLocation 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
|
||||
Country string `gorm:"column:country;type:varchar(100);comment:国家" json:"country"` // 国家
|
||||
Province string `gorm:"column:province;type:varchar(100);comment:省" json:"province"` // 省
|
||||
City string `gorm:"column:city;type:varchar(100);comment:城市" json:"city"` // 城市
|
||||
Latitude string `gorm:"column:latitude;type:varchar(50);comment:纬度" json:"latitude"` // 纬度
|
||||
Longitude string `gorm:"column:longitude;type:varchar(50);comment:经度" json:"longitude"` // 经度
|
||||
Total int64 `gorm:"column:total;type:bigint(20);comment:数量" json:"total"` // 数量
|
||||
Version optimisticlock.Version `gorm:"column:version;type:bigint(20);comment:版本" json:"version"` // 版本
|
||||
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 ScaStorageLocation's table name
|
||||
func (*ScaStorageLocation) TableName() string {
|
||||
return TableNameScaStorageLocation
|
||||
}
|
@@ -29,6 +29,7 @@ var (
|
||||
ScaStorageAlbum *scaStorageAlbum
|
||||
ScaStorageConfig *scaStorageConfig
|
||||
ScaStorageInfo *scaStorageInfo
|
||||
ScaStorageLocation *scaStorageLocation
|
||||
ScaStorageTag *scaStorageTag
|
||||
ScaStorageTagInfo *scaStorageTagInfo
|
||||
ScaUserFollow *scaUserFollow
|
||||
@@ -50,6 +51,7 @@ func SetDefault(db *gorm.DB, opts ...gen.DOOption) {
|
||||
ScaStorageAlbum = &Q.ScaStorageAlbum
|
||||
ScaStorageConfig = &Q.ScaStorageConfig
|
||||
ScaStorageInfo = &Q.ScaStorageInfo
|
||||
ScaStorageLocation = &Q.ScaStorageLocation
|
||||
ScaStorageTag = &Q.ScaStorageTag
|
||||
ScaStorageTagInfo = &Q.ScaStorageTagInfo
|
||||
ScaUserFollow = &Q.ScaUserFollow
|
||||
@@ -72,6 +74,7 @@ func Use(db *gorm.DB, opts ...gen.DOOption) *Query {
|
||||
ScaStorageAlbum: newScaStorageAlbum(db, opts...),
|
||||
ScaStorageConfig: newScaStorageConfig(db, opts...),
|
||||
ScaStorageInfo: newScaStorageInfo(db, opts...),
|
||||
ScaStorageLocation: newScaStorageLocation(db, opts...),
|
||||
ScaStorageTag: newScaStorageTag(db, opts...),
|
||||
ScaStorageTagInfo: newScaStorageTagInfo(db, opts...),
|
||||
ScaUserFollow: newScaUserFollow(db, opts...),
|
||||
@@ -95,6 +98,7 @@ type Query struct {
|
||||
ScaStorageAlbum scaStorageAlbum
|
||||
ScaStorageConfig scaStorageConfig
|
||||
ScaStorageInfo scaStorageInfo
|
||||
ScaStorageLocation scaStorageLocation
|
||||
ScaStorageTag scaStorageTag
|
||||
ScaStorageTagInfo scaStorageTagInfo
|
||||
ScaUserFollow scaUserFollow
|
||||
@@ -119,6 +123,7 @@ func (q *Query) clone(db *gorm.DB) *Query {
|
||||
ScaStorageAlbum: q.ScaStorageAlbum.clone(db),
|
||||
ScaStorageConfig: q.ScaStorageConfig.clone(db),
|
||||
ScaStorageInfo: q.ScaStorageInfo.clone(db),
|
||||
ScaStorageLocation: q.ScaStorageLocation.clone(db),
|
||||
ScaStorageTag: q.ScaStorageTag.clone(db),
|
||||
ScaStorageTagInfo: q.ScaStorageTagInfo.clone(db),
|
||||
ScaUserFollow: q.ScaUserFollow.clone(db),
|
||||
@@ -150,6 +155,7 @@ func (q *Query) ReplaceDB(db *gorm.DB) *Query {
|
||||
ScaStorageAlbum: q.ScaStorageAlbum.replaceDB(db),
|
||||
ScaStorageConfig: q.ScaStorageConfig.replaceDB(db),
|
||||
ScaStorageInfo: q.ScaStorageInfo.replaceDB(db),
|
||||
ScaStorageLocation: q.ScaStorageLocation.replaceDB(db),
|
||||
ScaStorageTag: q.ScaStorageTag.replaceDB(db),
|
||||
ScaStorageTagInfo: q.ScaStorageTagInfo.replaceDB(db),
|
||||
ScaUserFollow: q.ScaUserFollow.replaceDB(db),
|
||||
@@ -171,6 +177,7 @@ type queryCtx struct {
|
||||
ScaStorageAlbum IScaStorageAlbumDo
|
||||
ScaStorageConfig IScaStorageConfigDo
|
||||
ScaStorageInfo IScaStorageInfoDo
|
||||
ScaStorageLocation IScaStorageLocationDo
|
||||
ScaStorageTag IScaStorageTagDo
|
||||
ScaStorageTagInfo IScaStorageTagInfoDo
|
||||
ScaUserFollow IScaUserFollowDo
|
||||
@@ -192,6 +199,7 @@ func (q *Query) WithContext(ctx context.Context) *queryCtx {
|
||||
ScaStorageAlbum: q.ScaStorageAlbum.WithContext(ctx),
|
||||
ScaStorageConfig: q.ScaStorageConfig.WithContext(ctx),
|
||||
ScaStorageInfo: q.ScaStorageInfo.WithContext(ctx),
|
||||
ScaStorageLocation: q.ScaStorageLocation.WithContext(ctx),
|
||||
ScaStorageTag: q.ScaStorageTag.WithContext(ctx),
|
||||
ScaStorageTagInfo: q.ScaStorageTagInfo.WithContext(ctx),
|
||||
ScaUserFollow: q.ScaUserFollow.WithContext(ctx),
|
||||
|
@@ -40,16 +40,15 @@ func newScaStorageInfo(db *gorm.DB, opts ...gen.DOOption) scaStorageInfo {
|
||||
_scaStorageInfo.Category = field.NewString(tableName, "category")
|
||||
_scaStorageInfo.Tags = field.NewString(tableName, "tags")
|
||||
_scaStorageInfo.Type = field.NewString(tableName, "type")
|
||||
_scaStorageInfo.Location = field.NewString(tableName, "location")
|
||||
_scaStorageInfo.LocationID = field.NewInt64(tableName, "location_id")
|
||||
_scaStorageInfo.Hash = field.NewString(tableName, "hash")
|
||||
_scaStorageInfo.Anime = field.NewString(tableName, "anime")
|
||||
_scaStorageInfo.FaceID = field.NewInt64(tableName, "face_id")
|
||||
_scaStorageInfo.Landscape = field.NewString(tableName, "landscape")
|
||||
_scaStorageInfo.OriginalTime = field.NewString(tableName, "original_time")
|
||||
_scaStorageInfo.Gps = field.NewString(tableName, "gps")
|
||||
_scaStorageInfo.Screenshot = field.NewString(tableName, "screenshot")
|
||||
_scaStorageInfo.Exif = field.NewString(tableName, "exif")
|
||||
_scaStorageInfo.Show = field.NewString(tableName, "show")
|
||||
_scaStorageInfo.ImgShow = field.NewInt64(tableName, "img_show")
|
||||
_scaStorageInfo.AlbumID = field.NewInt64(tableName, "album_id")
|
||||
_scaStorageInfo.CreatedAt = field.NewTime(tableName, "created_at")
|
||||
_scaStorageInfo.UpdatedAt = field.NewTime(tableName, "updated_at")
|
||||
@@ -77,16 +76,15 @@ type scaStorageInfo struct {
|
||||
Category field.String // 分类
|
||||
Tags field.String // 标签
|
||||
Type field.String // 类型
|
||||
Location field.String // 地址
|
||||
LocationID field.Int64 // 地址ID
|
||||
Hash field.String // 哈希值
|
||||
Anime field.String // 是否是动漫图片
|
||||
FaceID field.Int64 // 人像ID
|
||||
Landscape field.String // 风景类型
|
||||
OriginalTime field.String // 拍摄时间
|
||||
Gps field.String // GPS
|
||||
Screenshot field.String // 是否是截图
|
||||
Exif field.String // exif 信息
|
||||
Show field.String // 是否隐藏(0 不隐藏 1 隐藏)
|
||||
ImgShow field.Int64 // 是否隐藏(0 不隐藏 1 隐藏)
|
||||
AlbumID field.Int64 // 相册ID
|
||||
CreatedAt field.Time // 创建时间
|
||||
UpdatedAt field.Time // 更新时间
|
||||
@@ -120,16 +118,15 @@ func (s *scaStorageInfo) updateTableName(table string) *scaStorageInfo {
|
||||
s.Category = field.NewString(table, "category")
|
||||
s.Tags = field.NewString(table, "tags")
|
||||
s.Type = field.NewString(table, "type")
|
||||
s.Location = field.NewString(table, "location")
|
||||
s.LocationID = field.NewInt64(table, "location_id")
|
||||
s.Hash = field.NewString(table, "hash")
|
||||
s.Anime = field.NewString(table, "anime")
|
||||
s.FaceID = field.NewInt64(table, "face_id")
|
||||
s.Landscape = field.NewString(table, "landscape")
|
||||
s.OriginalTime = field.NewString(table, "original_time")
|
||||
s.Gps = field.NewString(table, "gps")
|
||||
s.Screenshot = field.NewString(table, "screenshot")
|
||||
s.Exif = field.NewString(table, "exif")
|
||||
s.Show = field.NewString(table, "show")
|
||||
s.ImgShow = field.NewInt64(table, "img_show")
|
||||
s.AlbumID = field.NewInt64(table, "album_id")
|
||||
s.CreatedAt = field.NewTime(table, "created_at")
|
||||
s.UpdatedAt = field.NewTime(table, "updated_at")
|
||||
@@ -150,7 +147,7 @@ func (s *scaStorageInfo) GetFieldByName(fieldName string) (field.OrderExpr, bool
|
||||
}
|
||||
|
||||
func (s *scaStorageInfo) fillFieldMap() {
|
||||
s.fieldMap = make(map[string]field.Expr, 27)
|
||||
s.fieldMap = make(map[string]field.Expr, 26)
|
||||
s.fieldMap["id"] = s.ID
|
||||
s.fieldMap["user_id"] = s.UserID
|
||||
s.fieldMap["provider"] = s.Provider
|
||||
@@ -164,16 +161,15 @@ func (s *scaStorageInfo) fillFieldMap() {
|
||||
s.fieldMap["category"] = s.Category
|
||||
s.fieldMap["tags"] = s.Tags
|
||||
s.fieldMap["type"] = s.Type
|
||||
s.fieldMap["location"] = s.Location
|
||||
s.fieldMap["location_id"] = s.LocationID
|
||||
s.fieldMap["hash"] = s.Hash
|
||||
s.fieldMap["anime"] = s.Anime
|
||||
s.fieldMap["face_id"] = s.FaceID
|
||||
s.fieldMap["landscape"] = s.Landscape
|
||||
s.fieldMap["original_time"] = s.OriginalTime
|
||||
s.fieldMap["gps"] = s.Gps
|
||||
s.fieldMap["screenshot"] = s.Screenshot
|
||||
s.fieldMap["exif"] = s.Exif
|
||||
s.fieldMap["show"] = s.Show
|
||||
s.fieldMap["img_show"] = s.ImgShow
|
||||
s.fieldMap["album_id"] = s.AlbumID
|
||||
s.fieldMap["created_at"] = s.CreatedAt
|
||||
s.fieldMap["updated_at"] = s.UpdatedAt
|
||||
|
424
app/auth/model/mysql/query/sca_storage_location.gen.go
Normal file
424
app/auth/model/mysql/query/sca_storage_location.gen.go
Normal file
@@ -0,0 +1,424 @@
|
||||
// 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.Total = field.NewInt64(tableName, "total")
|
||||
_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
|
||||
}
|
||||
|
||||
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 // 经度
|
||||
Total field.Int64 // 数量
|
||||
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.Total = field.NewInt64(table, "total")
|
||||
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["total"] = s.Total
|
||||
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
|
||||
}
|
Reference in New Issue
Block a user