936 lines
23 KiB
Go
936 lines
23 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 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 newNoteToFeed(db *gorm.DB, opts ...gen.DOOption) noteToFeed {
|
|
_noteToFeed := noteToFeed{}
|
|
|
|
_noteToFeed.noteToFeedDo.UseDB(db, opts...)
|
|
_noteToFeed.noteToFeedDo.UseModel(&models.NoteToFeed{})
|
|
|
|
tableName := _noteToFeed.noteToFeedDo.TableName()
|
|
_noteToFeed.ALL = field.NewAsterisk(tableName)
|
|
_noteToFeed.ID = field.NewUint64(tableName, "id")
|
|
_noteToFeed.CreatedAt = field.NewTime(tableName, "created_at")
|
|
_noteToFeed.NoteId = field.NewString(tableName, "note_id")
|
|
_noteToFeed.Note = noteToFeedBelongsToNote{
|
|
db: db.Session(&gorm.Session{}),
|
|
|
|
RelationField: field.NewRelation("Note", "models.Note"),
|
|
Creator: struct {
|
|
field.RelationField
|
|
Server struct {
|
|
field.RelationField
|
|
Icon struct {
|
|
field.RelationField
|
|
}
|
|
Metadata struct {
|
|
field.RelationField
|
|
RemoteServer struct {
|
|
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
|
|
}
|
|
}
|
|
}{
|
|
RelationField: field.NewRelation("Note.Creator", "models.User"),
|
|
Server: struct {
|
|
field.RelationField
|
|
Icon struct {
|
|
field.RelationField
|
|
}
|
|
Metadata struct {
|
|
field.RelationField
|
|
RemoteServer struct {
|
|
field.RelationField
|
|
}
|
|
}
|
|
}{
|
|
RelationField: field.NewRelation("Note.Creator.Server", "models.RemoteServer"),
|
|
Icon: struct {
|
|
field.RelationField
|
|
}{
|
|
RelationField: field.NewRelation("Note.Creator.Server.Icon", "models.MediaMetadata"),
|
|
},
|
|
Metadata: struct {
|
|
field.RelationField
|
|
RemoteServer struct {
|
|
field.RelationField
|
|
}
|
|
}{
|
|
RelationField: field.NewRelation("Note.Creator.Server.Metadata", "models.RemoteServerMetadata"),
|
|
RemoteServer: struct {
|
|
field.RelationField
|
|
}{
|
|
RelationField: field.NewRelation("Note.Creator.Server.Metadata.RemoteServer", "models.RemoteServer"),
|
|
},
|
|
},
|
|
},
|
|
Icon: struct {
|
|
field.RelationField
|
|
}{
|
|
RelationField: field.NewRelation("Note.Creator.Icon", "models.MediaMetadata"),
|
|
},
|
|
Background: struct {
|
|
field.RelationField
|
|
}{
|
|
RelationField: field.NewRelation("Note.Creator.Background", "models.MediaMetadata"),
|
|
},
|
|
Banner: struct {
|
|
field.RelationField
|
|
}{
|
|
RelationField: field.NewRelation("Note.Creator.Banner", "models.MediaMetadata"),
|
|
},
|
|
RemoteInfo: struct {
|
|
field.RelationField
|
|
User struct {
|
|
field.RelationField
|
|
}
|
|
}{
|
|
RelationField: field.NewRelation("Note.Creator.RemoteInfo", "models.UserRemoteLinks"),
|
|
User: struct {
|
|
field.RelationField
|
|
}{
|
|
RelationField: field.NewRelation("Note.Creator.RemoteInfo.User", "models.User"),
|
|
},
|
|
},
|
|
InfoFields: struct {
|
|
field.RelationField
|
|
User struct {
|
|
field.RelationField
|
|
}
|
|
}{
|
|
RelationField: field.NewRelation("Note.Creator.InfoFields", "models.UserInfoField"),
|
|
User: struct {
|
|
field.RelationField
|
|
}{
|
|
RelationField: field.NewRelation("Note.Creator.InfoFields.User", "models.User"),
|
|
},
|
|
},
|
|
BeingTypes: struct {
|
|
field.RelationField
|
|
User struct {
|
|
field.RelationField
|
|
}
|
|
}{
|
|
RelationField: field.NewRelation("Note.Creator.BeingTypes", "models.UserToBeing"),
|
|
User: struct {
|
|
field.RelationField
|
|
}{
|
|
RelationField: field.NewRelation("Note.Creator.BeingTypes.User", "models.User"),
|
|
},
|
|
},
|
|
Tags: struct {
|
|
field.RelationField
|
|
User struct {
|
|
field.RelationField
|
|
}
|
|
}{
|
|
RelationField: field.NewRelation("Note.Creator.Tags", "models.UserToTag"),
|
|
User: struct {
|
|
field.RelationField
|
|
}{
|
|
RelationField: field.NewRelation("Note.Creator.Tags.User", "models.User"),
|
|
},
|
|
},
|
|
Relations: struct {
|
|
field.RelationField
|
|
User struct {
|
|
field.RelationField
|
|
}
|
|
TargetUser struct {
|
|
field.RelationField
|
|
}
|
|
}{
|
|
RelationField: field.NewRelation("Note.Creator.Relations", "models.UserToUserRelation"),
|
|
User: struct {
|
|
field.RelationField
|
|
}{
|
|
RelationField: field.NewRelation("Note.Creator.Relations.User", "models.User"),
|
|
},
|
|
TargetUser: struct {
|
|
field.RelationField
|
|
}{
|
|
RelationField: field.NewRelation("Note.Creator.Relations.TargetUser", "models.User"),
|
|
},
|
|
},
|
|
Pronouns: struct {
|
|
field.RelationField
|
|
User struct {
|
|
field.RelationField
|
|
}
|
|
}{
|
|
RelationField: field.NewRelation("Note.Creator.Pronouns", "models.UserToPronoun"),
|
|
User: struct {
|
|
field.RelationField
|
|
}{
|
|
RelationField: field.NewRelation("Note.Creator.Pronouns.User", "models.User"),
|
|
},
|
|
},
|
|
Roles: struct {
|
|
field.RelationField
|
|
User struct {
|
|
field.RelationField
|
|
}
|
|
Role struct {
|
|
field.RelationField
|
|
}
|
|
}{
|
|
RelationField: field.NewRelation("Note.Creator.Roles", "models.UserToRole"),
|
|
User: struct {
|
|
field.RelationField
|
|
}{
|
|
RelationField: field.NewRelation("Note.Creator.Roles.User", "models.User"),
|
|
},
|
|
Role: struct {
|
|
field.RelationField
|
|
}{
|
|
RelationField: field.NewRelation("Note.Creator.Roles.Role", "models.Role"),
|
|
},
|
|
},
|
|
AuthMethods: struct {
|
|
field.RelationField
|
|
User struct {
|
|
field.RelationField
|
|
}
|
|
}{
|
|
RelationField: field.NewRelation("Note.Creator.AuthMethods", "models.UserAuthMethod"),
|
|
User: struct {
|
|
field.RelationField
|
|
}{
|
|
RelationField: field.NewRelation("Note.Creator.AuthMethods.User", "models.User"),
|
|
},
|
|
},
|
|
},
|
|
Origin: struct {
|
|
field.RelationField
|
|
}{
|
|
RelationField: field.NewRelation("Note.Origin", "models.RemoteServer"),
|
|
},
|
|
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
|
|
}
|
|
}
|
|
}{
|
|
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
|
|
}
|
|
}{
|
|
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
|
|
}{
|
|
RelationField: field.NewRelation("Note.EmoteRelations.Emote.Server", "models.RemoteServer"),
|
|
},
|
|
},
|
|
},
|
|
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"),
|
|
},
|
|
},
|
|
}
|
|
|
|
_noteToFeed.fillFieldMap()
|
|
|
|
return _noteToFeed
|
|
}
|
|
|
|
type noteToFeed struct {
|
|
noteToFeedDo
|
|
|
|
ALL field.Asterisk
|
|
ID field.Uint64
|
|
CreatedAt field.Time
|
|
NoteId field.String
|
|
Note noteToFeedBelongsToNote
|
|
|
|
fieldMap map[string]field.Expr
|
|
}
|
|
|
|
func (n noteToFeed) Table(newTableName string) *noteToFeed {
|
|
n.noteToFeedDo.UseTable(newTableName)
|
|
return n.updateTableName(newTableName)
|
|
}
|
|
|
|
func (n noteToFeed) As(alias string) *noteToFeed {
|
|
n.noteToFeedDo.DO = *(n.noteToFeedDo.As(alias).(*gen.DO))
|
|
return n.updateTableName(alias)
|
|
}
|
|
|
|
func (n *noteToFeed) updateTableName(table string) *noteToFeed {
|
|
n.ALL = field.NewAsterisk(table)
|
|
n.ID = field.NewUint64(table, "id")
|
|
n.CreatedAt = field.NewTime(table, "created_at")
|
|
n.NoteId = field.NewString(table, "note_id")
|
|
|
|
n.fillFieldMap()
|
|
|
|
return n
|
|
}
|
|
|
|
func (n *noteToFeed) 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 *noteToFeed) fillFieldMap() {
|
|
n.fieldMap = make(map[string]field.Expr, 4)
|
|
n.fieldMap["id"] = n.ID
|
|
n.fieldMap["created_at"] = n.CreatedAt
|
|
n.fieldMap["note_id"] = n.NoteId
|
|
|
|
}
|
|
|
|
func (n noteToFeed) clone(db *gorm.DB) noteToFeed {
|
|
n.noteToFeedDo.ReplaceConnPool(db.Statement.ConnPool)
|
|
return n
|
|
}
|
|
|
|
func (n noteToFeed) replaceDB(db *gorm.DB) noteToFeed {
|
|
n.noteToFeedDo.ReplaceDB(db)
|
|
return n
|
|
}
|
|
|
|
type noteToFeedBelongsToNote struct {
|
|
db *gorm.DB
|
|
|
|
field.RelationField
|
|
|
|
Creator struct {
|
|
field.RelationField
|
|
Server struct {
|
|
field.RelationField
|
|
Icon struct {
|
|
field.RelationField
|
|
}
|
|
Metadata struct {
|
|
field.RelationField
|
|
RemoteServer struct {
|
|
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
|
|
}
|
|
}
|
|
}
|
|
Origin 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
|
|
}
|
|
}
|
|
}
|
|
PingRelations struct {
|
|
field.RelationField
|
|
Note struct {
|
|
field.RelationField
|
|
}
|
|
PingTarget struct {
|
|
field.RelationField
|
|
}
|
|
}
|
|
Tags struct {
|
|
field.RelationField
|
|
Note struct {
|
|
field.RelationField
|
|
}
|
|
}
|
|
}
|
|
|
|
func (a noteToFeedBelongsToNote) Where(conds ...field.Expr) *noteToFeedBelongsToNote {
|
|
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 noteToFeedBelongsToNote) WithContext(ctx context.Context) *noteToFeedBelongsToNote {
|
|
a.db = a.db.WithContext(ctx)
|
|
return &a
|
|
}
|
|
|
|
func (a noteToFeedBelongsToNote) Session(session *gorm.Session) *noteToFeedBelongsToNote {
|
|
a.db = a.db.Session(session)
|
|
return &a
|
|
}
|
|
|
|
func (a noteToFeedBelongsToNote) Model(m *models.NoteToFeed) *noteToFeedBelongsToNoteTx {
|
|
return ¬eToFeedBelongsToNoteTx{a.db.Model(m).Association(a.Name())}
|
|
}
|
|
|
|
type noteToFeedBelongsToNoteTx struct{ tx *gorm.Association }
|
|
|
|
func (a noteToFeedBelongsToNoteTx) Find() (result *models.Note, err error) {
|
|
return result, a.tx.Find(&result)
|
|
}
|
|
|
|
func (a noteToFeedBelongsToNoteTx) 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 noteToFeedBelongsToNoteTx) 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 noteToFeedBelongsToNoteTx) 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 noteToFeedBelongsToNoteTx) Clear() error {
|
|
return a.tx.Clear()
|
|
}
|
|
|
|
func (a noteToFeedBelongsToNoteTx) Count() int64 {
|
|
return a.tx.Count()
|
|
}
|
|
|
|
type noteToFeedDo struct{ gen.DO }
|
|
|
|
type INoteToFeedDo interface {
|
|
gen.SubQuery
|
|
Debug() INoteToFeedDo
|
|
WithContext(ctx context.Context) INoteToFeedDo
|
|
WithResult(fc func(tx gen.Dao)) gen.ResultInfo
|
|
ReplaceDB(db *gorm.DB)
|
|
ReadDB() INoteToFeedDo
|
|
WriteDB() INoteToFeedDo
|
|
As(alias string) gen.Dao
|
|
Session(config *gorm.Session) INoteToFeedDo
|
|
Columns(cols ...field.Expr) gen.Columns
|
|
Clauses(conds ...clause.Expression) INoteToFeedDo
|
|
Not(conds ...gen.Condition) INoteToFeedDo
|
|
Or(conds ...gen.Condition) INoteToFeedDo
|
|
Select(conds ...field.Expr) INoteToFeedDo
|
|
Where(conds ...gen.Condition) INoteToFeedDo
|
|
Order(conds ...field.Expr) INoteToFeedDo
|
|
Distinct(cols ...field.Expr) INoteToFeedDo
|
|
Omit(cols ...field.Expr) INoteToFeedDo
|
|
Join(table schema.Tabler, on ...field.Expr) INoteToFeedDo
|
|
LeftJoin(table schema.Tabler, on ...field.Expr) INoteToFeedDo
|
|
RightJoin(table schema.Tabler, on ...field.Expr) INoteToFeedDo
|
|
Group(cols ...field.Expr) INoteToFeedDo
|
|
Having(conds ...gen.Condition) INoteToFeedDo
|
|
Limit(limit int) INoteToFeedDo
|
|
Offset(offset int) INoteToFeedDo
|
|
Count() (count int64, err error)
|
|
Scopes(funcs ...func(gen.Dao) gen.Dao) INoteToFeedDo
|
|
Unscoped() INoteToFeedDo
|
|
Create(values ...*models.NoteToFeed) error
|
|
CreateInBatches(values []*models.NoteToFeed, batchSize int) error
|
|
Save(values ...*models.NoteToFeed) error
|
|
First() (*models.NoteToFeed, error)
|
|
Take() (*models.NoteToFeed, error)
|
|
Last() (*models.NoteToFeed, error)
|
|
Find() ([]*models.NoteToFeed, error)
|
|
FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.NoteToFeed, err error)
|
|
FindInBatches(result *[]*models.NoteToFeed, batchSize int, fc func(tx gen.Dao, batch int) error) error
|
|
Pluck(column field.Expr, dest interface{}) error
|
|
Delete(...*models.NoteToFeed) (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) INoteToFeedDo
|
|
Assign(attrs ...field.AssignExpr) INoteToFeedDo
|
|
Joins(fields ...field.RelationField) INoteToFeedDo
|
|
Preload(fields ...field.RelationField) INoteToFeedDo
|
|
FirstOrInit() (*models.NoteToFeed, error)
|
|
FirstOrCreate() (*models.NoteToFeed, error)
|
|
FindByPage(offset int, limit int) (result []*models.NoteToFeed, 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) INoteToFeedDo
|
|
UnderlyingDB() *gorm.DB
|
|
schema.Tabler
|
|
}
|
|
|
|
func (n noteToFeedDo) Debug() INoteToFeedDo {
|
|
return n.withDO(n.DO.Debug())
|
|
}
|
|
|
|
func (n noteToFeedDo) WithContext(ctx context.Context) INoteToFeedDo {
|
|
return n.withDO(n.DO.WithContext(ctx))
|
|
}
|
|
|
|
func (n noteToFeedDo) ReadDB() INoteToFeedDo {
|
|
return n.Clauses(dbresolver.Read)
|
|
}
|
|
|
|
func (n noteToFeedDo) WriteDB() INoteToFeedDo {
|
|
return n.Clauses(dbresolver.Write)
|
|
}
|
|
|
|
func (n noteToFeedDo) Session(config *gorm.Session) INoteToFeedDo {
|
|
return n.withDO(n.DO.Session(config))
|
|
}
|
|
|
|
func (n noteToFeedDo) Clauses(conds ...clause.Expression) INoteToFeedDo {
|
|
return n.withDO(n.DO.Clauses(conds...))
|
|
}
|
|
|
|
func (n noteToFeedDo) Returning(value interface{}, columns ...string) INoteToFeedDo {
|
|
return n.withDO(n.DO.Returning(value, columns...))
|
|
}
|
|
|
|
func (n noteToFeedDo) Not(conds ...gen.Condition) INoteToFeedDo {
|
|
return n.withDO(n.DO.Not(conds...))
|
|
}
|
|
|
|
func (n noteToFeedDo) Or(conds ...gen.Condition) INoteToFeedDo {
|
|
return n.withDO(n.DO.Or(conds...))
|
|
}
|
|
|
|
func (n noteToFeedDo) Select(conds ...field.Expr) INoteToFeedDo {
|
|
return n.withDO(n.DO.Select(conds...))
|
|
}
|
|
|
|
func (n noteToFeedDo) Where(conds ...gen.Condition) INoteToFeedDo {
|
|
return n.withDO(n.DO.Where(conds...))
|
|
}
|
|
|
|
func (n noteToFeedDo) Order(conds ...field.Expr) INoteToFeedDo {
|
|
return n.withDO(n.DO.Order(conds...))
|
|
}
|
|
|
|
func (n noteToFeedDo) Distinct(cols ...field.Expr) INoteToFeedDo {
|
|
return n.withDO(n.DO.Distinct(cols...))
|
|
}
|
|
|
|
func (n noteToFeedDo) Omit(cols ...field.Expr) INoteToFeedDo {
|
|
return n.withDO(n.DO.Omit(cols...))
|
|
}
|
|
|
|
func (n noteToFeedDo) Join(table schema.Tabler, on ...field.Expr) INoteToFeedDo {
|
|
return n.withDO(n.DO.Join(table, on...))
|
|
}
|
|
|
|
func (n noteToFeedDo) LeftJoin(table schema.Tabler, on ...field.Expr) INoteToFeedDo {
|
|
return n.withDO(n.DO.LeftJoin(table, on...))
|
|
}
|
|
|
|
func (n noteToFeedDo) RightJoin(table schema.Tabler, on ...field.Expr) INoteToFeedDo {
|
|
return n.withDO(n.DO.RightJoin(table, on...))
|
|
}
|
|
|
|
func (n noteToFeedDo) Group(cols ...field.Expr) INoteToFeedDo {
|
|
return n.withDO(n.DO.Group(cols...))
|
|
}
|
|
|
|
func (n noteToFeedDo) Having(conds ...gen.Condition) INoteToFeedDo {
|
|
return n.withDO(n.DO.Having(conds...))
|
|
}
|
|
|
|
func (n noteToFeedDo) Limit(limit int) INoteToFeedDo {
|
|
return n.withDO(n.DO.Limit(limit))
|
|
}
|
|
|
|
func (n noteToFeedDo) Offset(offset int) INoteToFeedDo {
|
|
return n.withDO(n.DO.Offset(offset))
|
|
}
|
|
|
|
func (n noteToFeedDo) Scopes(funcs ...func(gen.Dao) gen.Dao) INoteToFeedDo {
|
|
return n.withDO(n.DO.Scopes(funcs...))
|
|
}
|
|
|
|
func (n noteToFeedDo) Unscoped() INoteToFeedDo {
|
|
return n.withDO(n.DO.Unscoped())
|
|
}
|
|
|
|
func (n noteToFeedDo) Create(values ...*models.NoteToFeed) error {
|
|
if len(values) == 0 {
|
|
return nil
|
|
}
|
|
return n.DO.Create(values)
|
|
}
|
|
|
|
func (n noteToFeedDo) CreateInBatches(values []*models.NoteToFeed, 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 noteToFeedDo) Save(values ...*models.NoteToFeed) error {
|
|
if len(values) == 0 {
|
|
return nil
|
|
}
|
|
return n.DO.Save(values)
|
|
}
|
|
|
|
func (n noteToFeedDo) First() (*models.NoteToFeed, error) {
|
|
if result, err := n.DO.First(); err != nil {
|
|
return nil, err
|
|
} else {
|
|
return result.(*models.NoteToFeed), nil
|
|
}
|
|
}
|
|
|
|
func (n noteToFeedDo) Take() (*models.NoteToFeed, error) {
|
|
if result, err := n.DO.Take(); err != nil {
|
|
return nil, err
|
|
} else {
|
|
return result.(*models.NoteToFeed), nil
|
|
}
|
|
}
|
|
|
|
func (n noteToFeedDo) Last() (*models.NoteToFeed, error) {
|
|
if result, err := n.DO.Last(); err != nil {
|
|
return nil, err
|
|
} else {
|
|
return result.(*models.NoteToFeed), nil
|
|
}
|
|
}
|
|
|
|
func (n noteToFeedDo) Find() ([]*models.NoteToFeed, error) {
|
|
result, err := n.DO.Find()
|
|
return result.([]*models.NoteToFeed), err
|
|
}
|
|
|
|
func (n noteToFeedDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.NoteToFeed, err error) {
|
|
buf := make([]*models.NoteToFeed, 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 noteToFeedDo) FindInBatches(result *[]*models.NoteToFeed, batchSize int, fc func(tx gen.Dao, batch int) error) error {
|
|
return n.DO.FindInBatches(result, batchSize, fc)
|
|
}
|
|
|
|
func (n noteToFeedDo) Attrs(attrs ...field.AssignExpr) INoteToFeedDo {
|
|
return n.withDO(n.DO.Attrs(attrs...))
|
|
}
|
|
|
|
func (n noteToFeedDo) Assign(attrs ...field.AssignExpr) INoteToFeedDo {
|
|
return n.withDO(n.DO.Assign(attrs...))
|
|
}
|
|
|
|
func (n noteToFeedDo) Joins(fields ...field.RelationField) INoteToFeedDo {
|
|
for _, _f := range fields {
|
|
n = *n.withDO(n.DO.Joins(_f))
|
|
}
|
|
return &n
|
|
}
|
|
|
|
func (n noteToFeedDo) Preload(fields ...field.RelationField) INoteToFeedDo {
|
|
for _, _f := range fields {
|
|
n = *n.withDO(n.DO.Preload(_f))
|
|
}
|
|
return &n
|
|
}
|
|
|
|
func (n noteToFeedDo) FirstOrInit() (*models.NoteToFeed, error) {
|
|
if result, err := n.DO.FirstOrInit(); err != nil {
|
|
return nil, err
|
|
} else {
|
|
return result.(*models.NoteToFeed), nil
|
|
}
|
|
}
|
|
|
|
func (n noteToFeedDo) FirstOrCreate() (*models.NoteToFeed, error) {
|
|
if result, err := n.DO.FirstOrCreate(); err != nil {
|
|
return nil, err
|
|
} else {
|
|
return result.(*models.NoteToFeed), nil
|
|
}
|
|
}
|
|
|
|
func (n noteToFeedDo) FindByPage(offset int, limit int) (result []*models.NoteToFeed, 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 noteToFeedDo) 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 noteToFeedDo) Scan(result interface{}) (err error) {
|
|
return n.DO.Scan(result)
|
|
}
|
|
|
|
func (n noteToFeedDo) Delete(models ...*models.NoteToFeed) (result gen.ResultInfo, err error) {
|
|
return n.DO.Delete(models)
|
|
}
|
|
|
|
func (n *noteToFeedDo) withDO(do gen.Dao) *noteToFeedDo {
|
|
n.DO = *do.(*gen.DO)
|
|
return n
|
|
}
|