123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347 |
- // 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 dao
- import (
- "context"
- "gorm.io/gorm"
- "gorm.io/gorm/clause"
- "gorm.io/gorm/schema"
- "gorm.io/gen"
- "gorm.io/gen/field"
- "gorm.io/plugin/dbresolver"
- "git.rtzhtech.cn/iss/public-lib/model"
- )
- func newLinkRelationObj(db *gorm.DB) linkRelationObj {
- _linkRelationObj := linkRelationObj{}
- _linkRelationObj.linkRelationObjDo.UseDB(db)
- _linkRelationObj.linkRelationObjDo.UseModel(&model.LinkRelationObj{})
- tableName := _linkRelationObj.linkRelationObjDo.TableName()
- _linkRelationObj.ALL = field.NewField(tableName, "*")
- _linkRelationObj.ID = field.NewInt32(tableName, "id")
- _linkRelationObj.Strategyid = field.NewInt64(tableName, "strategyid")
- _linkRelationObj.Linkfromid = field.NewInt64(tableName, "linkfromid")
- _linkRelationObj.Value = field.NewString(tableName, "value")
- _linkRelationObj.Than = field.NewInt32(tableName, "than")
- _linkRelationObj.Relation = field.NewInt32(tableName, "relation")
- _linkRelationObj.CreateAt = field.NewTime(tableName, "create_at")
- _linkRelationObj.UpdateAt = field.NewTime(tableName, "update_at")
- _linkRelationObj.fillFieldMap()
- _linkRelationObj.Base = newBase(tableName, db)
- return _linkRelationObj
- }
- type linkRelationObj struct {
- linkRelationObjDo
- ALL field.Field
- ID field.Int32
- Strategyid field.Int64
- Linkfromid field.Int64
- Value field.String
- Than field.Int32
- Relation field.Int32
- CreateAt field.Time
- UpdateAt field.Time
- fieldMap map[string]field.Expr
- }
- func (l linkRelationObj) Table(newTableName string) *linkRelationObj {
- l.linkRelationObjDo.UseTable(newTableName)
- return l.updateTableName(newTableName)
- }
- func (l linkRelationObj) As(alias string) *linkRelationObj {
- l.linkRelationObjDo.DO = *(l.linkRelationObjDo.As(alias).(*gen.DO))
- return l.updateTableName(alias)
- }
- func (l *linkRelationObj) updateTableName(table string) *linkRelationObj {
- l.ALL = field.NewField(table, "*")
- l.ID = field.NewInt32(table, "id")
- l.Strategyid = field.NewInt64(table, "strategyid")
- l.Linkfromid = field.NewInt64(table, "linkfromid")
- l.Value = field.NewString(table, "value")
- l.Than = field.NewInt32(table, "than")
- l.Relation = field.NewInt32(table, "relation")
- l.CreateAt = field.NewTime(table, "create_at")
- l.UpdateAt = field.NewTime(table, "update_at")
- l.fillFieldMap()
- return l
- }
- func (l *linkRelationObj) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
- _f, ok := l.fieldMap[fieldName]
- if !ok || _f == nil {
- return nil, false
- }
- _oe, ok := _f.(field.OrderExpr)
- return _oe, ok
- }
- func (l *linkRelationObj) fillFieldMap() {
- l.fieldMap = make(map[string]field.Expr, 8)
- l.fieldMap["id"] = l.ID
- l.fieldMap["strategyid"] = l.Strategyid
- l.fieldMap["linkfromid"] = l.Linkfromid
- l.fieldMap["value"] = l.Value
- l.fieldMap["than"] = l.Than
- l.fieldMap["relation"] = l.Relation
- l.fieldMap["create_at"] = l.CreateAt
- l.fieldMap["update_at"] = l.UpdateAt
- }
- func (l linkRelationObj) clone(db *gorm.DB) linkRelationObj {
- l.linkRelationObjDo.ReplaceDB(db)
- return l
- }
- type linkRelationObjDo struct {
- gen.DO
- Base *Base
- }
- func (l linkRelationObjDo) Debug() *linkRelationObjDo {
- return l.withDO(l.DO.Debug())
- }
- func (l linkRelationObjDo) WithContext(ctx context.Context) *linkRelationObjDo {
- return l.withDO(l.DO.WithContext(ctx))
- }
- func (l linkRelationObjDo) ReadDB() *linkRelationObjDo {
- return l.Clauses(dbresolver.Read)
- }
- func (l linkRelationObjDo) WriteDB() *linkRelationObjDo {
- return l.Clauses(dbresolver.Write)
- }
- func (l linkRelationObjDo) Clauses(conds ...clause.Expression) *linkRelationObjDo {
- return l.withDO(l.DO.Clauses(conds...))
- }
- func (l linkRelationObjDo) Returning(value interface{}, columns ...string) *linkRelationObjDo {
- return l.withDO(l.DO.Returning(value, columns...))
- }
- func (l linkRelationObjDo) Not(conds ...gen.Condition) *linkRelationObjDo {
- return l.withDO(l.DO.Not(conds...))
- }
- func (l linkRelationObjDo) Or(conds ...gen.Condition) *linkRelationObjDo {
- return l.withDO(l.DO.Or(conds...))
- }
- func (l linkRelationObjDo) Select(conds ...field.Expr) *linkRelationObjDo {
- return l.withDO(l.DO.Select(conds...))
- }
- func (l linkRelationObjDo) Where(conds ...gen.Condition) *linkRelationObjDo {
- return l.withDO(l.DO.Where(conds...))
- }
- func (l linkRelationObjDo) Exists(subquery interface{ UnderlyingDB() *gorm.DB }) *linkRelationObjDo {
- return l.Where(field.CompareSubQuery(field.ExistsOp, nil, subquery.UnderlyingDB()))
- }
- func (l linkRelationObjDo) Order(conds ...field.Expr) *linkRelationObjDo {
- return l.withDO(l.DO.Order(conds...))
- }
- func (l linkRelationObjDo) Distinct(cols ...field.Expr) *linkRelationObjDo {
- return l.withDO(l.DO.Distinct(cols...))
- }
- func (l linkRelationObjDo) Omit(cols ...field.Expr) *linkRelationObjDo {
- return l.withDO(l.DO.Omit(cols...))
- }
- func (l linkRelationObjDo) Join(table schema.Tabler, on ...field.Expr) *linkRelationObjDo {
- return l.withDO(l.DO.Join(table, on...))
- }
- func (l linkRelationObjDo) LeftJoin(table schema.Tabler, on ...field.Expr) *linkRelationObjDo {
- return l.withDO(l.DO.LeftJoin(table, on...))
- }
- func (l linkRelationObjDo) RightJoin(table schema.Tabler, on ...field.Expr) *linkRelationObjDo {
- return l.withDO(l.DO.RightJoin(table, on...))
- }
- func (l linkRelationObjDo) Group(cols ...field.Expr) *linkRelationObjDo {
- return l.withDO(l.DO.Group(cols...))
- }
- func (l linkRelationObjDo) Having(conds ...gen.Condition) *linkRelationObjDo {
- return l.withDO(l.DO.Having(conds...))
- }
- func (l linkRelationObjDo) Limit(limit int) *linkRelationObjDo {
- return l.withDO(l.DO.Limit(limit))
- }
- func (l linkRelationObjDo) Offset(offset int) *linkRelationObjDo {
- return l.withDO(l.DO.Offset(offset))
- }
- func (l linkRelationObjDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *linkRelationObjDo {
- return l.withDO(l.DO.Scopes(funcs...))
- }
- func (l linkRelationObjDo) Unscoped() *linkRelationObjDo {
- return l.withDO(l.DO.Unscoped())
- }
- func (l linkRelationObjDo) Create(values ...*model.LinkRelationObj) error {
- if len(values) == 0 {
- return nil
- }
- return l.DO.Create(values)
- }
- func (l linkRelationObjDo) CreateInBatches(values []*model.LinkRelationObj, batchSize int) error {
- return l.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 (l linkRelationObjDo) Save(values ...*model.LinkRelationObj) error {
- if len(values) == 0 {
- return nil
- }
- return l.DO.Save(values)
- }
- func (l linkRelationObjDo) First() (*model.LinkRelationObj, error) {
- if result, err := l.DO.First(); err != nil {
- return nil, err
- } else {
- return result.(*model.LinkRelationObj), nil
- }
- }
- func (l linkRelationObjDo) Take() (*model.LinkRelationObj, error) {
- if result, err := l.DO.Take(); err != nil {
- return nil, err
- } else {
- return result.(*model.LinkRelationObj), nil
- }
- }
- func (l linkRelationObjDo) Last() (*model.LinkRelationObj, error) {
- if result, err := l.DO.Last(); err != nil {
- return nil, err
- } else {
- return result.(*model.LinkRelationObj), nil
- }
- }
- func (l linkRelationObjDo) Find() ([]*model.LinkRelationObj, error) {
- result, err := l.DO.Find()
- return result.([]*model.LinkRelationObj), err
- }
- func (l linkRelationObjDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.LinkRelationObj, err error) {
- buf := make([]*model.LinkRelationObj, 0, batchSize)
- err = l.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 (l linkRelationObjDo) FindInBatches(result *[]*model.LinkRelationObj, batchSize int, fc func(tx gen.Dao, batch int) error) error {
- return l.DO.FindInBatches(result, batchSize, fc)
- }
- func (l linkRelationObjDo) Attrs(attrs ...field.AssignExpr) *linkRelationObjDo {
- return l.withDO(l.DO.Attrs(attrs...))
- }
- func (l linkRelationObjDo) Assign(attrs ...field.AssignExpr) *linkRelationObjDo {
- return l.withDO(l.DO.Assign(attrs...))
- }
- func (l linkRelationObjDo) Joins(fields ...field.RelationField) *linkRelationObjDo {
- for _, _f := range fields {
- l = *l.withDO(l.DO.Joins(_f))
- }
- return &l
- }
- func (l linkRelationObjDo) Preload(fields ...field.RelationField) *linkRelationObjDo {
- for _, _f := range fields {
- l = *l.withDO(l.DO.Preload(_f))
- }
- return &l
- }
- func (l linkRelationObjDo) FirstOrInit() (*model.LinkRelationObj, error) {
- if result, err := l.DO.FirstOrInit(); err != nil {
- return nil, err
- } else {
- return result.(*model.LinkRelationObj), nil
- }
- }
- func (l linkRelationObjDo) FirstOrCreate() (*model.LinkRelationObj, error) {
- if result, err := l.DO.FirstOrCreate(); err != nil {
- return nil, err
- } else {
- return result.(*model.LinkRelationObj), nil
- }
- }
- func (l linkRelationObjDo) FindByPage(offset int, limit int) (result []*model.LinkRelationObj, count int64, err error) {
- result, err = l.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 = l.Offset(-1).Limit(-1).Count()
- return
- }
- func (l linkRelationObjDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
- count, err = l.Count()
- if err != nil {
- return
- }
- err = l.Offset(offset).Limit(limit).Scan(result)
- return
- }
- func (l linkRelationObjDo) Scan(result interface{}) (err error) {
- return l.DO.Scan(result)
- }
- func (l linkRelationObjDo) Delete(models ...*model.LinkRelationObj) (result gen.ResultInfo, err error) {
- return l.DO.Delete(models)
- }
- func (l *linkRelationObjDo) withDO(do gen.Dao) *linkRelationObjDo {
- l.DO = *do.(*gen.DO)
- return l
- }
|