This commit is contained in:
parent
11e0059631
commit
b33f6c2af7
8 changed files with 3609 additions and 7 deletions
910
storage-new/dbgen/note_to_boosts.gen.go
Normal file
910
storage-new/dbgen/note_to_boosts.gen.go
Normal file
|
@ -0,0 +1,910 @@
|
|||
// 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 dbgen
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"git.mstar.dev/mstar/linstrom/storage-new/models"
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/clause"
|
||||
"gorm.io/gorm/schema"
|
||||
|
||||
"gorm.io/gen"
|
||||
"gorm.io/gen/field"
|
||||
|
||||
"gorm.io/plugin/dbresolver"
|
||||
)
|
||||
|
||||
func newNoteToBoost(db *gorm.DB, opts ...gen.DOOption) noteToBoost {
|
||||
_noteToBoost := noteToBoost{}
|
||||
|
||||
_noteToBoost.noteToBoostDo.UseDB(db, opts...)
|
||||
_noteToBoost.noteToBoostDo.UseModel(&models.NoteToBoost{})
|
||||
|
||||
tableName := _noteToBoost.noteToBoostDo.TableName()
|
||||
_noteToBoost.ALL = field.NewAsterisk(tableName)
|
||||
_noteToBoost.ID = field.NewUint(tableName, "id")
|
||||
_noteToBoost.CreatedAt = field.NewTime(tableName, "created_at")
|
||||
_noteToBoost.UserId = field.NewString(tableName, "user_id")
|
||||
_noteToBoost.NoteId = field.NewString(tableName, "note_id")
|
||||
_noteToBoost.User = noteToBoostBelongsToUser{
|
||||
db: db.Session(&gorm.Session{}),
|
||||
|
||||
RelationField: field.NewRelation("User", "models.User"),
|
||||
Icon: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Icon", "models.MediaMetadata"),
|
||||
},
|
||||
Background: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Background", "models.MediaMetadata"),
|
||||
},
|
||||
Banner: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Banner", "models.MediaMetadata"),
|
||||
},
|
||||
RemoteInfo: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.RemoteInfo", "models.UserRemoteLinks"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.RemoteInfo.User", "models.User"),
|
||||
},
|
||||
},
|
||||
InfoFields: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.InfoFields", "models.UserInfoField"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.InfoFields.User", "models.User"),
|
||||
},
|
||||
},
|
||||
BeingTypes: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.BeingTypes", "models.UserToBeing"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.BeingTypes.User", "models.User"),
|
||||
},
|
||||
},
|
||||
Tags: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Tags", "models.UserToTag"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Tags.User", "models.User"),
|
||||
},
|
||||
},
|
||||
Relations: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
TargetUser struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Relations", "models.UserToUserRelation"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Relations.User", "models.User"),
|
||||
},
|
||||
TargetUser: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Relations.TargetUser", "models.User"),
|
||||
},
|
||||
},
|
||||
Pronouns: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Pronouns", "models.UserToPronoun"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Pronouns.User", "models.User"),
|
||||
},
|
||||
},
|
||||
Roles: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
Role struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Roles", "models.UserToRole"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Roles.User", "models.User"),
|
||||
},
|
||||
Role: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.Roles.Role", "models.Role"),
|
||||
},
|
||||
},
|
||||
AuthMethods: struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("User.AuthMethods", "models.UserAuthMethod"),
|
||||
User: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("User.AuthMethods.User", "models.User"),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
_noteToBoost.Note = noteToBoostBelongsToNote{
|
||||
db: db.Session(&gorm.Session{}),
|
||||
|
||||
RelationField: field.NewRelation("Note", "models.Note"),
|
||||
Creator: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Creator", "models.User"),
|
||||
},
|
||||
AttachmentRelations: struct {
|
||||
field.RelationField
|
||||
Note struct {
|
||||
field.RelationField
|
||||
}
|
||||
Attachment struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.AttachmentRelations", "models.NoteToAttachment"),
|
||||
Note: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.AttachmentRelations.Note", "models.Note"),
|
||||
},
|
||||
Attachment: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.AttachmentRelations.Attachment", "models.MediaMetadata"),
|
||||
},
|
||||
},
|
||||
EmoteRelations: struct {
|
||||
field.RelationField
|
||||
Note struct {
|
||||
field.RelationField
|
||||
}
|
||||
Emote struct {
|
||||
field.RelationField
|
||||
Metadata struct {
|
||||
field.RelationField
|
||||
}
|
||||
Server struct {
|
||||
field.RelationField
|
||||
Icon struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.EmoteRelations", "models.NoteToEmote"),
|
||||
Note: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.EmoteRelations.Note", "models.Note"),
|
||||
},
|
||||
Emote: struct {
|
||||
field.RelationField
|
||||
Metadata struct {
|
||||
field.RelationField
|
||||
}
|
||||
Server struct {
|
||||
field.RelationField
|
||||
Icon struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.EmoteRelations.Emote", "models.Emote"),
|
||||
Metadata: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.EmoteRelations.Emote.Metadata", "models.MediaMetadata"),
|
||||
},
|
||||
Server: struct {
|
||||
field.RelationField
|
||||
Icon struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.EmoteRelations.Emote.Server", "models.RemoteServer"),
|
||||
Icon: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.EmoteRelations.Emote.Server.Icon", "models.MediaMetadata"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
PingRelations: struct {
|
||||
field.RelationField
|
||||
Note struct {
|
||||
field.RelationField
|
||||
}
|
||||
PingTarget struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.PingRelations", "models.NoteToPing"),
|
||||
Note: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.PingRelations.Note", "models.Note"),
|
||||
},
|
||||
PingTarget: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.PingRelations.PingTarget", "models.User"),
|
||||
},
|
||||
},
|
||||
Tags: struct {
|
||||
field.RelationField
|
||||
Note struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Tags", "models.NoteTag"),
|
||||
Note: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Tags.Note", "models.Note"),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
_noteToBoost.fillFieldMap()
|
||||
|
||||
return _noteToBoost
|
||||
}
|
||||
|
||||
type noteToBoost struct {
|
||||
noteToBoostDo
|
||||
|
||||
ALL field.Asterisk
|
||||
ID field.Uint
|
||||
CreatedAt field.Time
|
||||
UserId field.String
|
||||
NoteId field.String
|
||||
User noteToBoostBelongsToUser
|
||||
|
||||
Note noteToBoostBelongsToNote
|
||||
|
||||
fieldMap map[string]field.Expr
|
||||
}
|
||||
|
||||
func (n noteToBoost) Table(newTableName string) *noteToBoost {
|
||||
n.noteToBoostDo.UseTable(newTableName)
|
||||
return n.updateTableName(newTableName)
|
||||
}
|
||||
|
||||
func (n noteToBoost) As(alias string) *noteToBoost {
|
||||
n.noteToBoostDo.DO = *(n.noteToBoostDo.As(alias).(*gen.DO))
|
||||
return n.updateTableName(alias)
|
||||
}
|
||||
|
||||
func (n *noteToBoost) updateTableName(table string) *noteToBoost {
|
||||
n.ALL = field.NewAsterisk(table)
|
||||
n.ID = field.NewUint(table, "id")
|
||||
n.CreatedAt = field.NewTime(table, "created_at")
|
||||
n.UserId = field.NewString(table, "user_id")
|
||||
n.NoteId = field.NewString(table, "note_id")
|
||||
|
||||
n.fillFieldMap()
|
||||
|
||||
return n
|
||||
}
|
||||
|
||||
func (n *noteToBoost) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
||||
_f, ok := n.fieldMap[fieldName]
|
||||
if !ok || _f == nil {
|
||||
return nil, false
|
||||
}
|
||||
_oe, ok := _f.(field.OrderExpr)
|
||||
return _oe, ok
|
||||
}
|
||||
|
||||
func (n *noteToBoost) fillFieldMap() {
|
||||
n.fieldMap = make(map[string]field.Expr, 6)
|
||||
n.fieldMap["id"] = n.ID
|
||||
n.fieldMap["created_at"] = n.CreatedAt
|
||||
n.fieldMap["user_id"] = n.UserId
|
||||
n.fieldMap["note_id"] = n.NoteId
|
||||
|
||||
}
|
||||
|
||||
func (n noteToBoost) clone(db *gorm.DB) noteToBoost {
|
||||
n.noteToBoostDo.ReplaceConnPool(db.Statement.ConnPool)
|
||||
return n
|
||||
}
|
||||
|
||||
func (n noteToBoost) replaceDB(db *gorm.DB) noteToBoost {
|
||||
n.noteToBoostDo.ReplaceDB(db)
|
||||
return n
|
||||
}
|
||||
|
||||
type noteToBoostBelongsToUser struct {
|
||||
db *gorm.DB
|
||||
|
||||
field.RelationField
|
||||
|
||||
Icon struct {
|
||||
field.RelationField
|
||||
}
|
||||
Background struct {
|
||||
field.RelationField
|
||||
}
|
||||
Banner struct {
|
||||
field.RelationField
|
||||
}
|
||||
RemoteInfo struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
InfoFields struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
BeingTypes struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Tags struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Relations struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
TargetUser struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Pronouns struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Roles struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
Role struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
AuthMethods struct {
|
||||
field.RelationField
|
||||
User struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (a noteToBoostBelongsToUser) Where(conds ...field.Expr) *noteToBoostBelongsToUser {
|
||||
if len(conds) == 0 {
|
||||
return &a
|
||||
}
|
||||
|
||||
exprs := make([]clause.Expression, 0, len(conds))
|
||||
for _, cond := range conds {
|
||||
exprs = append(exprs, cond.BeCond().(clause.Expression))
|
||||
}
|
||||
a.db = a.db.Clauses(clause.Where{Exprs: exprs})
|
||||
return &a
|
||||
}
|
||||
|
||||
func (a noteToBoostBelongsToUser) WithContext(ctx context.Context) *noteToBoostBelongsToUser {
|
||||
a.db = a.db.WithContext(ctx)
|
||||
return &a
|
||||
}
|
||||
|
||||
func (a noteToBoostBelongsToUser) Session(session *gorm.Session) *noteToBoostBelongsToUser {
|
||||
a.db = a.db.Session(session)
|
||||
return &a
|
||||
}
|
||||
|
||||
func (a noteToBoostBelongsToUser) Model(m *models.NoteToBoost) *noteToBoostBelongsToUserTx {
|
||||
return ¬eToBoostBelongsToUserTx{a.db.Model(m).Association(a.Name())}
|
||||
}
|
||||
|
||||
type noteToBoostBelongsToUserTx struct{ tx *gorm.Association }
|
||||
|
||||
func (a noteToBoostBelongsToUserTx) Find() (result *models.User, err error) {
|
||||
return result, a.tx.Find(&result)
|
||||
}
|
||||
|
||||
func (a noteToBoostBelongsToUserTx) Append(values ...*models.User) (err error) {
|
||||
targetValues := make([]interface{}, len(values))
|
||||
for i, v := range values {
|
||||
targetValues[i] = v
|
||||
}
|
||||
return a.tx.Append(targetValues...)
|
||||
}
|
||||
|
||||
func (a noteToBoostBelongsToUserTx) Replace(values ...*models.User) (err error) {
|
||||
targetValues := make([]interface{}, len(values))
|
||||
for i, v := range values {
|
||||
targetValues[i] = v
|
||||
}
|
||||
return a.tx.Replace(targetValues...)
|
||||
}
|
||||
|
||||
func (a noteToBoostBelongsToUserTx) Delete(values ...*models.User) (err error) {
|
||||
targetValues := make([]interface{}, len(values))
|
||||
for i, v := range values {
|
||||
targetValues[i] = v
|
||||
}
|
||||
return a.tx.Delete(targetValues...)
|
||||
}
|
||||
|
||||
func (a noteToBoostBelongsToUserTx) Clear() error {
|
||||
return a.tx.Clear()
|
||||
}
|
||||
|
||||
func (a noteToBoostBelongsToUserTx) Count() int64 {
|
||||
return a.tx.Count()
|
||||
}
|
||||
|
||||
type noteToBoostBelongsToNote struct {
|
||||
db *gorm.DB
|
||||
|
||||
field.RelationField
|
||||
|
||||
Creator struct {
|
||||
field.RelationField
|
||||
}
|
||||
AttachmentRelations struct {
|
||||
field.RelationField
|
||||
Note struct {
|
||||
field.RelationField
|
||||
}
|
||||
Attachment struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
EmoteRelations struct {
|
||||
field.RelationField
|
||||
Note struct {
|
||||
field.RelationField
|
||||
}
|
||||
Emote struct {
|
||||
field.RelationField
|
||||
Metadata struct {
|
||||
field.RelationField
|
||||
}
|
||||
Server struct {
|
||||
field.RelationField
|
||||
Icon struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
PingRelations struct {
|
||||
field.RelationField
|
||||
Note struct {
|
||||
field.RelationField
|
||||
}
|
||||
PingTarget struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
Tags struct {
|
||||
field.RelationField
|
||||
Note struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (a noteToBoostBelongsToNote) Where(conds ...field.Expr) *noteToBoostBelongsToNote {
|
||||
if len(conds) == 0 {
|
||||
return &a
|
||||
}
|
||||
|
||||
exprs := make([]clause.Expression, 0, len(conds))
|
||||
for _, cond := range conds {
|
||||
exprs = append(exprs, cond.BeCond().(clause.Expression))
|
||||
}
|
||||
a.db = a.db.Clauses(clause.Where{Exprs: exprs})
|
||||
return &a
|
||||
}
|
||||
|
||||
func (a noteToBoostBelongsToNote) WithContext(ctx context.Context) *noteToBoostBelongsToNote {
|
||||
a.db = a.db.WithContext(ctx)
|
||||
return &a
|
||||
}
|
||||
|
||||
func (a noteToBoostBelongsToNote) Session(session *gorm.Session) *noteToBoostBelongsToNote {
|
||||
a.db = a.db.Session(session)
|
||||
return &a
|
||||
}
|
||||
|
||||
func (a noteToBoostBelongsToNote) Model(m *models.NoteToBoost) *noteToBoostBelongsToNoteTx {
|
||||
return ¬eToBoostBelongsToNoteTx{a.db.Model(m).Association(a.Name())}
|
||||
}
|
||||
|
||||
type noteToBoostBelongsToNoteTx struct{ tx *gorm.Association }
|
||||
|
||||
func (a noteToBoostBelongsToNoteTx) Find() (result *models.Note, err error) {
|
||||
return result, a.tx.Find(&result)
|
||||
}
|
||||
|
||||
func (a noteToBoostBelongsToNoteTx) Append(values ...*models.Note) (err error) {
|
||||
targetValues := make([]interface{}, len(values))
|
||||
for i, v := range values {
|
||||
targetValues[i] = v
|
||||
}
|
||||
return a.tx.Append(targetValues...)
|
||||
}
|
||||
|
||||
func (a noteToBoostBelongsToNoteTx) Replace(values ...*models.Note) (err error) {
|
||||
targetValues := make([]interface{}, len(values))
|
||||
for i, v := range values {
|
||||
targetValues[i] = v
|
||||
}
|
||||
return a.tx.Replace(targetValues...)
|
||||
}
|
||||
|
||||
func (a noteToBoostBelongsToNoteTx) Delete(values ...*models.Note) (err error) {
|
||||
targetValues := make([]interface{}, len(values))
|
||||
for i, v := range values {
|
||||
targetValues[i] = v
|
||||
}
|
||||
return a.tx.Delete(targetValues...)
|
||||
}
|
||||
|
||||
func (a noteToBoostBelongsToNoteTx) Clear() error {
|
||||
return a.tx.Clear()
|
||||
}
|
||||
|
||||
func (a noteToBoostBelongsToNoteTx) Count() int64 {
|
||||
return a.tx.Count()
|
||||
}
|
||||
|
||||
type noteToBoostDo struct{ gen.DO }
|
||||
|
||||
type INoteToBoostDo interface {
|
||||
gen.SubQuery
|
||||
Debug() INoteToBoostDo
|
||||
WithContext(ctx context.Context) INoteToBoostDo
|
||||
WithResult(fc func(tx gen.Dao)) gen.ResultInfo
|
||||
ReplaceDB(db *gorm.DB)
|
||||
ReadDB() INoteToBoostDo
|
||||
WriteDB() INoteToBoostDo
|
||||
As(alias string) gen.Dao
|
||||
Session(config *gorm.Session) INoteToBoostDo
|
||||
Columns(cols ...field.Expr) gen.Columns
|
||||
Clauses(conds ...clause.Expression) INoteToBoostDo
|
||||
Not(conds ...gen.Condition) INoteToBoostDo
|
||||
Or(conds ...gen.Condition) INoteToBoostDo
|
||||
Select(conds ...field.Expr) INoteToBoostDo
|
||||
Where(conds ...gen.Condition) INoteToBoostDo
|
||||
Order(conds ...field.Expr) INoteToBoostDo
|
||||
Distinct(cols ...field.Expr) INoteToBoostDo
|
||||
Omit(cols ...field.Expr) INoteToBoostDo
|
||||
Join(table schema.Tabler, on ...field.Expr) INoteToBoostDo
|
||||
LeftJoin(table schema.Tabler, on ...field.Expr) INoteToBoostDo
|
||||
RightJoin(table schema.Tabler, on ...field.Expr) INoteToBoostDo
|
||||
Group(cols ...field.Expr) INoteToBoostDo
|
||||
Having(conds ...gen.Condition) INoteToBoostDo
|
||||
Limit(limit int) INoteToBoostDo
|
||||
Offset(offset int) INoteToBoostDo
|
||||
Count() (count int64, err error)
|
||||
Scopes(funcs ...func(gen.Dao) gen.Dao) INoteToBoostDo
|
||||
Unscoped() INoteToBoostDo
|
||||
Create(values ...*models.NoteToBoost) error
|
||||
CreateInBatches(values []*models.NoteToBoost, batchSize int) error
|
||||
Save(values ...*models.NoteToBoost) error
|
||||
First() (*models.NoteToBoost, error)
|
||||
Take() (*models.NoteToBoost, error)
|
||||
Last() (*models.NoteToBoost, error)
|
||||
Find() ([]*models.NoteToBoost, error)
|
||||
FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.NoteToBoost, err error)
|
||||
FindInBatches(result *[]*models.NoteToBoost, batchSize int, fc func(tx gen.Dao, batch int) error) error
|
||||
Pluck(column field.Expr, dest interface{}) error
|
||||
Delete(...*models.NoteToBoost) (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) INoteToBoostDo
|
||||
Assign(attrs ...field.AssignExpr) INoteToBoostDo
|
||||
Joins(fields ...field.RelationField) INoteToBoostDo
|
||||
Preload(fields ...field.RelationField) INoteToBoostDo
|
||||
FirstOrInit() (*models.NoteToBoost, error)
|
||||
FirstOrCreate() (*models.NoteToBoost, error)
|
||||
FindByPage(offset int, limit int) (result []*models.NoteToBoost, 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) INoteToBoostDo
|
||||
UnderlyingDB() *gorm.DB
|
||||
schema.Tabler
|
||||
}
|
||||
|
||||
func (n noteToBoostDo) Debug() INoteToBoostDo {
|
||||
return n.withDO(n.DO.Debug())
|
||||
}
|
||||
|
||||
func (n noteToBoostDo) WithContext(ctx context.Context) INoteToBoostDo {
|
||||
return n.withDO(n.DO.WithContext(ctx))
|
||||
}
|
||||
|
||||
func (n noteToBoostDo) ReadDB() INoteToBoostDo {
|
||||
return n.Clauses(dbresolver.Read)
|
||||
}
|
||||
|
||||
func (n noteToBoostDo) WriteDB() INoteToBoostDo {
|
||||
return n.Clauses(dbresolver.Write)
|
||||
}
|
||||
|
||||
func (n noteToBoostDo) Session(config *gorm.Session) INoteToBoostDo {
|
||||
return n.withDO(n.DO.Session(config))
|
||||
}
|
||||
|
||||
func (n noteToBoostDo) Clauses(conds ...clause.Expression) INoteToBoostDo {
|
||||
return n.withDO(n.DO.Clauses(conds...))
|
||||
}
|
||||
|
||||
func (n noteToBoostDo) Returning(value interface{}, columns ...string) INoteToBoostDo {
|
||||
return n.withDO(n.DO.Returning(value, columns...))
|
||||
}
|
||||
|
||||
func (n noteToBoostDo) Not(conds ...gen.Condition) INoteToBoostDo {
|
||||
return n.withDO(n.DO.Not(conds...))
|
||||
}
|
||||
|
||||
func (n noteToBoostDo) Or(conds ...gen.Condition) INoteToBoostDo {
|
||||
return n.withDO(n.DO.Or(conds...))
|
||||
}
|
||||
|
||||
func (n noteToBoostDo) Select(conds ...field.Expr) INoteToBoostDo {
|
||||
return n.withDO(n.DO.Select(conds...))
|
||||
}
|
||||
|
||||
func (n noteToBoostDo) Where(conds ...gen.Condition) INoteToBoostDo {
|
||||
return n.withDO(n.DO.Where(conds...))
|
||||
}
|
||||
|
||||
func (n noteToBoostDo) Order(conds ...field.Expr) INoteToBoostDo {
|
||||
return n.withDO(n.DO.Order(conds...))
|
||||
}
|
||||
|
||||
func (n noteToBoostDo) Distinct(cols ...field.Expr) INoteToBoostDo {
|
||||
return n.withDO(n.DO.Distinct(cols...))
|
||||
}
|
||||
|
||||
func (n noteToBoostDo) Omit(cols ...field.Expr) INoteToBoostDo {
|
||||
return n.withDO(n.DO.Omit(cols...))
|
||||
}
|
||||
|
||||
func (n noteToBoostDo) Join(table schema.Tabler, on ...field.Expr) INoteToBoostDo {
|
||||
return n.withDO(n.DO.Join(table, on...))
|
||||
}
|
||||
|
||||
func (n noteToBoostDo) LeftJoin(table schema.Tabler, on ...field.Expr) INoteToBoostDo {
|
||||
return n.withDO(n.DO.LeftJoin(table, on...))
|
||||
}
|
||||
|
||||
func (n noteToBoostDo) RightJoin(table schema.Tabler, on ...field.Expr) INoteToBoostDo {
|
||||
return n.withDO(n.DO.RightJoin(table, on...))
|
||||
}
|
||||
|
||||
func (n noteToBoostDo) Group(cols ...field.Expr) INoteToBoostDo {
|
||||
return n.withDO(n.DO.Group(cols...))
|
||||
}
|
||||
|
||||
func (n noteToBoostDo) Having(conds ...gen.Condition) INoteToBoostDo {
|
||||
return n.withDO(n.DO.Having(conds...))
|
||||
}
|
||||
|
||||
func (n noteToBoostDo) Limit(limit int) INoteToBoostDo {
|
||||
return n.withDO(n.DO.Limit(limit))
|
||||
}
|
||||
|
||||
func (n noteToBoostDo) Offset(offset int) INoteToBoostDo {
|
||||
return n.withDO(n.DO.Offset(offset))
|
||||
}
|
||||
|
||||
func (n noteToBoostDo) Scopes(funcs ...func(gen.Dao) gen.Dao) INoteToBoostDo {
|
||||
return n.withDO(n.DO.Scopes(funcs...))
|
||||
}
|
||||
|
||||
func (n noteToBoostDo) Unscoped() INoteToBoostDo {
|
||||
return n.withDO(n.DO.Unscoped())
|
||||
}
|
||||
|
||||
func (n noteToBoostDo) Create(values ...*models.NoteToBoost) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return n.DO.Create(values)
|
||||
}
|
||||
|
||||
func (n noteToBoostDo) CreateInBatches(values []*models.NoteToBoost, batchSize int) error {
|
||||
return n.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 (n noteToBoostDo) Save(values ...*models.NoteToBoost) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return n.DO.Save(values)
|
||||
}
|
||||
|
||||
func (n noteToBoostDo) First() (*models.NoteToBoost, error) {
|
||||
if result, err := n.DO.First(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*models.NoteToBoost), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (n noteToBoostDo) Take() (*models.NoteToBoost, error) {
|
||||
if result, err := n.DO.Take(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*models.NoteToBoost), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (n noteToBoostDo) Last() (*models.NoteToBoost, error) {
|
||||
if result, err := n.DO.Last(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*models.NoteToBoost), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (n noteToBoostDo) Find() ([]*models.NoteToBoost, error) {
|
||||
result, err := n.DO.Find()
|
||||
return result.([]*models.NoteToBoost), err
|
||||
}
|
||||
|
||||
func (n noteToBoostDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.NoteToBoost, err error) {
|
||||
buf := make([]*models.NoteToBoost, 0, batchSize)
|
||||
err = n.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 (n noteToBoostDo) FindInBatches(result *[]*models.NoteToBoost, batchSize int, fc func(tx gen.Dao, batch int) error) error {
|
||||
return n.DO.FindInBatches(result, batchSize, fc)
|
||||
}
|
||||
|
||||
func (n noteToBoostDo) Attrs(attrs ...field.AssignExpr) INoteToBoostDo {
|
||||
return n.withDO(n.DO.Attrs(attrs...))
|
||||
}
|
||||
|
||||
func (n noteToBoostDo) Assign(attrs ...field.AssignExpr) INoteToBoostDo {
|
||||
return n.withDO(n.DO.Assign(attrs...))
|
||||
}
|
||||
|
||||
func (n noteToBoostDo) Joins(fields ...field.RelationField) INoteToBoostDo {
|
||||
for _, _f := range fields {
|
||||
n = *n.withDO(n.DO.Joins(_f))
|
||||
}
|
||||
return &n
|
||||
}
|
||||
|
||||
func (n noteToBoostDo) Preload(fields ...field.RelationField) INoteToBoostDo {
|
||||
for _, _f := range fields {
|
||||
n = *n.withDO(n.DO.Preload(_f))
|
||||
}
|
||||
return &n
|
||||
}
|
||||
|
||||
func (n noteToBoostDo) FirstOrInit() (*models.NoteToBoost, error) {
|
||||
if result, err := n.DO.FirstOrInit(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*models.NoteToBoost), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (n noteToBoostDo) FirstOrCreate() (*models.NoteToBoost, error) {
|
||||
if result, err := n.DO.FirstOrCreate(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*models.NoteToBoost), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (n noteToBoostDo) FindByPage(offset int, limit int) (result []*models.NoteToBoost, count int64, err error) {
|
||||
result, err = n.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 = n.Offset(-1).Limit(-1).Count()
|
||||
return
|
||||
}
|
||||
|
||||
func (n noteToBoostDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
|
||||
count, err = n.Count()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = n.Offset(offset).Limit(limit).Scan(result)
|
||||
return
|
||||
}
|
||||
|
||||
func (n noteToBoostDo) Scan(result interface{}) (err error) {
|
||||
return n.DO.Scan(result)
|
||||
}
|
||||
|
||||
func (n noteToBoostDo) Delete(models ...*models.NoteToBoost) (result gen.ResultInfo, err error) {
|
||||
return n.DO.Delete(models)
|
||||
}
|
||||
|
||||
func (n *noteToBoostDo) withDO(do gen.Dao) *noteToBoostDo {
|
||||
n.DO = *do.(*gen.DO)
|
||||
return n
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue