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"
|
||||
|
@ -279,11 +280,14 @@ func (u *userAuthMethod) fillFieldMap() {
|
|||
|
||||
func (u userAuthMethod) clone(db *gorm.DB) userAuthMethod {
|
||||
u.userAuthMethodDo.ReplaceConnPool(db.Statement.ConnPool)
|
||||
u.User.db = db.Session(&gorm.Session{Initialized: true})
|
||||
u.User.db.Statement.ConnPool = db.Statement.ConnPool
|
||||
return u
|
||||
}
|
||||
|
||||
func (u userAuthMethod) replaceDB(db *gorm.DB) userAuthMethod {
|
||||
u.userAuthMethodDo.ReplaceDB(db)
|
||||
u.User.db = db.Session(&gorm.Session{})
|
||||
return u
|
||||
}
|
||||
|
||||
|
@ -396,6 +400,11 @@ func (a userAuthMethodBelongsToUser) Model(m *models.UserAuthMethod) *userAuthMe
|
|||
return &userAuthMethodBelongsToUserTx{a.db.Model(m).Association(a.Name())}
|
||||
}
|
||||
|
||||
func (a userAuthMethodBelongsToUser) Unscoped() *userAuthMethodBelongsToUser {
|
||||
a.db = a.db.Unscoped()
|
||||
return &a
|
||||
}
|
||||
|
||||
type userAuthMethodBelongsToUserTx struct{ tx *gorm.Association }
|
||||
|
||||
func (a userAuthMethodBelongsToUserTx) Find() (result *models.User, err error) {
|
||||
|
@ -434,6 +443,11 @@ func (a userAuthMethodBelongsToUserTx) Count() int64 {
|
|||
return a.tx.Count()
|
||||
}
|
||||
|
||||
func (a userAuthMethodBelongsToUserTx) Unscoped() *userAuthMethodBelongsToUserTx {
|
||||
a.tx = a.tx.Unscoped()
|
||||
return &a
|
||||
}
|
||||
|
||||
type userAuthMethodDo struct{ gen.DO }
|
||||
|
||||
type IUserAuthMethodDo interface {
|
||||
|
@ -491,6 +505,8 @@ type IUserAuthMethodDo interface {
|
|||
FirstOrCreate() (*models.UserAuthMethod, error)
|
||||
FindByPage(offset int, limit int) (result []*models.UserAuthMethod, 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) IUserAuthMethodDo
|
||||
UnderlyingDB() *gorm.DB
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue