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 newNoteToAttachment(db *gorm.DB, opts ...gen.DOOption) noteToAttachment {
|
|||
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"),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
_noteToAttachment.Attachment = noteToAttachmentBelongsToAttachment{
|
||||
|
@ -450,11 +464,17 @@ func (n *noteToAttachment) fillFieldMap() {
|
|||
|
||||
func (n noteToAttachment) clone(db *gorm.DB) noteToAttachment {
|
||||
n.noteToAttachmentDo.ReplaceConnPool(db.Statement.ConnPool)
|
||||
n.Note.db = db.Session(&gorm.Session{Initialized: true})
|
||||
n.Note.db.Statement.ConnPool = db.Statement.ConnPool
|
||||
n.Attachment.db = db.Session(&gorm.Session{Initialized: true})
|
||||
n.Attachment.db.Statement.ConnPool = db.Statement.ConnPool
|
||||
return n
|
||||
}
|
||||
|
||||
func (n noteToAttachment) replaceDB(db *gorm.DB) noteToAttachment {
|
||||
n.noteToAttachmentDo.ReplaceDB(db)
|
||||
n.Note.db = db.Session(&gorm.Session{})
|
||||
n.Attachment.db = db.Session(&gorm.Session{})
|
||||
return n
|
||||
}
|
||||
|
||||
|
@ -583,6 +603,12 @@ type noteToAttachmentBelongsToNote struct {
|
|||
field.RelationField
|
||||
}
|
||||
}
|
||||
Edits struct {
|
||||
field.RelationField
|
||||
Note struct {
|
||||
field.RelationField
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (a noteToAttachmentBelongsToNote) Where(conds ...field.Expr) *noteToAttachmentBelongsToNote {
|
||||
|
@ -612,6 +638,11 @@ func (a noteToAttachmentBelongsToNote) Model(m *models.NoteToAttachment) *noteTo
|
|||
return ¬eToAttachmentBelongsToNoteTx{a.db.Model(m).Association(a.Name())}
|
||||
}
|
||||
|
||||
func (a noteToAttachmentBelongsToNote) Unscoped() *noteToAttachmentBelongsToNote {
|
||||
a.db = a.db.Unscoped()
|
||||
return &a
|
||||
}
|
||||
|
||||
type noteToAttachmentBelongsToNoteTx struct{ tx *gorm.Association }
|
||||
|
||||
func (a noteToAttachmentBelongsToNoteTx) Find() (result *models.Note, err error) {
|
||||
|
@ -650,6 +681,11 @@ func (a noteToAttachmentBelongsToNoteTx) Count() int64 {
|
|||
return a.tx.Count()
|
||||
}
|
||||
|
||||
func (a noteToAttachmentBelongsToNoteTx) Unscoped() *noteToAttachmentBelongsToNoteTx {
|
||||
a.tx = a.tx.Unscoped()
|
||||
return &a
|
||||
}
|
||||
|
||||
type noteToAttachmentBelongsToAttachment struct {
|
||||
db *gorm.DB
|
||||
|
||||
|
@ -683,6 +719,11 @@ func (a noteToAttachmentBelongsToAttachment) Model(m *models.NoteToAttachment) *
|
|||
return ¬eToAttachmentBelongsToAttachmentTx{a.db.Model(m).Association(a.Name())}
|
||||
}
|
||||
|
||||
func (a noteToAttachmentBelongsToAttachment) Unscoped() *noteToAttachmentBelongsToAttachment {
|
||||
a.db = a.db.Unscoped()
|
||||
return &a
|
||||
}
|
||||
|
||||
type noteToAttachmentBelongsToAttachmentTx struct{ tx *gorm.Association }
|
||||
|
||||
func (a noteToAttachmentBelongsToAttachmentTx) Find() (result *models.MediaMetadata, err error) {
|
||||
|
@ -721,6 +762,11 @@ func (a noteToAttachmentBelongsToAttachmentTx) Count() int64 {
|
|||
return a.tx.Count()
|
||||
}
|
||||
|
||||
func (a noteToAttachmentBelongsToAttachmentTx) Unscoped() *noteToAttachmentBelongsToAttachmentTx {
|
||||
a.tx = a.tx.Unscoped()
|
||||
return &a
|
||||
}
|
||||
|
||||
type noteToAttachmentDo struct{ gen.DO }
|
||||
|
||||
type INoteToAttachmentDo interface {
|
||||
|
@ -778,6 +824,8 @@ type INoteToAttachmentDo interface {
|
|||
FirstOrCreate() (*models.NoteToAttachment, error)
|
||||
FindByPage(offset int, limit int) (result []*models.NoteToAttachment, 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) INoteToAttachmentDo
|
||||
UnderlyingDB() *gorm.DB
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue