// 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 newNoteTag(db *gorm.DB, opts ...gen.DOOption) noteTag {
	_noteTag := noteTag{}

	_noteTag.noteTagDo.UseDB(db, opts...)
	_noteTag.noteTagDo.UseModel(&models.NoteTag{})

	tableName := _noteTag.noteTagDo.TableName()
	_noteTag.ALL = field.NewAsterisk(tableName)
	_noteTag.ID = field.NewUint64(tableName, "id")
	_noteTag.NoteId = field.NewString(tableName, "note_id")
	_noteTag.Tag = field.NewString(tableName, "tag")
	_noteTag.Note = noteTagBelongsToNote{
		db: db.Session(&gorm.Session{}),

		RelationField: field.NewRelation("Note", "models.Note"),
		Creator: struct {
			field.RelationField
			Server struct {
				field.RelationField
				Icon struct {
					field.RelationField
				}
			}
			Icon struct {
				field.RelationField
			}
			Background struct {
				field.RelationField
			}
			Banner struct {
				field.RelationField
			}
			RemoteInfo struct {
				field.RelationField
				User struct {
					field.RelationField
				}
			}
			InfoFields struct {
				field.RelationField
				User struct {
					field.RelationField
				}
			}
			BeingTypes struct {
				field.RelationField
				User struct {
					field.RelationField
				}
			}
			Tags struct {
				field.RelationField
				User struct {
					field.RelationField
				}
			}
			Relations struct {
				field.RelationField
				User struct {
					field.RelationField
				}
				TargetUser struct {
					field.RelationField
				}
			}
			Pronouns struct {
				field.RelationField
				User struct {
					field.RelationField
				}
			}
			Roles struct {
				field.RelationField
				User struct {
					field.RelationField
				}
				Role struct {
					field.RelationField
				}
			}
			AuthMethods struct {
				field.RelationField
				User struct {
					field.RelationField
				}
			}
		}{
			RelationField: field.NewRelation("Note.Creator", "models.User"),
			Server: struct {
				field.RelationField
				Icon struct {
					field.RelationField
				}
			}{
				RelationField: field.NewRelation("Note.Creator.Server", "models.RemoteServer"),
				Icon: struct {
					field.RelationField
				}{
					RelationField: field.NewRelation("Note.Creator.Server.Icon", "models.MediaMetadata"),
				},
			},
			Icon: struct {
				field.RelationField
			}{
				RelationField: field.NewRelation("Note.Creator.Icon", "models.MediaMetadata"),
			},
			Background: struct {
				field.RelationField
			}{
				RelationField: field.NewRelation("Note.Creator.Background", "models.MediaMetadata"),
			},
			Banner: struct {
				field.RelationField
			}{
				RelationField: field.NewRelation("Note.Creator.Banner", "models.MediaMetadata"),
			},
			RemoteInfo: struct {
				field.RelationField
				User struct {
					field.RelationField
				}
			}{
				RelationField: field.NewRelation("Note.Creator.RemoteInfo", "models.UserRemoteLinks"),
				User: struct {
					field.RelationField
				}{
					RelationField: field.NewRelation("Note.Creator.RemoteInfo.User", "models.User"),
				},
			},
			InfoFields: struct {
				field.RelationField
				User struct {
					field.RelationField
				}
			}{
				RelationField: field.NewRelation("Note.Creator.InfoFields", "models.UserInfoField"),
				User: struct {
					field.RelationField
				}{
					RelationField: field.NewRelation("Note.Creator.InfoFields.User", "models.User"),
				},
			},
			BeingTypes: struct {
				field.RelationField
				User struct {
					field.RelationField
				}
			}{
				RelationField: field.NewRelation("Note.Creator.BeingTypes", "models.UserToBeing"),
				User: struct {
					field.RelationField
				}{
					RelationField: field.NewRelation("Note.Creator.BeingTypes.User", "models.User"),
				},
			},
			Tags: struct {
				field.RelationField
				User struct {
					field.RelationField
				}
			}{
				RelationField: field.NewRelation("Note.Creator.Tags", "models.UserToTag"),
				User: struct {
					field.RelationField
				}{
					RelationField: field.NewRelation("Note.Creator.Tags.User", "models.User"),
				},
			},
			Relations: struct {
				field.RelationField
				User struct {
					field.RelationField
				}
				TargetUser struct {
					field.RelationField
				}
			}{
				RelationField: field.NewRelation("Note.Creator.Relations", "models.UserToUserRelation"),
				User: struct {
					field.RelationField
				}{
					RelationField: field.NewRelation("Note.Creator.Relations.User", "models.User"),
				},
				TargetUser: struct {
					field.RelationField
				}{
					RelationField: field.NewRelation("Note.Creator.Relations.TargetUser", "models.User"),
				},
			},
			Pronouns: struct {
				field.RelationField
				User struct {
					field.RelationField
				}
			}{
				RelationField: field.NewRelation("Note.Creator.Pronouns", "models.UserToPronoun"),
				User: struct {
					field.RelationField
				}{
					RelationField: field.NewRelation("Note.Creator.Pronouns.User", "models.User"),
				},
			},
			Roles: struct {
				field.RelationField
				User struct {
					field.RelationField
				}
				Role struct {
					field.RelationField
				}
			}{
				RelationField: field.NewRelation("Note.Creator.Roles", "models.UserToRole"),
				User: struct {
					field.RelationField
				}{
					RelationField: field.NewRelation("Note.Creator.Roles.User", "models.User"),
				},
				Role: struct {
					field.RelationField
				}{
					RelationField: field.NewRelation("Note.Creator.Roles.Role", "models.Role"),
				},
			},
			AuthMethods: struct {
				field.RelationField
				User struct {
					field.RelationField
				}
			}{
				RelationField: field.NewRelation("Note.Creator.AuthMethods", "models.UserAuthMethod"),
				User: struct {
					field.RelationField
				}{
					RelationField: field.NewRelation("Note.Creator.AuthMethods.User", "models.User"),
				},
			},
		},
		Origin: struct {
			field.RelationField
		}{
			RelationField: field.NewRelation("Note.Origin", "models.RemoteServer"),
		},
		AttachmentRelations: struct {
			field.RelationField
			Note struct {
				field.RelationField
			}
			Attachment struct {
				field.RelationField
			}
		}{
			RelationField: field.NewRelation("Note.AttachmentRelations", "models.NoteToAttachment"),
			Note: struct {
				field.RelationField
			}{
				RelationField: field.NewRelation("Note.AttachmentRelations.Note", "models.Note"),
			},
			Attachment: struct {
				field.RelationField
			}{
				RelationField: field.NewRelation("Note.AttachmentRelations.Attachment", "models.MediaMetadata"),
			},
		},
		EmoteRelations: struct {
			field.RelationField
			Note struct {
				field.RelationField
			}
			Emote struct {
				field.RelationField
				Metadata struct {
					field.RelationField
				}
				Server struct {
					field.RelationField
				}
			}
		}{
			RelationField: field.NewRelation("Note.EmoteRelations", "models.NoteToEmote"),
			Note: struct {
				field.RelationField
			}{
				RelationField: field.NewRelation("Note.EmoteRelations.Note", "models.Note"),
			},
			Emote: struct {
				field.RelationField
				Metadata struct {
					field.RelationField
				}
				Server struct {
					field.RelationField
				}
			}{
				RelationField: field.NewRelation("Note.EmoteRelations.Emote", "models.Emote"),
				Metadata: struct {
					field.RelationField
				}{
					RelationField: field.NewRelation("Note.EmoteRelations.Emote.Metadata", "models.MediaMetadata"),
				},
				Server: struct {
					field.RelationField
				}{
					RelationField: field.NewRelation("Note.EmoteRelations.Emote.Server", "models.RemoteServer"),
				},
			},
		},
		PingRelations: struct {
			field.RelationField
			Note struct {
				field.RelationField
			}
			PingTarget struct {
				field.RelationField
			}
		}{
			RelationField: field.NewRelation("Note.PingRelations", "models.NoteToPing"),
			Note: struct {
				field.RelationField
			}{
				RelationField: field.NewRelation("Note.PingRelations.Note", "models.Note"),
			},
			PingTarget: struct {
				field.RelationField
			}{
				RelationField: field.NewRelation("Note.PingRelations.PingTarget", "models.User"),
			},
		},
		Tags: struct {
			field.RelationField
			Note struct {
				field.RelationField
			}
		}{
			RelationField: field.NewRelation("Note.Tags", "models.NoteTag"),
			Note: struct {
				field.RelationField
			}{
				RelationField: field.NewRelation("Note.Tags.Note", "models.Note"),
			},
		},
	}

	_noteTag.fillFieldMap()

	return _noteTag
}

type noteTag struct {
	noteTagDo

	ALL    field.Asterisk
	ID     field.Uint64
	NoteId field.String
	Tag    field.String
	Note   noteTagBelongsToNote

	fieldMap map[string]field.Expr
}

func (n noteTag) Table(newTableName string) *noteTag {
	n.noteTagDo.UseTable(newTableName)
	return n.updateTableName(newTableName)
}

func (n noteTag) As(alias string) *noteTag {
	n.noteTagDo.DO = *(n.noteTagDo.As(alias).(*gen.DO))
	return n.updateTableName(alias)
}

func (n *noteTag) updateTableName(table string) *noteTag {
	n.ALL = field.NewAsterisk(table)
	n.ID = field.NewUint64(table, "id")
	n.NoteId = field.NewString(table, "note_id")
	n.Tag = field.NewString(table, "tag")

	n.fillFieldMap()

	return n
}

func (n *noteTag) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
	_f, ok := n.fieldMap[fieldName]
	if !ok || _f == nil {
		return nil, false
	}
	_oe, ok := _f.(field.OrderExpr)
	return _oe, ok
}

func (n *noteTag) fillFieldMap() {
	n.fieldMap = make(map[string]field.Expr, 4)
	n.fieldMap["id"] = n.ID
	n.fieldMap["note_id"] = n.NoteId
	n.fieldMap["tag"] = n.Tag

}

func (n noteTag) clone(db *gorm.DB) noteTag {
	n.noteTagDo.ReplaceConnPool(db.Statement.ConnPool)
	return n
}

func (n noteTag) replaceDB(db *gorm.DB) noteTag {
	n.noteTagDo.ReplaceDB(db)
	return n
}

type noteTagBelongsToNote struct {
	db *gorm.DB

	field.RelationField

	Creator struct {
		field.RelationField
		Server struct {
			field.RelationField
			Icon struct {
				field.RelationField
			}
		}
		Icon struct {
			field.RelationField
		}
		Background struct {
			field.RelationField
		}
		Banner struct {
			field.RelationField
		}
		RemoteInfo struct {
			field.RelationField
			User struct {
				field.RelationField
			}
		}
		InfoFields struct {
			field.RelationField
			User struct {
				field.RelationField
			}
		}
		BeingTypes struct {
			field.RelationField
			User struct {
				field.RelationField
			}
		}
		Tags struct {
			field.RelationField
			User struct {
				field.RelationField
			}
		}
		Relations struct {
			field.RelationField
			User struct {
				field.RelationField
			}
			TargetUser struct {
				field.RelationField
			}
		}
		Pronouns struct {
			field.RelationField
			User struct {
				field.RelationField
			}
		}
		Roles struct {
			field.RelationField
			User struct {
				field.RelationField
			}
			Role struct {
				field.RelationField
			}
		}
		AuthMethods struct {
			field.RelationField
			User struct {
				field.RelationField
			}
		}
	}
	Origin struct {
		field.RelationField
	}
	AttachmentRelations struct {
		field.RelationField
		Note struct {
			field.RelationField
		}
		Attachment struct {
			field.RelationField
		}
	}
	EmoteRelations struct {
		field.RelationField
		Note struct {
			field.RelationField
		}
		Emote struct {
			field.RelationField
			Metadata struct {
				field.RelationField
			}
			Server struct {
				field.RelationField
			}
		}
	}
	PingRelations struct {
		field.RelationField
		Note struct {
			field.RelationField
		}
		PingTarget struct {
			field.RelationField
		}
	}
	Tags struct {
		field.RelationField
		Note struct {
			field.RelationField
		}
	}
}

func (a noteTagBelongsToNote) Where(conds ...field.Expr) *noteTagBelongsToNote {
	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 noteTagBelongsToNote) WithContext(ctx context.Context) *noteTagBelongsToNote {
	a.db = a.db.WithContext(ctx)
	return &a
}

func (a noteTagBelongsToNote) Session(session *gorm.Session) *noteTagBelongsToNote {
	a.db = a.db.Session(session)
	return &a
}

func (a noteTagBelongsToNote) Model(m *models.NoteTag) *noteTagBelongsToNoteTx {
	return &noteTagBelongsToNoteTx{a.db.Model(m).Association(a.Name())}
}

type noteTagBelongsToNoteTx struct{ tx *gorm.Association }

func (a noteTagBelongsToNoteTx) Find() (result *models.Note, err error) {
	return result, a.tx.Find(&result)
}

func (a noteTagBelongsToNoteTx) Append(values ...*models.Note) (err error) {
	targetValues := make([]interface{}, len(values))
	for i, v := range values {
		targetValues[i] = v
	}
	return a.tx.Append(targetValues...)
}

func (a noteTagBelongsToNoteTx) Replace(values ...*models.Note) (err error) {
	targetValues := make([]interface{}, len(values))
	for i, v := range values {
		targetValues[i] = v
	}
	return a.tx.Replace(targetValues...)
}

func (a noteTagBelongsToNoteTx) Delete(values ...*models.Note) (err error) {
	targetValues := make([]interface{}, len(values))
	for i, v := range values {
		targetValues[i] = v
	}
	return a.tx.Delete(targetValues...)
}

func (a noteTagBelongsToNoteTx) Clear() error {
	return a.tx.Clear()
}

func (a noteTagBelongsToNoteTx) Count() int64 {
	return a.tx.Count()
}

type noteTagDo struct{ gen.DO }

type INoteTagDo interface {
	gen.SubQuery
	Debug() INoteTagDo
	WithContext(ctx context.Context) INoteTagDo
	WithResult(fc func(tx gen.Dao)) gen.ResultInfo
	ReplaceDB(db *gorm.DB)
	ReadDB() INoteTagDo
	WriteDB() INoteTagDo
	As(alias string) gen.Dao
	Session(config *gorm.Session) INoteTagDo
	Columns(cols ...field.Expr) gen.Columns
	Clauses(conds ...clause.Expression) INoteTagDo
	Not(conds ...gen.Condition) INoteTagDo
	Or(conds ...gen.Condition) INoteTagDo
	Select(conds ...field.Expr) INoteTagDo
	Where(conds ...gen.Condition) INoteTagDo
	Order(conds ...field.Expr) INoteTagDo
	Distinct(cols ...field.Expr) INoteTagDo
	Omit(cols ...field.Expr) INoteTagDo
	Join(table schema.Tabler, on ...field.Expr) INoteTagDo
	LeftJoin(table schema.Tabler, on ...field.Expr) INoteTagDo
	RightJoin(table schema.Tabler, on ...field.Expr) INoteTagDo
	Group(cols ...field.Expr) INoteTagDo
	Having(conds ...gen.Condition) INoteTagDo
	Limit(limit int) INoteTagDo
	Offset(offset int) INoteTagDo
	Count() (count int64, err error)
	Scopes(funcs ...func(gen.Dao) gen.Dao) INoteTagDo
	Unscoped() INoteTagDo
	Create(values ...*models.NoteTag) error
	CreateInBatches(values []*models.NoteTag, batchSize int) error
	Save(values ...*models.NoteTag) error
	First() (*models.NoteTag, error)
	Take() (*models.NoteTag, error)
	Last() (*models.NoteTag, error)
	Find() ([]*models.NoteTag, error)
	FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.NoteTag, err error)
	FindInBatches(result *[]*models.NoteTag, batchSize int, fc func(tx gen.Dao, batch int) error) error
	Pluck(column field.Expr, dest interface{}) error
	Delete(...*models.NoteTag) (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) INoteTagDo
	Assign(attrs ...field.AssignExpr) INoteTagDo
	Joins(fields ...field.RelationField) INoteTagDo
	Preload(fields ...field.RelationField) INoteTagDo
	FirstOrInit() (*models.NoteTag, error)
	FirstOrCreate() (*models.NoteTag, error)
	FindByPage(offset int, limit int) (result []*models.NoteTag, 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) INoteTagDo
	UnderlyingDB() *gorm.DB
	schema.Tabler
}

func (n noteTagDo) Debug() INoteTagDo {
	return n.withDO(n.DO.Debug())
}

func (n noteTagDo) WithContext(ctx context.Context) INoteTagDo {
	return n.withDO(n.DO.WithContext(ctx))
}

func (n noteTagDo) ReadDB() INoteTagDo {
	return n.Clauses(dbresolver.Read)
}

func (n noteTagDo) WriteDB() INoteTagDo {
	return n.Clauses(dbresolver.Write)
}

func (n noteTagDo) Session(config *gorm.Session) INoteTagDo {
	return n.withDO(n.DO.Session(config))
}

func (n noteTagDo) Clauses(conds ...clause.Expression) INoteTagDo {
	return n.withDO(n.DO.Clauses(conds...))
}

func (n noteTagDo) Returning(value interface{}, columns ...string) INoteTagDo {
	return n.withDO(n.DO.Returning(value, columns...))
}

func (n noteTagDo) Not(conds ...gen.Condition) INoteTagDo {
	return n.withDO(n.DO.Not(conds...))
}

func (n noteTagDo) Or(conds ...gen.Condition) INoteTagDo {
	return n.withDO(n.DO.Or(conds...))
}

func (n noteTagDo) Select(conds ...field.Expr) INoteTagDo {
	return n.withDO(n.DO.Select(conds...))
}

func (n noteTagDo) Where(conds ...gen.Condition) INoteTagDo {
	return n.withDO(n.DO.Where(conds...))
}

func (n noteTagDo) Order(conds ...field.Expr) INoteTagDo {
	return n.withDO(n.DO.Order(conds...))
}

func (n noteTagDo) Distinct(cols ...field.Expr) INoteTagDo {
	return n.withDO(n.DO.Distinct(cols...))
}

func (n noteTagDo) Omit(cols ...field.Expr) INoteTagDo {
	return n.withDO(n.DO.Omit(cols...))
}

func (n noteTagDo) Join(table schema.Tabler, on ...field.Expr) INoteTagDo {
	return n.withDO(n.DO.Join(table, on...))
}

func (n noteTagDo) LeftJoin(table schema.Tabler, on ...field.Expr) INoteTagDo {
	return n.withDO(n.DO.LeftJoin(table, on...))
}

func (n noteTagDo) RightJoin(table schema.Tabler, on ...field.Expr) INoteTagDo {
	return n.withDO(n.DO.RightJoin(table, on...))
}

func (n noteTagDo) Group(cols ...field.Expr) INoteTagDo {
	return n.withDO(n.DO.Group(cols...))
}

func (n noteTagDo) Having(conds ...gen.Condition) INoteTagDo {
	return n.withDO(n.DO.Having(conds...))
}

func (n noteTagDo) Limit(limit int) INoteTagDo {
	return n.withDO(n.DO.Limit(limit))
}

func (n noteTagDo) Offset(offset int) INoteTagDo {
	return n.withDO(n.DO.Offset(offset))
}

func (n noteTagDo) Scopes(funcs ...func(gen.Dao) gen.Dao) INoteTagDo {
	return n.withDO(n.DO.Scopes(funcs...))
}

func (n noteTagDo) Unscoped() INoteTagDo {
	return n.withDO(n.DO.Unscoped())
}

func (n noteTagDo) Create(values ...*models.NoteTag) error {
	if len(values) == 0 {
		return nil
	}
	return n.DO.Create(values)
}

func (n noteTagDo) CreateInBatches(values []*models.NoteTag, batchSize int) error {
	return n.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 (n noteTagDo) Save(values ...*models.NoteTag) error {
	if len(values) == 0 {
		return nil
	}
	return n.DO.Save(values)
}

func (n noteTagDo) First() (*models.NoteTag, error) {
	if result, err := n.DO.First(); err != nil {
		return nil, err
	} else {
		return result.(*models.NoteTag), nil
	}
}

func (n noteTagDo) Take() (*models.NoteTag, error) {
	if result, err := n.DO.Take(); err != nil {
		return nil, err
	} else {
		return result.(*models.NoteTag), nil
	}
}

func (n noteTagDo) Last() (*models.NoteTag, error) {
	if result, err := n.DO.Last(); err != nil {
		return nil, err
	} else {
		return result.(*models.NoteTag), nil
	}
}

func (n noteTagDo) Find() ([]*models.NoteTag, error) {
	result, err := n.DO.Find()
	return result.([]*models.NoteTag), err
}

func (n noteTagDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.NoteTag, err error) {
	buf := make([]*models.NoteTag, 0, batchSize)
	err = n.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 (n noteTagDo) FindInBatches(result *[]*models.NoteTag, batchSize int, fc func(tx gen.Dao, batch int) error) error {
	return n.DO.FindInBatches(result, batchSize, fc)
}

func (n noteTagDo) Attrs(attrs ...field.AssignExpr) INoteTagDo {
	return n.withDO(n.DO.Attrs(attrs...))
}

func (n noteTagDo) Assign(attrs ...field.AssignExpr) INoteTagDo {
	return n.withDO(n.DO.Assign(attrs...))
}

func (n noteTagDo) Joins(fields ...field.RelationField) INoteTagDo {
	for _, _f := range fields {
		n = *n.withDO(n.DO.Joins(_f))
	}
	return &n
}

func (n noteTagDo) Preload(fields ...field.RelationField) INoteTagDo {
	for _, _f := range fields {
		n = *n.withDO(n.DO.Preload(_f))
	}
	return &n
}

func (n noteTagDo) FirstOrInit() (*models.NoteTag, error) {
	if result, err := n.DO.FirstOrInit(); err != nil {
		return nil, err
	} else {
		return result.(*models.NoteTag), nil
	}
}

func (n noteTagDo) FirstOrCreate() (*models.NoteTag, error) {
	if result, err := n.DO.FirstOrCreate(); err != nil {
		return nil, err
	} else {
		return result.(*models.NoteTag), nil
	}
}

func (n noteTagDo) FindByPage(offset int, limit int) (result []*models.NoteTag, count int64, err error) {
	result, err = n.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 = n.Offset(-1).Limit(-1).Count()
	return
}

func (n noteTagDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
	count, err = n.Count()
	if err != nil {
		return
	}

	err = n.Offset(offset).Limit(limit).Scan(result)
	return
}

func (n noteTagDo) Scan(result interface{}) (err error) {
	return n.DO.Scan(result)
}

func (n noteTagDo) Delete(models ...*models.NoteTag) (result gen.ResultInfo, err error) {
	return n.DO.Delete(models)
}

func (n *noteTagDo) withDO(do gen.Dao) *noteTagDo {
	n.DO = *do.(*gen.DO)
	return n
}
