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"
|
||||
|
@ -271,11 +272,17 @@ func (u *userToUserRelation) fillFieldMap() {
|
|||
|
||||
func (u userToUserRelation) clone(db *gorm.DB) userToUserRelation {
|
||||
u.userToUserRelationDo.ReplaceConnPool(db.Statement.ConnPool)
|
||||
u.User.db = db.Session(&gorm.Session{Initialized: true})
|
||||
u.User.db.Statement.ConnPool = db.Statement.ConnPool
|
||||
u.TargetUser.db = db.Session(&gorm.Session{Initialized: true})
|
||||
u.TargetUser.db.Statement.ConnPool = db.Statement.ConnPool
|
||||
return u
|
||||
}
|
||||
|
||||
func (u userToUserRelation) replaceDB(db *gorm.DB) userToUserRelation {
|
||||
u.userToUserRelationDo.ReplaceDB(db)
|
||||
u.User.db = db.Session(&gorm.Session{})
|
||||
u.TargetUser.db = db.Session(&gorm.Session{})
|
||||
return u
|
||||
}
|
||||
|
||||
|
@ -388,6 +395,11 @@ func (a userToUserRelationBelongsToUser) Model(m *models.UserToUserRelation) *us
|
|||
return &userToUserRelationBelongsToUserTx{a.db.Model(m).Association(a.Name())}
|
||||
}
|
||||
|
||||
func (a userToUserRelationBelongsToUser) Unscoped() *userToUserRelationBelongsToUser {
|
||||
a.db = a.db.Unscoped()
|
||||
return &a
|
||||
}
|
||||
|
||||
type userToUserRelationBelongsToUserTx struct{ tx *gorm.Association }
|
||||
|
||||
func (a userToUserRelationBelongsToUserTx) Find() (result *models.User, err error) {
|
||||
|
@ -426,6 +438,11 @@ func (a userToUserRelationBelongsToUserTx) Count() int64 {
|
|||
return a.tx.Count()
|
||||
}
|
||||
|
||||
func (a userToUserRelationBelongsToUserTx) Unscoped() *userToUserRelationBelongsToUserTx {
|
||||
a.tx = a.tx.Unscoped()
|
||||
return &a
|
||||
}
|
||||
|
||||
type userToUserRelationBelongsToTargetUser struct {
|
||||
db *gorm.DB
|
||||
|
||||
|
@ -459,6 +476,11 @@ func (a userToUserRelationBelongsToTargetUser) Model(m *models.UserToUserRelatio
|
|||
return &userToUserRelationBelongsToTargetUserTx{a.db.Model(m).Association(a.Name())}
|
||||
}
|
||||
|
||||
func (a userToUserRelationBelongsToTargetUser) Unscoped() *userToUserRelationBelongsToTargetUser {
|
||||
a.db = a.db.Unscoped()
|
||||
return &a
|
||||
}
|
||||
|
||||
type userToUserRelationBelongsToTargetUserTx struct{ tx *gorm.Association }
|
||||
|
||||
func (a userToUserRelationBelongsToTargetUserTx) Find() (result *models.User, err error) {
|
||||
|
@ -497,6 +519,11 @@ func (a userToUserRelationBelongsToTargetUserTx) Count() int64 {
|
|||
return a.tx.Count()
|
||||
}
|
||||
|
||||
func (a userToUserRelationBelongsToTargetUserTx) Unscoped() *userToUserRelationBelongsToTargetUserTx {
|
||||
a.tx = a.tx.Unscoped()
|
||||
return &a
|
||||
}
|
||||
|
||||
type userToUserRelationDo struct{ gen.DO }
|
||||
|
||||
type IUserToUserRelationDo interface {
|
||||
|
@ -554,6 +581,8 @@ type IUserToUserRelationDo interface {
|
|||
FirstOrCreate() (*models.UserToUserRelation, error)
|
||||
FindByPage(offset int, limit int) (result []*models.UserToUserRelation, 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) IUserToUserRelationDo
|
||||
UnderlyingDB() *gorm.DB
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue