This commit is contained in:
parent
d32818af09
commit
cfa0566c6d
39 changed files with 2276 additions and 183 deletions
|
@ -6,6 +6,7 @@ package dbgen
|
|||
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
|
||||
"git.mstar.dev/mstar/linstrom/storage-new/models"
|
||||
"gorm.io/gorm"
|
||||
|
@ -383,6 +384,19 @@ func newNoteToEmote(db *gorm.DB, opts ...gen.DOOption) noteToEmote {
|
|||
RelationField: field.NewRelation("Note.Tags.Note", "models.Note"),
|
||||
},
|
||||
},
|
||||
Edits: struct {
|
||||
field.RelationField
|
||||
Note struct {
|
||||
field.RelationField
|
||||
}
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Edits", "models.NoteEdit"),
|
||||
Note: struct {
|
||||
field.RelationField
|
||||
}{
|
||||
RelationField: field.NewRelation("Note.Edits.Note", "models.Note"),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
_noteToEmote.Emote = noteToEmoteBelongsToEmote{
|
||||
|
@ -450,11 +464,17 @@ func (n *noteToEmote) fillFieldMap() {
|
|||
|
||||
func (n noteToEmote) clone(db *gorm.DB) noteToEmote {
|
||||
n.noteToEmoteDo.ReplaceConnPool(db.Statement.ConnPool)
|
||||
n.Note.db = db.Session(&gorm.Session{Initialized: true})
|
||||
n.Note.db.Statement.ConnPool = db.Statement.ConnPool
|
||||
n.Emote.db = db.Session(&gorm.Session{Initialized: true})
|
||||
n.Emote.db.Statement.ConnPool = db.Statement.ConnPool
|
||||
return n
|
||||
}
|
||||
|
||||
func (n noteToEmote) replaceDB(db *gorm.DB) noteToEmote {
|
||||
n.noteToEmoteDo.ReplaceDB(db)
|
||||
n.Note.db = db.Session(&gorm.Session{})
|
||||
n.Emote.db = db.Session(&gorm.Session{})
|
||||
return n
|
||||
}
|
||||
|
||||
|
@ -583,6 +603,12 @@ type noteToEmoteBelongsToNote struct {
|
|||
field.RelationField
|
||||
}
|
||||
}
|
||||
Edits struct {
|
||||
field.RelationField
|
||||
Note struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (a noteToEmoteBelongsToNote) Where(conds ...field.Expr) *noteToEmoteBelongsToNote {
|
||||
|
@ -612,6 +638,11 @@ func (a noteToEmoteBelongsToNote) Model(m *models.NoteToEmote) *noteToEmoteBelon
|
|||
return ¬eToEmoteBelongsToNoteTx{a.db.Model(m).Association(a.Name())}
|
||||
}
|
||||
|
||||
func (a noteToEmoteBelongsToNote) Unscoped() *noteToEmoteBelongsToNote {
|
||||
a.db = a.db.Unscoped()
|
||||
return &a
|
||||
}
|
||||
|
||||
type noteToEmoteBelongsToNoteTx struct{ tx *gorm.Association }
|
||||
|
||||
func (a noteToEmoteBelongsToNoteTx) Find() (result *models.Note, err error) {
|
||||
|
@ -650,6 +681,11 @@ func (a noteToEmoteBelongsToNoteTx) Count() int64 {
|
|||
return a.tx.Count()
|
||||
}
|
||||
|
||||
func (a noteToEmoteBelongsToNoteTx) Unscoped() *noteToEmoteBelongsToNoteTx {
|
||||
a.tx = a.tx.Unscoped()
|
||||
return &a
|
||||
}
|
||||
|
||||
type noteToEmoteBelongsToEmote struct {
|
||||
db *gorm.DB
|
||||
|
||||
|
@ -683,6 +719,11 @@ func (a noteToEmoteBelongsToEmote) Model(m *models.NoteToEmote) *noteToEmoteBelo
|
|||
return ¬eToEmoteBelongsToEmoteTx{a.db.Model(m).Association(a.Name())}
|
||||
}
|
||||
|
||||
func (a noteToEmoteBelongsToEmote) Unscoped() *noteToEmoteBelongsToEmote {
|
||||
a.db = a.db.Unscoped()
|
||||
return &a
|
||||
}
|
||||
|
||||
type noteToEmoteBelongsToEmoteTx struct{ tx *gorm.Association }
|
||||
|
||||
func (a noteToEmoteBelongsToEmoteTx) Find() (result *models.Emote, err error) {
|
||||
|
@ -721,6 +762,11 @@ func (a noteToEmoteBelongsToEmoteTx) Count() int64 {
|
|||
return a.tx.Count()
|
||||
}
|
||||
|
||||
func (a noteToEmoteBelongsToEmoteTx) Unscoped() *noteToEmoteBelongsToEmoteTx {
|
||||
a.tx = a.tx.Unscoped()
|
||||
return &a
|
||||
}
|
||||
|
||||
type noteToEmoteDo struct{ gen.DO }
|
||||
|
||||
type INoteToEmoteDo interface {
|
||||
|
@ -778,6 +824,8 @@ type INoteToEmoteDo interface {
|
|||
FirstOrCreate() (*models.NoteToEmote, error)
|
||||
FindByPage(offset int, limit int) (result []*models.NoteToEmote, count int64, err error)
|
||||
ScanByPage(result interface{}, offset int, limit int) (count int64, err error)
|
||||
Rows() (*sql.Rows, error)
|
||||
Row() *sql.Row
|
||||
Scan(result interface{}) (err error)
|
||||
Returning(value interface{}, columns ...string) INoteToEmoteDo
|
||||
UnderlyingDB() *gorm.DB
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue