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 newNoteToPing(db *gorm.DB, opts ...gen.DOOption) noteToPing {
|
|||
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"),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
_noteToPing.PingTarget = noteToPingBelongsToPingTarget{
|
||||
|
@ -450,11 +464,17 @@ func (n *noteToPing) fillFieldMap() {
|
|||
|
||||
func (n noteToPing) clone(db *gorm.DB) noteToPing {
|
||||
n.noteToPingDo.ReplaceConnPool(db.Statement.ConnPool)
|
||||
n.Note.db = db.Session(&gorm.Session{Initialized: true})
|
||||
n.Note.db.Statement.ConnPool = db.Statement.ConnPool
|
||||
n.PingTarget.db = db.Session(&gorm.Session{Initialized: true})
|
||||
n.PingTarget.db.Statement.ConnPool = db.Statement.ConnPool
|
||||
return n
|
||||
}
|
||||
|
||||
func (n noteToPing) replaceDB(db *gorm.DB) noteToPing {
|
||||
n.noteToPingDo.ReplaceDB(db)
|
||||
n.Note.db = db.Session(&gorm.Session{})
|
||||
n.PingTarget.db = db.Session(&gorm.Session{})
|
||||
return n
|
||||
}
|
||||
|
||||
|
@ -583,6 +603,12 @@ type noteToPingBelongsToNote struct {
|
|||
field.RelationField
|
||||
}
|
||||
}
|
||||
Edits struct {
|
||||
field.RelationField
|
||||
Note struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (a noteToPingBelongsToNote) Where(conds ...field.Expr) *noteToPingBelongsToNote {
|
||||
|
@ -612,6 +638,11 @@ func (a noteToPingBelongsToNote) Model(m *models.NoteToPing) *noteToPingBelongsT
|
|||
return ¬eToPingBelongsToNoteTx{a.db.Model(m).Association(a.Name())}
|
||||
}
|
||||
|
||||
func (a noteToPingBelongsToNote) Unscoped() *noteToPingBelongsToNote {
|
||||
a.db = a.db.Unscoped()
|
||||
return &a
|
||||
}
|
||||
|
||||
type noteToPingBelongsToNoteTx struct{ tx *gorm.Association }
|
||||
|
||||
func (a noteToPingBelongsToNoteTx) Find() (result *models.Note, err error) {
|
||||
|
@ -650,6 +681,11 @@ func (a noteToPingBelongsToNoteTx) Count() int64 {
|
|||
return a.tx.Count()
|
||||
}
|
||||
|
||||
func (a noteToPingBelongsToNoteTx) Unscoped() *noteToPingBelongsToNoteTx {
|
||||
a.tx = a.tx.Unscoped()
|
||||
return &a
|
||||
}
|
||||
|
||||
type noteToPingBelongsToPingTarget struct {
|
||||
db *gorm.DB
|
||||
|
||||
|
@ -683,6 +719,11 @@ func (a noteToPingBelongsToPingTarget) Model(m *models.NoteToPing) *noteToPingBe
|
|||
return ¬eToPingBelongsToPingTargetTx{a.db.Model(m).Association(a.Name())}
|
||||
}
|
||||
|
||||
func (a noteToPingBelongsToPingTarget) Unscoped() *noteToPingBelongsToPingTarget {
|
||||
a.db = a.db.Unscoped()
|
||||
return &a
|
||||
}
|
||||
|
||||
type noteToPingBelongsToPingTargetTx struct{ tx *gorm.Association }
|
||||
|
||||
func (a noteToPingBelongsToPingTargetTx) Find() (result *models.User, err error) {
|
||||
|
@ -721,6 +762,11 @@ func (a noteToPingBelongsToPingTargetTx) Count() int64 {
|
|||
return a.tx.Count()
|
||||
}
|
||||
|
||||
func (a noteToPingBelongsToPingTargetTx) Unscoped() *noteToPingBelongsToPingTargetTx {
|
||||
a.tx = a.tx.Unscoped()
|
||||
return &a
|
||||
}
|
||||
|
||||
type noteToPingDo struct{ gen.DO }
|
||||
|
||||
type INoteToPingDo interface {
|
||||
|
@ -778,6 +824,8 @@ type INoteToPingDo interface {
|
|||
FirstOrCreate() (*models.NoteToPing, error)
|
||||
FindByPage(offset int, limit int) (result []*models.NoteToPing, 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) INoteToPingDo
|
||||
UnderlyingDB() *gorm.DB
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue