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 newNoteToFeed(db *gorm.DB, opts ...gen.DOOption) noteToFeed {
|
|||
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"),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
_noteToFeed.fillFieldMap()
|
||||
|
@ -442,11 +456,14 @@ func (n *noteToFeed) fillFieldMap() {
|
|||
|
||||
func (n noteToFeed) clone(db *gorm.DB) noteToFeed {
|
||||
n.noteToFeedDo.ReplaceConnPool(db.Statement.ConnPool)
|
||||
n.Note.db = db.Session(&gorm.Session{Initialized: true})
|
||||
n.Note.db.Statement.ConnPool = db.Statement.ConnPool
|
||||
return n
|
||||
}
|
||||
|
||||
func (n noteToFeed) replaceDB(db *gorm.DB) noteToFeed {
|
||||
n.noteToFeedDo.ReplaceDB(db)
|
||||
n.Note.db = db.Session(&gorm.Session{})
|
||||
return n
|
||||
}
|
||||
|
||||
|
@ -575,6 +592,12 @@ type noteToFeedBelongsToNote struct {
|
|||
field.RelationField
|
||||
}
|
||||
}
|
||||
Edits struct {
|
||||
field.RelationField
|
||||
Note struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (a noteToFeedBelongsToNote) Where(conds ...field.Expr) *noteToFeedBelongsToNote {
|
||||
|
@ -604,6 +627,11 @@ func (a noteToFeedBelongsToNote) Model(m *models.NoteToFeed) *noteToFeedBelongsT
|
|||
return ¬eToFeedBelongsToNoteTx{a.db.Model(m).Association(a.Name())}
|
||||
}
|
||||
|
||||
func (a noteToFeedBelongsToNote) Unscoped() *noteToFeedBelongsToNote {
|
||||
a.db = a.db.Unscoped()
|
||||
return &a
|
||||
}
|
||||
|
||||
type noteToFeedBelongsToNoteTx struct{ tx *gorm.Association }
|
||||
|
||||
func (a noteToFeedBelongsToNoteTx) Find() (result *models.Note, err error) {
|
||||
|
@ -642,6 +670,11 @@ func (a noteToFeedBelongsToNoteTx) Count() int64 {
|
|||
return a.tx.Count()
|
||||
}
|
||||
|
||||
func (a noteToFeedBelongsToNoteTx) Unscoped() *noteToFeedBelongsToNoteTx {
|
||||
a.tx = a.tx.Unscoped()
|
||||
return &a
|
||||
}
|
||||
|
||||
type noteToFeedDo struct{ gen.DO }
|
||||
|
||||
type INoteToFeedDo interface {
|
||||
|
@ -699,6 +732,8 @@ type INoteToFeedDo interface {
|
|||
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)
|
||||
Rows() (*sql.Rows, error)
|
||||
Row() *sql.Row
|
||||
Scan(result interface{}) (err error)
|
||||
Returning(value interface{}, columns ...string) INoteToFeedDo
|
||||
UnderlyingDB() *gorm.DB
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue