chore(new-storage): Auto-generate new storage impl
Some checks are pending
/ test (push) Waiting to run
Some checks are pending
/ test (push) Waiting to run
This commit is contained in:
parent
8ffd6d0050
commit
68859642f3
19 changed files with 10441 additions and 0 deletions
505
storage-new/dbgen/user_remote_links.gen.go
Normal file
505
storage-new/dbgen/user_remote_links.gen.go
Normal file
|
@ -0,0 +1,505 @@
|
|||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
|
||||
package dbgen
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"git.mstar.dev/mstar/linstrom/storage-new/models"
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/clause"
|
||||
"gorm.io/gorm/schema"
|
||||
|
||||
"gorm.io/gen"
|
||||
"gorm.io/gen/field"
|
||||
|
||||
"gorm.io/plugin/dbresolver"
|
||||
)
|
||||
|
||||
func newUserRemoteLinks(db *gorm.DB, opts ...gen.DOOption) userRemoteLinks {
|
||||
_userRemoteLinks := userRemoteLinks{}
|
||||
|
||||
_userRemoteLinks.userRemoteLinksDo.UseDB(db, opts...)
|
||||
_userRemoteLinks.userRemoteLinksDo.UseModel(&models.UserRemoteLinks{})
|
||||
|
||||
tableName := _userRemoteLinks.userRemoteLinksDo.TableName()
|
||||
_userRemoteLinks.ALL = field.NewAsterisk(tableName)
|
||||
_userRemoteLinks.ID = field.NewUint(tableName, "id")
|
||||
_userRemoteLinks.CreatedAt = field.NewTime(tableName, "created_at")
|
||||
_userRemoteLinks.UpdatedAt = field.NewTime(tableName, "updated_at")
|
||||
_userRemoteLinks.DeletedAt = field.NewField(tableName, "deleted_at")
|
||||
_userRemoteLinks.UserId = field.NewString(tableName, "user_id")
|
||||
_userRemoteLinks.ApLink = field.NewString(tableName, "ap_link")
|
||||
_userRemoteLinks.ViewLink = field.NewString(tableName, "view_link")
|
||||
_userRemoteLinks.FollowersLink = field.NewString(tableName, "followers_link")
|
||||
_userRemoteLinks.FollowingLink = field.NewString(tableName, "following_link")
|
||||
_userRemoteLinks.InboxLink = field.NewString(tableName, "inbox_link")
|
||||
_userRemoteLinks.OutboxLink = field.NewString(tableName, "outbox_link")
|
||||
_userRemoteLinks.FeaturedLink = field.NewString(tableName, "featured_link")
|
||||
_userRemoteLinks.FeaturedTagsLink = field.NewString(tableName, "featured_tags_link")
|
||||
_userRemoteLinks.User = userRemoteLinksBelongsToUser{
|
||||
db: db.Session(&gorm.Session{}),
|
||||
|
||||
RelationField: field.NewRelation("User", "models.User"),
|
||||
}
|
||||
|
||||
_userRemoteLinks.fillFieldMap()
|
||||
|
||||
return _userRemoteLinks
|
||||
}
|
||||
|
||||
type userRemoteLinks struct {
|
||||
userRemoteLinksDo
|
||||
|
||||
ALL field.Asterisk
|
||||
ID field.Uint
|
||||
CreatedAt field.Time
|
||||
UpdatedAt field.Time
|
||||
DeletedAt field.Field
|
||||
UserId field.String
|
||||
ApLink field.String
|
||||
ViewLink field.String
|
||||
FollowersLink field.String
|
||||
FollowingLink field.String
|
||||
InboxLink field.String
|
||||
OutboxLink field.String
|
||||
FeaturedLink field.String
|
||||
FeaturedTagsLink field.String
|
||||
User userRemoteLinksBelongsToUser
|
||||
|
||||
fieldMap map[string]field.Expr
|
||||
}
|
||||
|
||||
func (u userRemoteLinks) Table(newTableName string) *userRemoteLinks {
|
||||
u.userRemoteLinksDo.UseTable(newTableName)
|
||||
return u.updateTableName(newTableName)
|
||||
}
|
||||
|
||||
func (u userRemoteLinks) As(alias string) *userRemoteLinks {
|
||||
u.userRemoteLinksDo.DO = *(u.userRemoteLinksDo.As(alias).(*gen.DO))
|
||||
return u.updateTableName(alias)
|
||||
}
|
||||
|
||||
func (u *userRemoteLinks) updateTableName(table string) *userRemoteLinks {
|
||||
u.ALL = field.NewAsterisk(table)
|
||||
u.ID = field.NewUint(table, "id")
|
||||
u.CreatedAt = field.NewTime(table, "created_at")
|
||||
u.UpdatedAt = field.NewTime(table, "updated_at")
|
||||
u.DeletedAt = field.NewField(table, "deleted_at")
|
||||
u.UserId = field.NewString(table, "user_id")
|
||||
u.ApLink = field.NewString(table, "ap_link")
|
||||
u.ViewLink = field.NewString(table, "view_link")
|
||||
u.FollowersLink = field.NewString(table, "followers_link")
|
||||
u.FollowingLink = field.NewString(table, "following_link")
|
||||
u.InboxLink = field.NewString(table, "inbox_link")
|
||||
u.OutboxLink = field.NewString(table, "outbox_link")
|
||||
u.FeaturedLink = field.NewString(table, "featured_link")
|
||||
u.FeaturedTagsLink = field.NewString(table, "featured_tags_link")
|
||||
|
||||
u.fillFieldMap()
|
||||
|
||||
return u
|
||||
}
|
||||
|
||||
func (u *userRemoteLinks) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
||||
_f, ok := u.fieldMap[fieldName]
|
||||
if !ok || _f == nil {
|
||||
return nil, false
|
||||
}
|
||||
_oe, ok := _f.(field.OrderExpr)
|
||||
return _oe, ok
|
||||
}
|
||||
|
||||
func (u *userRemoteLinks) fillFieldMap() {
|
||||
u.fieldMap = make(map[string]field.Expr, 14)
|
||||
u.fieldMap["id"] = u.ID
|
||||
u.fieldMap["created_at"] = u.CreatedAt
|
||||
u.fieldMap["updated_at"] = u.UpdatedAt
|
||||
u.fieldMap["deleted_at"] = u.DeletedAt
|
||||
u.fieldMap["user_id"] = u.UserId
|
||||
u.fieldMap["ap_link"] = u.ApLink
|
||||
u.fieldMap["view_link"] = u.ViewLink
|
||||
u.fieldMap["followers_link"] = u.FollowersLink
|
||||
u.fieldMap["following_link"] = u.FollowingLink
|
||||
u.fieldMap["inbox_link"] = u.InboxLink
|
||||
u.fieldMap["outbox_link"] = u.OutboxLink
|
||||
u.fieldMap["featured_link"] = u.FeaturedLink
|
||||
u.fieldMap["featured_tags_link"] = u.FeaturedTagsLink
|
||||
|
||||
}
|
||||
|
||||
func (u userRemoteLinks) clone(db *gorm.DB) userRemoteLinks {
|
||||
u.userRemoteLinksDo.ReplaceConnPool(db.Statement.ConnPool)
|
||||
return u
|
||||
}
|
||||
|
||||
func (u userRemoteLinks) replaceDB(db *gorm.DB) userRemoteLinks {
|
||||
u.userRemoteLinksDo.ReplaceDB(db)
|
||||
return u
|
||||
}
|
||||
|
||||
type userRemoteLinksBelongsToUser struct {
|
||||
db *gorm.DB
|
||||
|
||||
field.RelationField
|
||||
}
|
||||
|
||||
func (a userRemoteLinksBelongsToUser) Where(conds ...field.Expr) *userRemoteLinksBelongsToUser {
|
||||
if len(conds) == 0 {
|
||||
return &a
|
||||
}
|
||||
|
||||
exprs := make([]clause.Expression, 0, len(conds))
|
||||
for _, cond := range conds {
|
||||
exprs = append(exprs, cond.BeCond().(clause.Expression))
|
||||
}
|
||||
a.db = a.db.Clauses(clause.Where{Exprs: exprs})
|
||||
return &a
|
||||
}
|
||||
|
||||
func (a userRemoteLinksBelongsToUser) WithContext(ctx context.Context) *userRemoteLinksBelongsToUser {
|
||||
a.db = a.db.WithContext(ctx)
|
||||
return &a
|
||||
}
|
||||
|
||||
func (a userRemoteLinksBelongsToUser) Session(session *gorm.Session) *userRemoteLinksBelongsToUser {
|
||||
a.db = a.db.Session(session)
|
||||
return &a
|
||||
}
|
||||
|
||||
func (a userRemoteLinksBelongsToUser) Model(m *models.UserRemoteLinks) *userRemoteLinksBelongsToUserTx {
|
||||
return &userRemoteLinksBelongsToUserTx{a.db.Model(m).Association(a.Name())}
|
||||
}
|
||||
|
||||
type userRemoteLinksBelongsToUserTx struct{ tx *gorm.Association }
|
||||
|
||||
func (a userRemoteLinksBelongsToUserTx) Find() (result *models.User, err error) {
|
||||
return result, a.tx.Find(&result)
|
||||
}
|
||||
|
||||
func (a userRemoteLinksBelongsToUserTx) Append(values ...*models.User) (err error) {
|
||||
targetValues := make([]interface{}, len(values))
|
||||
for i, v := range values {
|
||||
targetValues[i] = v
|
||||
}
|
||||
return a.tx.Append(targetValues...)
|
||||
}
|
||||
|
||||
func (a userRemoteLinksBelongsToUserTx) Replace(values ...*models.User) (err error) {
|
||||
targetValues := make([]interface{}, len(values))
|
||||
for i, v := range values {
|
||||
targetValues[i] = v
|
||||
}
|
||||
return a.tx.Replace(targetValues...)
|
||||
}
|
||||
|
||||
func (a userRemoteLinksBelongsToUserTx) Delete(values ...*models.User) (err error) {
|
||||
targetValues := make([]interface{}, len(values))
|
||||
for i, v := range values {
|
||||
targetValues[i] = v
|
||||
}
|
||||
return a.tx.Delete(targetValues...)
|
||||
}
|
||||
|
||||
func (a userRemoteLinksBelongsToUserTx) Clear() error {
|
||||
return a.tx.Clear()
|
||||
}
|
||||
|
||||
func (a userRemoteLinksBelongsToUserTx) Count() int64 {
|
||||
return a.tx.Count()
|
||||
}
|
||||
|
||||
type userRemoteLinksDo struct{ gen.DO }
|
||||
|
||||
type IUserRemoteLinksDo interface {
|
||||
gen.SubQuery
|
||||
Debug() IUserRemoteLinksDo
|
||||
WithContext(ctx context.Context) IUserRemoteLinksDo
|
||||
WithResult(fc func(tx gen.Dao)) gen.ResultInfo
|
||||
ReplaceDB(db *gorm.DB)
|
||||
ReadDB() IUserRemoteLinksDo
|
||||
WriteDB() IUserRemoteLinksDo
|
||||
As(alias string) gen.Dao
|
||||
Session(config *gorm.Session) IUserRemoteLinksDo
|
||||
Columns(cols ...field.Expr) gen.Columns
|
||||
Clauses(conds ...clause.Expression) IUserRemoteLinksDo
|
||||
Not(conds ...gen.Condition) IUserRemoteLinksDo
|
||||
Or(conds ...gen.Condition) IUserRemoteLinksDo
|
||||
Select(conds ...field.Expr) IUserRemoteLinksDo
|
||||
Where(conds ...gen.Condition) IUserRemoteLinksDo
|
||||
Order(conds ...field.Expr) IUserRemoteLinksDo
|
||||
Distinct(cols ...field.Expr) IUserRemoteLinksDo
|
||||
Omit(cols ...field.Expr) IUserRemoteLinksDo
|
||||
Join(table schema.Tabler, on ...field.Expr) IUserRemoteLinksDo
|
||||
LeftJoin(table schema.Tabler, on ...field.Expr) IUserRemoteLinksDo
|
||||
RightJoin(table schema.Tabler, on ...field.Expr) IUserRemoteLinksDo
|
||||
Group(cols ...field.Expr) IUserRemoteLinksDo
|
||||
Having(conds ...gen.Condition) IUserRemoteLinksDo
|
||||
Limit(limit int) IUserRemoteLinksDo
|
||||
Offset(offset int) IUserRemoteLinksDo
|
||||
Count() (count int64, err error)
|
||||
Scopes(funcs ...func(gen.Dao) gen.Dao) IUserRemoteLinksDo
|
||||
Unscoped() IUserRemoteLinksDo
|
||||
Create(values ...*models.UserRemoteLinks) error
|
||||
CreateInBatches(values []*models.UserRemoteLinks, batchSize int) error
|
||||
Save(values ...*models.UserRemoteLinks) error
|
||||
First() (*models.UserRemoteLinks, error)
|
||||
Take() (*models.UserRemoteLinks, error)
|
||||
Last() (*models.UserRemoteLinks, error)
|
||||
Find() ([]*models.UserRemoteLinks, error)
|
||||
FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.UserRemoteLinks, err error)
|
||||
FindInBatches(result *[]*models.UserRemoteLinks, batchSize int, fc func(tx gen.Dao, batch int) error) error
|
||||
Pluck(column field.Expr, dest interface{}) error
|
||||
Delete(...*models.UserRemoteLinks) (info gen.ResultInfo, err error)
|
||||
Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
|
||||
Updates(value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
|
||||
UpdateColumns(value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateFrom(q gen.SubQuery) gen.Dao
|
||||
Attrs(attrs ...field.AssignExpr) IUserRemoteLinksDo
|
||||
Assign(attrs ...field.AssignExpr) IUserRemoteLinksDo
|
||||
Joins(fields ...field.RelationField) IUserRemoteLinksDo
|
||||
Preload(fields ...field.RelationField) IUserRemoteLinksDo
|
||||
FirstOrInit() (*models.UserRemoteLinks, error)
|
||||
FirstOrCreate() (*models.UserRemoteLinks, error)
|
||||
FindByPage(offset int, limit int) (result []*models.UserRemoteLinks, count int64, err error)
|
||||
ScanByPage(result interface{}, offset int, limit int) (count int64, err error)
|
||||
Scan(result interface{}) (err error)
|
||||
Returning(value interface{}, columns ...string) IUserRemoteLinksDo
|
||||
UnderlyingDB() *gorm.DB
|
||||
schema.Tabler
|
||||
}
|
||||
|
||||
func (u userRemoteLinksDo) Debug() IUserRemoteLinksDo {
|
||||
return u.withDO(u.DO.Debug())
|
||||
}
|
||||
|
||||
func (u userRemoteLinksDo) WithContext(ctx context.Context) IUserRemoteLinksDo {
|
||||
return u.withDO(u.DO.WithContext(ctx))
|
||||
}
|
||||
|
||||
func (u userRemoteLinksDo) ReadDB() IUserRemoteLinksDo {
|
||||
return u.Clauses(dbresolver.Read)
|
||||
}
|
||||
|
||||
func (u userRemoteLinksDo) WriteDB() IUserRemoteLinksDo {
|
||||
return u.Clauses(dbresolver.Write)
|
||||
}
|
||||
|
||||
func (u userRemoteLinksDo) Session(config *gorm.Session) IUserRemoteLinksDo {
|
||||
return u.withDO(u.DO.Session(config))
|
||||
}
|
||||
|
||||
func (u userRemoteLinksDo) Clauses(conds ...clause.Expression) IUserRemoteLinksDo {
|
||||
return u.withDO(u.DO.Clauses(conds...))
|
||||
}
|
||||
|
||||
func (u userRemoteLinksDo) Returning(value interface{}, columns ...string) IUserRemoteLinksDo {
|
||||
return u.withDO(u.DO.Returning(value, columns...))
|
||||
}
|
||||
|
||||
func (u userRemoteLinksDo) Not(conds ...gen.Condition) IUserRemoteLinksDo {
|
||||
return u.withDO(u.DO.Not(conds...))
|
||||
}
|
||||
|
||||
func (u userRemoteLinksDo) Or(conds ...gen.Condition) IUserRemoteLinksDo {
|
||||
return u.withDO(u.DO.Or(conds...))
|
||||
}
|
||||
|
||||
func (u userRemoteLinksDo) Select(conds ...field.Expr) IUserRemoteLinksDo {
|
||||
return u.withDO(u.DO.Select(conds...))
|
||||
}
|
||||
|
||||
func (u userRemoteLinksDo) Where(conds ...gen.Condition) IUserRemoteLinksDo {
|
||||
return u.withDO(u.DO.Where(conds...))
|
||||
}
|
||||
|
||||
func (u userRemoteLinksDo) Order(conds ...field.Expr) IUserRemoteLinksDo {
|
||||
return u.withDO(u.DO.Order(conds...))
|
||||
}
|
||||
|
||||
func (u userRemoteLinksDo) Distinct(cols ...field.Expr) IUserRemoteLinksDo {
|
||||
return u.withDO(u.DO.Distinct(cols...))
|
||||
}
|
||||
|
||||
func (u userRemoteLinksDo) Omit(cols ...field.Expr) IUserRemoteLinksDo {
|
||||
return u.withDO(u.DO.Omit(cols...))
|
||||
}
|
||||
|
||||
func (u userRemoteLinksDo) Join(table schema.Tabler, on ...field.Expr) IUserRemoteLinksDo {
|
||||
return u.withDO(u.DO.Join(table, on...))
|
||||
}
|
||||
|
||||
func (u userRemoteLinksDo) LeftJoin(table schema.Tabler, on ...field.Expr) IUserRemoteLinksDo {
|
||||
return u.withDO(u.DO.LeftJoin(table, on...))
|
||||
}
|
||||
|
||||
func (u userRemoteLinksDo) RightJoin(table schema.Tabler, on ...field.Expr) IUserRemoteLinksDo {
|
||||
return u.withDO(u.DO.RightJoin(table, on...))
|
||||
}
|
||||
|
||||
func (u userRemoteLinksDo) Group(cols ...field.Expr) IUserRemoteLinksDo {
|
||||
return u.withDO(u.DO.Group(cols...))
|
||||
}
|
||||
|
||||
func (u userRemoteLinksDo) Having(conds ...gen.Condition) IUserRemoteLinksDo {
|
||||
return u.withDO(u.DO.Having(conds...))
|
||||
}
|
||||
|
||||
func (u userRemoteLinksDo) Limit(limit int) IUserRemoteLinksDo {
|
||||
return u.withDO(u.DO.Limit(limit))
|
||||
}
|
||||
|
||||
func (u userRemoteLinksDo) Offset(offset int) IUserRemoteLinksDo {
|
||||
return u.withDO(u.DO.Offset(offset))
|
||||
}
|
||||
|
||||
func (u userRemoteLinksDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IUserRemoteLinksDo {
|
||||
return u.withDO(u.DO.Scopes(funcs...))
|
||||
}
|
||||
|
||||
func (u userRemoteLinksDo) Unscoped() IUserRemoteLinksDo {
|
||||
return u.withDO(u.DO.Unscoped())
|
||||
}
|
||||
|
||||
func (u userRemoteLinksDo) Create(values ...*models.UserRemoteLinks) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return u.DO.Create(values)
|
||||
}
|
||||
|
||||
func (u userRemoteLinksDo) CreateInBatches(values []*models.UserRemoteLinks, batchSize int) error {
|
||||
return u.DO.CreateInBatches(values, batchSize)
|
||||
}
|
||||
|
||||
// Save : !!! underlying implementation is different with GORM
|
||||
// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values)
|
||||
func (u userRemoteLinksDo) Save(values ...*models.UserRemoteLinks) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return u.DO.Save(values)
|
||||
}
|
||||
|
||||
func (u userRemoteLinksDo) First() (*models.UserRemoteLinks, error) {
|
||||
if result, err := u.DO.First(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*models.UserRemoteLinks), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (u userRemoteLinksDo) Take() (*models.UserRemoteLinks, error) {
|
||||
if result, err := u.DO.Take(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*models.UserRemoteLinks), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (u userRemoteLinksDo) Last() (*models.UserRemoteLinks, error) {
|
||||
if result, err := u.DO.Last(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*models.UserRemoteLinks), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (u userRemoteLinksDo) Find() ([]*models.UserRemoteLinks, error) {
|
||||
result, err := u.DO.Find()
|
||||
return result.([]*models.UserRemoteLinks), err
|
||||
}
|
||||
|
||||
func (u userRemoteLinksDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.UserRemoteLinks, err error) {
|
||||
buf := make([]*models.UserRemoteLinks, 0, batchSize)
|
||||
err = u.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error {
|
||||
defer func() { results = append(results, buf...) }()
|
||||
return fc(tx, batch)
|
||||
})
|
||||
return results, err
|
||||
}
|
||||
|
||||
func (u userRemoteLinksDo) FindInBatches(result *[]*models.UserRemoteLinks, batchSize int, fc func(tx gen.Dao, batch int) error) error {
|
||||
return u.DO.FindInBatches(result, batchSize, fc)
|
||||
}
|
||||
|
||||
func (u userRemoteLinksDo) Attrs(attrs ...field.AssignExpr) IUserRemoteLinksDo {
|
||||
return u.withDO(u.DO.Attrs(attrs...))
|
||||
}
|
||||
|
||||
func (u userRemoteLinksDo) Assign(attrs ...field.AssignExpr) IUserRemoteLinksDo {
|
||||
return u.withDO(u.DO.Assign(attrs...))
|
||||
}
|
||||
|
||||
func (u userRemoteLinksDo) Joins(fields ...field.RelationField) IUserRemoteLinksDo {
|
||||
for _, _f := range fields {
|
||||
u = *u.withDO(u.DO.Joins(_f))
|
||||
}
|
||||
return &u
|
||||
}
|
||||
|
||||
func (u userRemoteLinksDo) Preload(fields ...field.RelationField) IUserRemoteLinksDo {
|
||||
for _, _f := range fields {
|
||||
u = *u.withDO(u.DO.Preload(_f))
|
||||
}
|
||||
return &u
|
||||
}
|
||||
|
||||
func (u userRemoteLinksDo) FirstOrInit() (*models.UserRemoteLinks, error) {
|
||||
if result, err := u.DO.FirstOrInit(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*models.UserRemoteLinks), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (u userRemoteLinksDo) FirstOrCreate() (*models.UserRemoteLinks, error) {
|
||||
if result, err := u.DO.FirstOrCreate(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*models.UserRemoteLinks), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (u userRemoteLinksDo) FindByPage(offset int, limit int) (result []*models.UserRemoteLinks, count int64, err error) {
|
||||
result, err = u.Offset(offset).Limit(limit).Find()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if size := len(result); 0 < limit && 0 < size && size < limit {
|
||||
count = int64(size + offset)
|
||||
return
|
||||
}
|
||||
|
||||
count, err = u.Offset(-1).Limit(-1).Count()
|
||||
return
|
||||
}
|
||||
|
||||
func (u userRemoteLinksDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
|
||||
count, err = u.Count()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = u.Offset(offset).Limit(limit).Scan(result)
|
||||
return
|
||||
}
|
||||
|
||||
func (u userRemoteLinksDo) Scan(result interface{}) (err error) {
|
||||
return u.DO.Scan(result)
|
||||
}
|
||||
|
||||
func (u userRemoteLinksDo) Delete(models ...*models.UserRemoteLinks) (result gen.ResultInfo, err error) {
|
||||
return u.DO.Delete(models)
|
||||
}
|
||||
|
||||
func (u *userRemoteLinksDo) withDO(do gen.Dao) *userRemoteLinksDo {
|
||||
u.DO = *do.(*gen.DO)
|
||||
return u
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue