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"
|
||||
"strings"
|
||||
|
||||
"git.mstar.dev/mstar/linstrom/storage-new/models"
|
||||
|
@ -264,11 +265,14 @@ func (a *accessToken) fillFieldMap() {
|
|||
|
||||
func (a accessToken) clone(db *gorm.DB) accessToken {
|
||||
a.accessTokenDo.ReplaceConnPool(db.Statement.ConnPool)
|
||||
a.User.db = db.Session(&gorm.Session{Initialized: true})
|
||||
a.User.db.Statement.ConnPool = db.Statement.ConnPool
|
||||
return a
|
||||
}
|
||||
|
||||
func (a accessToken) replaceDB(db *gorm.DB) accessToken {
|
||||
a.accessTokenDo.ReplaceDB(db)
|
||||
a.User.db = db.Session(&gorm.Session{})
|
||||
return a
|
||||
}
|
||||
|
||||
|
@ -381,6 +385,11 @@ func (a accessTokenBelongsToUser) Model(m *models.AccessToken) *accessTokenBelon
|
|||
return &accessTokenBelongsToUserTx{a.db.Model(m).Association(a.Name())}
|
||||
}
|
||||
|
||||
func (a accessTokenBelongsToUser) Unscoped() *accessTokenBelongsToUser {
|
||||
a.db = a.db.Unscoped()
|
||||
return &a
|
||||
}
|
||||
|
||||
type accessTokenBelongsToUserTx struct{ tx *gorm.Association }
|
||||
|
||||
func (a accessTokenBelongsToUserTx) Find() (result *models.User, err error) {
|
||||
|
@ -419,6 +428,11 @@ func (a accessTokenBelongsToUserTx) Count() int64 {
|
|||
return a.tx.Count()
|
||||
}
|
||||
|
||||
func (a accessTokenBelongsToUserTx) Unscoped() *accessTokenBelongsToUserTx {
|
||||
a.tx = a.tx.Unscoped()
|
||||
return &a
|
||||
}
|
||||
|
||||
type accessTokenDo struct{ gen.DO }
|
||||
|
||||
type IAccessTokenDo interface {
|
||||
|
@ -476,6 +490,8 @@ type IAccessTokenDo interface {
|
|||
FirstOrCreate() (*models.AccessToken, error)
|
||||
FindByPage(offset int, limit int) (result []*models.AccessToken, 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) IAccessTokenDo
|
||||
UnderlyingDB() *gorm.DB
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue