♻️ use minio instead of mongodb
This commit is contained in:
@@ -115,6 +115,7 @@ func main() {
|
||||
scaUserFollows := g.GenerateModel("sca_user_follows", fieldOpts...)
|
||||
scaUserLevel := g.GenerateModel("sca_user_level", fieldOpts...)
|
||||
scaUserMessage := g.GenerateModel("sca_user_message", fieldOpts...)
|
||||
scaStorageAlbum := g.GenerateModel("sca_storage_album", fieldOpts...)
|
||||
|
||||
g.ApplyBasic(
|
||||
scaAuthMenu,
|
||||
@@ -133,6 +134,7 @@ func main() {
|
||||
scaUserFollows,
|
||||
scaUserLevel,
|
||||
scaUserMessage,
|
||||
scaStorageAlbum,
|
||||
)
|
||||
|
||||
g.Execute()
|
||||
|
@@ -27,6 +27,7 @@ type ScaCommentReply struct {
|
||||
Author int64 `gorm:"column:author;type:tinyint(4);comment:评论回复是否作者 0否 1是" json:"author"` // 评论回复是否作者 0否 1是
|
||||
Likes int64 `gorm:"column:likes;type:bigint(20);comment:点赞数" json:"likes"` // 点赞数
|
||||
ReplyCount int64 `gorm:"column:reply_count;type:bigint(20);comment:回复数量" json:"reply_count"` // 回复数量
|
||||
ImagePath string `gorm:"column:image_path;type:text;comment:评论图片地址" json:"image_path"` // 评论图片地址
|
||||
Browser string `gorm:"column:browser;type:varchar(50);comment:浏览器" json:"browser"` // 浏览器
|
||||
OperatingSystem string `gorm:"column:operating_system;type:varchar(50);comment:操作系统" json:"operating_system"` // 操作系统
|
||||
CommentIP string `gorm:"column:comment_ip;type:varchar(50);comment:IP地址" json:"comment_ip"` // IP地址
|
||||
|
29
app/auth/model/mysql/model/sca_storage_album.gen.go
Normal file
29
app/auth/model/mysql/model/sca_storage_album.gen.go
Normal file
@@ -0,0 +1,29 @@
|
||||
// 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 TableNameScaStorageAlbum = "sca_storage_album"
|
||||
|
||||
// ScaStorageAlbum mapped from table <sca_storage_album>
|
||||
type ScaStorageAlbum 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
|
||||
AlbumName string `gorm:"column:album_name;type:varchar(50);comment:相册名称" json:"album_name"` // 相册名称
|
||||
AlbumType string `gorm:"column:album_type;type:varchar(50);comment:相册类型" json:"album_type"` // 相册类型
|
||||
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 ScaStorageAlbum's table name
|
||||
func (*ScaStorageAlbum) TableName() string {
|
||||
return TableNameScaStorageAlbum
|
||||
}
|
@@ -34,6 +34,8 @@ type ScaStorageInfo struct {
|
||||
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 信息
|
||||
Hide int64 `gorm:"column:hide;type:int(11) unsigned zerofill;comment:是否隐藏(0 不隐藏 1 隐藏)" json:"hide"` // 是否隐藏(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"` // 更新时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:timestamp;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
|
@@ -26,6 +26,7 @@ var (
|
||||
ScaCommentLike *scaCommentLike
|
||||
ScaCommentReply *scaCommentReply
|
||||
ScaMessageReport *scaMessageReport
|
||||
ScaStorageAlbum *scaStorageAlbum
|
||||
ScaStorageConfig *scaStorageConfig
|
||||
ScaStorageInfo *scaStorageInfo
|
||||
ScaStorageTag *scaStorageTag
|
||||
@@ -46,6 +47,7 @@ func SetDefault(db *gorm.DB, opts ...gen.DOOption) {
|
||||
ScaCommentLike = &Q.ScaCommentLike
|
||||
ScaCommentReply = &Q.ScaCommentReply
|
||||
ScaMessageReport = &Q.ScaMessageReport
|
||||
ScaStorageAlbum = &Q.ScaStorageAlbum
|
||||
ScaStorageConfig = &Q.ScaStorageConfig
|
||||
ScaStorageInfo = &Q.ScaStorageInfo
|
||||
ScaStorageTag = &Q.ScaStorageTag
|
||||
@@ -67,6 +69,7 @@ func Use(db *gorm.DB, opts ...gen.DOOption) *Query {
|
||||
ScaCommentLike: newScaCommentLike(db, opts...),
|
||||
ScaCommentReply: newScaCommentReply(db, opts...),
|
||||
ScaMessageReport: newScaMessageReport(db, opts...),
|
||||
ScaStorageAlbum: newScaStorageAlbum(db, opts...),
|
||||
ScaStorageConfig: newScaStorageConfig(db, opts...),
|
||||
ScaStorageInfo: newScaStorageInfo(db, opts...),
|
||||
ScaStorageTag: newScaStorageTag(db, opts...),
|
||||
@@ -89,6 +92,7 @@ type Query struct {
|
||||
ScaCommentLike scaCommentLike
|
||||
ScaCommentReply scaCommentReply
|
||||
ScaMessageReport scaMessageReport
|
||||
ScaStorageAlbum scaStorageAlbum
|
||||
ScaStorageConfig scaStorageConfig
|
||||
ScaStorageInfo scaStorageInfo
|
||||
ScaStorageTag scaStorageTag
|
||||
@@ -112,6 +116,7 @@ func (q *Query) clone(db *gorm.DB) *Query {
|
||||
ScaCommentLike: q.ScaCommentLike.clone(db),
|
||||
ScaCommentReply: q.ScaCommentReply.clone(db),
|
||||
ScaMessageReport: q.ScaMessageReport.clone(db),
|
||||
ScaStorageAlbum: q.ScaStorageAlbum.clone(db),
|
||||
ScaStorageConfig: q.ScaStorageConfig.clone(db),
|
||||
ScaStorageInfo: q.ScaStorageInfo.clone(db),
|
||||
ScaStorageTag: q.ScaStorageTag.clone(db),
|
||||
@@ -142,6 +147,7 @@ func (q *Query) ReplaceDB(db *gorm.DB) *Query {
|
||||
ScaCommentLike: q.ScaCommentLike.replaceDB(db),
|
||||
ScaCommentReply: q.ScaCommentReply.replaceDB(db),
|
||||
ScaMessageReport: q.ScaMessageReport.replaceDB(db),
|
||||
ScaStorageAlbum: q.ScaStorageAlbum.replaceDB(db),
|
||||
ScaStorageConfig: q.ScaStorageConfig.replaceDB(db),
|
||||
ScaStorageInfo: q.ScaStorageInfo.replaceDB(db),
|
||||
ScaStorageTag: q.ScaStorageTag.replaceDB(db),
|
||||
@@ -162,6 +168,7 @@ type queryCtx struct {
|
||||
ScaCommentLike IScaCommentLikeDo
|
||||
ScaCommentReply IScaCommentReplyDo
|
||||
ScaMessageReport IScaMessageReportDo
|
||||
ScaStorageAlbum IScaStorageAlbumDo
|
||||
ScaStorageConfig IScaStorageConfigDo
|
||||
ScaStorageInfo IScaStorageInfoDo
|
||||
ScaStorageTag IScaStorageTagDo
|
||||
@@ -182,6 +189,7 @@ func (q *Query) WithContext(ctx context.Context) *queryCtx {
|
||||
ScaCommentLike: q.ScaCommentLike.WithContext(ctx),
|
||||
ScaCommentReply: q.ScaCommentReply.WithContext(ctx),
|
||||
ScaMessageReport: q.ScaMessageReport.WithContext(ctx),
|
||||
ScaStorageAlbum: q.ScaStorageAlbum.WithContext(ctx),
|
||||
ScaStorageConfig: q.ScaStorageConfig.WithContext(ctx),
|
||||
ScaStorageInfo: q.ScaStorageInfo.WithContext(ctx),
|
||||
ScaStorageTag: q.ScaStorageTag.WithContext(ctx),
|
||||
|
@@ -39,6 +39,7 @@ func newScaCommentReply(db *gorm.DB, opts ...gen.DOOption) scaCommentReply {
|
||||
_scaCommentReply.Author = field.NewInt64(tableName, "author")
|
||||
_scaCommentReply.Likes = field.NewInt64(tableName, "likes")
|
||||
_scaCommentReply.ReplyCount = field.NewInt64(tableName, "reply_count")
|
||||
_scaCommentReply.ImagePath = field.NewString(tableName, "image_path")
|
||||
_scaCommentReply.Browser = field.NewString(tableName, "browser")
|
||||
_scaCommentReply.OperatingSystem = field.NewString(tableName, "operating_system")
|
||||
_scaCommentReply.CommentIP = field.NewString(tableName, "comment_ip")
|
||||
@@ -70,6 +71,7 @@ type scaCommentReply struct {
|
||||
Author field.Int64 // 评论回复是否作者 0否 1是
|
||||
Likes field.Int64 // 点赞数
|
||||
ReplyCount field.Int64 // 回复数量
|
||||
ImagePath field.String // 评论图片地址
|
||||
Browser field.String // 浏览器
|
||||
OperatingSystem field.String // 操作系统
|
||||
CommentIP field.String // IP地址
|
||||
@@ -107,6 +109,7 @@ func (s *scaCommentReply) updateTableName(table string) *scaCommentReply {
|
||||
s.Author = field.NewInt64(table, "author")
|
||||
s.Likes = field.NewInt64(table, "likes")
|
||||
s.ReplyCount = field.NewInt64(table, "reply_count")
|
||||
s.ImagePath = field.NewString(table, "image_path")
|
||||
s.Browser = field.NewString(table, "browser")
|
||||
s.OperatingSystem = field.NewString(table, "operating_system")
|
||||
s.CommentIP = field.NewString(table, "comment_ip")
|
||||
@@ -132,7 +135,7 @@ func (s *scaCommentReply) GetFieldByName(fieldName string) (field.OrderExpr, boo
|
||||
}
|
||||
|
||||
func (s *scaCommentReply) fillFieldMap() {
|
||||
s.fieldMap = make(map[string]field.Expr, 21)
|
||||
s.fieldMap = make(map[string]field.Expr, 22)
|
||||
s.fieldMap["id"] = s.ID
|
||||
s.fieldMap["user_id"] = s.UserID
|
||||
s.fieldMap["topic_id"] = s.TopicID
|
||||
@@ -145,6 +148,7 @@ func (s *scaCommentReply) fillFieldMap() {
|
||||
s.fieldMap["author"] = s.Author
|
||||
s.fieldMap["likes"] = s.Likes
|
||||
s.fieldMap["reply_count"] = s.ReplyCount
|
||||
s.fieldMap["image_path"] = s.ImagePath
|
||||
s.fieldMap["browser"] = s.Browser
|
||||
s.fieldMap["operating_system"] = s.OperatingSystem
|
||||
s.fieldMap["comment_ip"] = s.CommentIP
|
||||
|
404
app/auth/model/mysql/query/sca_storage_album.gen.go
Normal file
404
app/auth/model/mysql/query/sca_storage_album.gen.go
Normal file
@@ -0,0 +1,404 @@
|
||||
// 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 newScaStorageAlbum(db *gorm.DB, opts ...gen.DOOption) scaStorageAlbum {
|
||||
_scaStorageAlbum := scaStorageAlbum{}
|
||||
|
||||
_scaStorageAlbum.scaStorageAlbumDo.UseDB(db, opts...)
|
||||
_scaStorageAlbum.scaStorageAlbumDo.UseModel(&model.ScaStorageAlbum{})
|
||||
|
||||
tableName := _scaStorageAlbum.scaStorageAlbumDo.TableName()
|
||||
_scaStorageAlbum.ALL = field.NewAsterisk(tableName)
|
||||
_scaStorageAlbum.ID = field.NewInt64(tableName, "id")
|
||||
_scaStorageAlbum.UserID = field.NewString(tableName, "user_id")
|
||||
_scaStorageAlbum.AlbumName = field.NewString(tableName, "album_name")
|
||||
_scaStorageAlbum.AlbumType = field.NewString(tableName, "album_type")
|
||||
_scaStorageAlbum.CreatedAt = field.NewTime(tableName, "created_at")
|
||||
_scaStorageAlbum.UpdatedAt = field.NewTime(tableName, "updated_at")
|
||||
_scaStorageAlbum.DeletedAt = field.NewField(tableName, "deleted_at")
|
||||
|
||||
_scaStorageAlbum.fillFieldMap()
|
||||
|
||||
return _scaStorageAlbum
|
||||
}
|
||||
|
||||
type scaStorageAlbum struct {
|
||||
scaStorageAlbumDo
|
||||
|
||||
ALL field.Asterisk
|
||||
ID field.Int64 // 主键
|
||||
UserID field.String // 用户ID
|
||||
AlbumName field.String // 相册名称
|
||||
AlbumType field.String // 相册类型
|
||||
CreatedAt field.Time // 创建时间
|
||||
UpdatedAt field.Time // 更新时间
|
||||
DeletedAt field.Field // 删除时间
|
||||
|
||||
fieldMap map[string]field.Expr
|
||||
}
|
||||
|
||||
func (s scaStorageAlbum) Table(newTableName string) *scaStorageAlbum {
|
||||
s.scaStorageAlbumDo.UseTable(newTableName)
|
||||
return s.updateTableName(newTableName)
|
||||
}
|
||||
|
||||
func (s scaStorageAlbum) As(alias string) *scaStorageAlbum {
|
||||
s.scaStorageAlbumDo.DO = *(s.scaStorageAlbumDo.As(alias).(*gen.DO))
|
||||
return s.updateTableName(alias)
|
||||
}
|
||||
|
||||
func (s *scaStorageAlbum) updateTableName(table string) *scaStorageAlbum {
|
||||
s.ALL = field.NewAsterisk(table)
|
||||
s.ID = field.NewInt64(table, "id")
|
||||
s.UserID = field.NewString(table, "user_id")
|
||||
s.AlbumName = field.NewString(table, "album_name")
|
||||
s.AlbumType = field.NewString(table, "album_type")
|
||||
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 *scaStorageAlbum) 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 *scaStorageAlbum) fillFieldMap() {
|
||||
s.fieldMap = make(map[string]field.Expr, 7)
|
||||
s.fieldMap["id"] = s.ID
|
||||
s.fieldMap["user_id"] = s.UserID
|
||||
s.fieldMap["album_name"] = s.AlbumName
|
||||
s.fieldMap["album_type"] = s.AlbumType
|
||||
s.fieldMap["created_at"] = s.CreatedAt
|
||||
s.fieldMap["updated_at"] = s.UpdatedAt
|
||||
s.fieldMap["deleted_at"] = s.DeletedAt
|
||||
}
|
||||
|
||||
func (s scaStorageAlbum) clone(db *gorm.DB) scaStorageAlbum {
|
||||
s.scaStorageAlbumDo.ReplaceConnPool(db.Statement.ConnPool)
|
||||
return s
|
||||
}
|
||||
|
||||
func (s scaStorageAlbum) replaceDB(db *gorm.DB) scaStorageAlbum {
|
||||
s.scaStorageAlbumDo.ReplaceDB(db)
|
||||
return s
|
||||
}
|
||||
|
||||
type scaStorageAlbumDo struct{ gen.DO }
|
||||
|
||||
type IScaStorageAlbumDo interface {
|
||||
gen.SubQuery
|
||||
Debug() IScaStorageAlbumDo
|
||||
WithContext(ctx context.Context) IScaStorageAlbumDo
|
||||
WithResult(fc func(tx gen.Dao)) gen.ResultInfo
|
||||
ReplaceDB(db *gorm.DB)
|
||||
ReadDB() IScaStorageAlbumDo
|
||||
WriteDB() IScaStorageAlbumDo
|
||||
As(alias string) gen.Dao
|
||||
Session(config *gorm.Session) IScaStorageAlbumDo
|
||||
Columns(cols ...field.Expr) gen.Columns
|
||||
Clauses(conds ...clause.Expression) IScaStorageAlbumDo
|
||||
Not(conds ...gen.Condition) IScaStorageAlbumDo
|
||||
Or(conds ...gen.Condition) IScaStorageAlbumDo
|
||||
Select(conds ...field.Expr) IScaStorageAlbumDo
|
||||
Where(conds ...gen.Condition) IScaStorageAlbumDo
|
||||
Order(conds ...field.Expr) IScaStorageAlbumDo
|
||||
Distinct(cols ...field.Expr) IScaStorageAlbumDo
|
||||
Omit(cols ...field.Expr) IScaStorageAlbumDo
|
||||
Join(table schema.Tabler, on ...field.Expr) IScaStorageAlbumDo
|
||||
LeftJoin(table schema.Tabler, on ...field.Expr) IScaStorageAlbumDo
|
||||
RightJoin(table schema.Tabler, on ...field.Expr) IScaStorageAlbumDo
|
||||
Group(cols ...field.Expr) IScaStorageAlbumDo
|
||||
Having(conds ...gen.Condition) IScaStorageAlbumDo
|
||||
Limit(limit int) IScaStorageAlbumDo
|
||||
Offset(offset int) IScaStorageAlbumDo
|
||||
Count() (count int64, err error)
|
||||
Scopes(funcs ...func(gen.Dao) gen.Dao) IScaStorageAlbumDo
|
||||
Unscoped() IScaStorageAlbumDo
|
||||
Create(values ...*model.ScaStorageAlbum) error
|
||||
CreateInBatches(values []*model.ScaStorageAlbum, batchSize int) error
|
||||
Save(values ...*model.ScaStorageAlbum) error
|
||||
First() (*model.ScaStorageAlbum, error)
|
||||
Take() (*model.ScaStorageAlbum, error)
|
||||
Last() (*model.ScaStorageAlbum, error)
|
||||
Find() ([]*model.ScaStorageAlbum, error)
|
||||
FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ScaStorageAlbum, err error)
|
||||
FindInBatches(result *[]*model.ScaStorageAlbum, batchSize int, fc func(tx gen.Dao, batch int) error) error
|
||||
Pluck(column field.Expr, dest interface{}) error
|
||||
Delete(...*model.ScaStorageAlbum) (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) IScaStorageAlbumDo
|
||||
Assign(attrs ...field.AssignExpr) IScaStorageAlbumDo
|
||||
Joins(fields ...field.RelationField) IScaStorageAlbumDo
|
||||
Preload(fields ...field.RelationField) IScaStorageAlbumDo
|
||||
FirstOrInit() (*model.ScaStorageAlbum, error)
|
||||
FirstOrCreate() (*model.ScaStorageAlbum, error)
|
||||
FindByPage(offset int, limit int) (result []*model.ScaStorageAlbum, 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) IScaStorageAlbumDo
|
||||
UnderlyingDB() *gorm.DB
|
||||
schema.Tabler
|
||||
}
|
||||
|
||||
func (s scaStorageAlbumDo) Debug() IScaStorageAlbumDo {
|
||||
return s.withDO(s.DO.Debug())
|
||||
}
|
||||
|
||||
func (s scaStorageAlbumDo) WithContext(ctx context.Context) IScaStorageAlbumDo {
|
||||
return s.withDO(s.DO.WithContext(ctx))
|
||||
}
|
||||
|
||||
func (s scaStorageAlbumDo) ReadDB() IScaStorageAlbumDo {
|
||||
return s.Clauses(dbresolver.Read)
|
||||
}
|
||||
|
||||
func (s scaStorageAlbumDo) WriteDB() IScaStorageAlbumDo {
|
||||
return s.Clauses(dbresolver.Write)
|
||||
}
|
||||
|
||||
func (s scaStorageAlbumDo) Session(config *gorm.Session) IScaStorageAlbumDo {
|
||||
return s.withDO(s.DO.Session(config))
|
||||
}
|
||||
|
||||
func (s scaStorageAlbumDo) Clauses(conds ...clause.Expression) IScaStorageAlbumDo {
|
||||
return s.withDO(s.DO.Clauses(conds...))
|
||||
}
|
||||
|
||||
func (s scaStorageAlbumDo) Returning(value interface{}, columns ...string) IScaStorageAlbumDo {
|
||||
return s.withDO(s.DO.Returning(value, columns...))
|
||||
}
|
||||
|
||||
func (s scaStorageAlbumDo) Not(conds ...gen.Condition) IScaStorageAlbumDo {
|
||||
return s.withDO(s.DO.Not(conds...))
|
||||
}
|
||||
|
||||
func (s scaStorageAlbumDo) Or(conds ...gen.Condition) IScaStorageAlbumDo {
|
||||
return s.withDO(s.DO.Or(conds...))
|
||||
}
|
||||
|
||||
func (s scaStorageAlbumDo) Select(conds ...field.Expr) IScaStorageAlbumDo {
|
||||
return s.withDO(s.DO.Select(conds...))
|
||||
}
|
||||
|
||||
func (s scaStorageAlbumDo) Where(conds ...gen.Condition) IScaStorageAlbumDo {
|
||||
return s.withDO(s.DO.Where(conds...))
|
||||
}
|
||||
|
||||
func (s scaStorageAlbumDo) Order(conds ...field.Expr) IScaStorageAlbumDo {
|
||||
return s.withDO(s.DO.Order(conds...))
|
||||
}
|
||||
|
||||
func (s scaStorageAlbumDo) Distinct(cols ...field.Expr) IScaStorageAlbumDo {
|
||||
return s.withDO(s.DO.Distinct(cols...))
|
||||
}
|
||||
|
||||
func (s scaStorageAlbumDo) Omit(cols ...field.Expr) IScaStorageAlbumDo {
|
||||
return s.withDO(s.DO.Omit(cols...))
|
||||
}
|
||||
|
||||
func (s scaStorageAlbumDo) Join(table schema.Tabler, on ...field.Expr) IScaStorageAlbumDo {
|
||||
return s.withDO(s.DO.Join(table, on...))
|
||||
}
|
||||
|
||||
func (s scaStorageAlbumDo) LeftJoin(table schema.Tabler, on ...field.Expr) IScaStorageAlbumDo {
|
||||
return s.withDO(s.DO.LeftJoin(table, on...))
|
||||
}
|
||||
|
||||
func (s scaStorageAlbumDo) RightJoin(table schema.Tabler, on ...field.Expr) IScaStorageAlbumDo {
|
||||
return s.withDO(s.DO.RightJoin(table, on...))
|
||||
}
|
||||
|
||||
func (s scaStorageAlbumDo) Group(cols ...field.Expr) IScaStorageAlbumDo {
|
||||
return s.withDO(s.DO.Group(cols...))
|
||||
}
|
||||
|
||||
func (s scaStorageAlbumDo) Having(conds ...gen.Condition) IScaStorageAlbumDo {
|
||||
return s.withDO(s.DO.Having(conds...))
|
||||
}
|
||||
|
||||
func (s scaStorageAlbumDo) Limit(limit int) IScaStorageAlbumDo {
|
||||
return s.withDO(s.DO.Limit(limit))
|
||||
}
|
||||
|
||||
func (s scaStorageAlbumDo) Offset(offset int) IScaStorageAlbumDo {
|
||||
return s.withDO(s.DO.Offset(offset))
|
||||
}
|
||||
|
||||
func (s scaStorageAlbumDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IScaStorageAlbumDo {
|
||||
return s.withDO(s.DO.Scopes(funcs...))
|
||||
}
|
||||
|
||||
func (s scaStorageAlbumDo) Unscoped() IScaStorageAlbumDo {
|
||||
return s.withDO(s.DO.Unscoped())
|
||||
}
|
||||
|
||||
func (s scaStorageAlbumDo) Create(values ...*model.ScaStorageAlbum) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return s.DO.Create(values)
|
||||
}
|
||||
|
||||
func (s scaStorageAlbumDo) CreateInBatches(values []*model.ScaStorageAlbum, 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 scaStorageAlbumDo) Save(values ...*model.ScaStorageAlbum) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return s.DO.Save(values)
|
||||
}
|
||||
|
||||
func (s scaStorageAlbumDo) First() (*model.ScaStorageAlbum, error) {
|
||||
if result, err := s.DO.First(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaStorageAlbum), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaStorageAlbumDo) Take() (*model.ScaStorageAlbum, error) {
|
||||
if result, err := s.DO.Take(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaStorageAlbum), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaStorageAlbumDo) Last() (*model.ScaStorageAlbum, error) {
|
||||
if result, err := s.DO.Last(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaStorageAlbum), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaStorageAlbumDo) Find() ([]*model.ScaStorageAlbum, error) {
|
||||
result, err := s.DO.Find()
|
||||
return result.([]*model.ScaStorageAlbum), err
|
||||
}
|
||||
|
||||
func (s scaStorageAlbumDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ScaStorageAlbum, err error) {
|
||||
buf := make([]*model.ScaStorageAlbum, 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 scaStorageAlbumDo) FindInBatches(result *[]*model.ScaStorageAlbum, batchSize int, fc func(tx gen.Dao, batch int) error) error {
|
||||
return s.DO.FindInBatches(result, batchSize, fc)
|
||||
}
|
||||
|
||||
func (s scaStorageAlbumDo) Attrs(attrs ...field.AssignExpr) IScaStorageAlbumDo {
|
||||
return s.withDO(s.DO.Attrs(attrs...))
|
||||
}
|
||||
|
||||
func (s scaStorageAlbumDo) Assign(attrs ...field.AssignExpr) IScaStorageAlbumDo {
|
||||
return s.withDO(s.DO.Assign(attrs...))
|
||||
}
|
||||
|
||||
func (s scaStorageAlbumDo) Joins(fields ...field.RelationField) IScaStorageAlbumDo {
|
||||
for _, _f := range fields {
|
||||
s = *s.withDO(s.DO.Joins(_f))
|
||||
}
|
||||
return &s
|
||||
}
|
||||
|
||||
func (s scaStorageAlbumDo) Preload(fields ...field.RelationField) IScaStorageAlbumDo {
|
||||
for _, _f := range fields {
|
||||
s = *s.withDO(s.DO.Preload(_f))
|
||||
}
|
||||
return &s
|
||||
}
|
||||
|
||||
func (s scaStorageAlbumDo) FirstOrInit() (*model.ScaStorageAlbum, error) {
|
||||
if result, err := s.DO.FirstOrInit(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaStorageAlbum), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaStorageAlbumDo) FirstOrCreate() (*model.ScaStorageAlbum, error) {
|
||||
if result, err := s.DO.FirstOrCreate(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaStorageAlbum), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaStorageAlbumDo) FindByPage(offset int, limit int) (result []*model.ScaStorageAlbum, 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 scaStorageAlbumDo) 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 scaStorageAlbumDo) Scan(result interface{}) (err error) {
|
||||
return s.DO.Scan(result)
|
||||
}
|
||||
|
||||
func (s scaStorageAlbumDo) Delete(models ...*model.ScaStorageAlbum) (result gen.ResultInfo, err error) {
|
||||
return s.DO.Delete(models)
|
||||
}
|
||||
|
||||
func (s *scaStorageAlbumDo) withDO(do gen.Dao) *scaStorageAlbumDo {
|
||||
s.DO = *do.(*gen.DO)
|
||||
return s
|
||||
}
|
@@ -47,6 +47,8 @@ func newScaStorageInfo(db *gorm.DB, opts ...gen.DOOption) scaStorageInfo {
|
||||
_scaStorageInfo.Gps = field.NewString(tableName, "gps")
|
||||
_scaStorageInfo.Screenshot = field.NewString(tableName, "screenshot")
|
||||
_scaStorageInfo.Exif = field.NewString(tableName, "exif")
|
||||
_scaStorageInfo.Hide = field.NewInt64(tableName, "hide")
|
||||
_scaStorageInfo.AlbumID = field.NewInt64(tableName, "album_id")
|
||||
_scaStorageInfo.CreatedAt = field.NewTime(tableName, "created_at")
|
||||
_scaStorageInfo.UpdatedAt = field.NewTime(tableName, "updated_at")
|
||||
_scaStorageInfo.DeletedAt = field.NewField(tableName, "deleted_at")
|
||||
@@ -80,6 +82,8 @@ type scaStorageInfo struct {
|
||||
Gps field.String // GPS
|
||||
Screenshot field.String // 是否是截图
|
||||
Exif field.String // exif 信息
|
||||
Hide field.Int64 // 是否隐藏(0 不隐藏 1 隐藏)
|
||||
AlbumID field.Int64 // 相册ID
|
||||
CreatedAt field.Time // 创建时间
|
||||
UpdatedAt field.Time // 更新时间
|
||||
DeletedAt field.Field // 删除时间
|
||||
@@ -119,6 +123,8 @@ func (s *scaStorageInfo) updateTableName(table string) *scaStorageInfo {
|
||||
s.Gps = field.NewString(table, "gps")
|
||||
s.Screenshot = field.NewString(table, "screenshot")
|
||||
s.Exif = field.NewString(table, "exif")
|
||||
s.Hide = field.NewInt64(table, "hide")
|
||||
s.AlbumID = field.NewInt64(table, "album_id")
|
||||
s.CreatedAt = field.NewTime(table, "created_at")
|
||||
s.UpdatedAt = field.NewTime(table, "updated_at")
|
||||
s.DeletedAt = field.NewField(table, "deleted_at")
|
||||
@@ -138,7 +144,7 @@ func (s *scaStorageInfo) GetFieldByName(fieldName string) (field.OrderExpr, bool
|
||||
}
|
||||
|
||||
func (s *scaStorageInfo) fillFieldMap() {
|
||||
s.fieldMap = make(map[string]field.Expr, 23)
|
||||
s.fieldMap = make(map[string]field.Expr, 25)
|
||||
s.fieldMap["id"] = s.ID
|
||||
s.fieldMap["user_id"] = s.UserID
|
||||
s.fieldMap["provider"] = s.Provider
|
||||
@@ -159,6 +165,8 @@ func (s *scaStorageInfo) fillFieldMap() {
|
||||
s.fieldMap["gps"] = s.Gps
|
||||
s.fieldMap["screenshot"] = s.Screenshot
|
||||
s.fieldMap["exif"] = s.Exif
|
||||
s.fieldMap["hide"] = s.Hide
|
||||
s.fieldMap["album_id"] = s.AlbumID
|
||||
s.fieldMap["created_at"] = s.CreatedAt
|
||||
s.fieldMap["updated_at"] = s.UpdatedAt
|
||||
s.fieldMap["deleted_at"] = s.DeletedAt
|
||||
|
Reference in New Issue
Block a user