123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367 |
- // 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 newVideoDevinfo(db *gorm.DB) videoDevinfo {
- _videoDevinfo := videoDevinfo{}
- _videoDevinfo.videoDevinfoDo.UseDB(db)
- _videoDevinfo.videoDevinfoDo.UseModel(&model.VideoDevinfo{})
- tableName := _videoDevinfo.videoDevinfoDo.TableName()
- _videoDevinfo.ALL = field.NewField(tableName, "*")
- _videoDevinfo.ID = field.NewInt32(tableName, "id")
- _videoDevinfo.Deviceid = field.NewInt32(tableName, "deviceid")
- _videoDevinfo.Devicename = field.NewString(tableName, "devicename")
- _videoDevinfo.Devicecode = field.NewInt32(tableName, "devicecode")
- _videoDevinfo.Stationid = field.NewInt32(tableName, "stationid")
- _videoDevinfo.Appid = field.NewInt32(tableName, "appid")
- _videoDevinfo.IP = field.NewString(tableName, "ip")
- _videoDevinfo.Manufacturer = field.NewString(tableName, "manufacturer")
- _videoDevinfo.Model = field.NewString(tableName, "model")
- _videoDevinfo.Rtspurl = field.NewString(tableName, "rtspurl")
- _videoDevinfo.Online = field.NewInt32(tableName, "online")
- _videoDevinfo.CreateAt = field.NewTime(tableName, "create_at")
- _videoDevinfo.UpdateAt = field.NewTime(tableName, "update_at")
- _videoDevinfo.fillFieldMap()
- _videoDevinfo.Base = newBase(tableName, db)
- return _videoDevinfo
- }
- type videoDevinfo struct {
- videoDevinfoDo
- ALL field.Field
- ID field.Int32
- Deviceid field.Int32
- Devicename field.String
- Devicecode field.Int32
- Stationid field.Int32
- Appid field.Int32
- IP field.String
- Manufacturer field.String
- Model field.String
- Rtspurl field.String
- Online field.Int32
- CreateAt field.Time
- UpdateAt field.Time
- fieldMap map[string]field.Expr
- }
- func (v videoDevinfo) Table(newTableName string) *videoDevinfo {
- v.videoDevinfoDo.UseTable(newTableName)
- return v.updateTableName(newTableName)
- }
- func (v videoDevinfo) As(alias string) *videoDevinfo {
- v.videoDevinfoDo.DO = *(v.videoDevinfoDo.As(alias).(*gen.DO))
- return v.updateTableName(alias)
- }
- func (v *videoDevinfo) updateTableName(table string) *videoDevinfo {
- v.ALL = field.NewField(table, "*")
- v.ID = field.NewInt32(table, "id")
- v.Deviceid = field.NewInt32(table, "deviceid")
- v.Devicename = field.NewString(table, "devicename")
- v.Devicecode = field.NewInt32(table, "devicecode")
- v.Stationid = field.NewInt32(table, "stationid")
- v.Appid = field.NewInt32(table, "appid")
- v.IP = field.NewString(table, "ip")
- v.Manufacturer = field.NewString(table, "manufacturer")
- v.Model = field.NewString(table, "model")
- v.Rtspurl = field.NewString(table, "rtspurl")
- v.Online = field.NewInt32(table, "online")
- v.CreateAt = field.NewTime(table, "create_at")
- v.UpdateAt = field.NewTime(table, "update_at")
- v.fillFieldMap()
- return v
- }
- func (v *videoDevinfo) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
- _f, ok := v.fieldMap[fieldName]
- if !ok || _f == nil {
- return nil, false
- }
- _oe, ok := _f.(field.OrderExpr)
- return _oe, ok
- }
- func (v *videoDevinfo) fillFieldMap() {
- v.fieldMap = make(map[string]field.Expr, 13)
- v.fieldMap["id"] = v.ID
- v.fieldMap["deviceid"] = v.Deviceid
- v.fieldMap["devicename"] = v.Devicename
- v.fieldMap["devicecode"] = v.Devicecode
- v.fieldMap["stationid"] = v.Stationid
- v.fieldMap["appid"] = v.Appid
- v.fieldMap["ip"] = v.IP
- v.fieldMap["manufacturer"] = v.Manufacturer
- v.fieldMap["model"] = v.Model
- v.fieldMap["rtspurl"] = v.Rtspurl
- v.fieldMap["online"] = v.Online
- v.fieldMap["create_at"] = v.CreateAt
- v.fieldMap["update_at"] = v.UpdateAt
- }
- func (v videoDevinfo) clone(db *gorm.DB) videoDevinfo {
- v.videoDevinfoDo.ReplaceDB(db)
- return v
- }
- type videoDevinfoDo struct {
- gen.DO
- Base *Base
- }
- func (v videoDevinfoDo) Debug() *videoDevinfoDo {
- return v.withDO(v.DO.Debug())
- }
- func (v videoDevinfoDo) WithContext(ctx context.Context) *videoDevinfoDo {
- return v.withDO(v.DO.WithContext(ctx))
- }
- func (v videoDevinfoDo) ReadDB() *videoDevinfoDo {
- return v.Clauses(dbresolver.Read)
- }
- func (v videoDevinfoDo) WriteDB() *videoDevinfoDo {
- return v.Clauses(dbresolver.Write)
- }
- func (v videoDevinfoDo) Clauses(conds ...clause.Expression) *videoDevinfoDo {
- return v.withDO(v.DO.Clauses(conds...))
- }
- func (v videoDevinfoDo) Returning(value interface{}, columns ...string) *videoDevinfoDo {
- return v.withDO(v.DO.Returning(value, columns...))
- }
- func (v videoDevinfoDo) Not(conds ...gen.Condition) *videoDevinfoDo {
- return v.withDO(v.DO.Not(conds...))
- }
- func (v videoDevinfoDo) Or(conds ...gen.Condition) *videoDevinfoDo {
- return v.withDO(v.DO.Or(conds...))
- }
- func (v videoDevinfoDo) Select(conds ...field.Expr) *videoDevinfoDo {
- return v.withDO(v.DO.Select(conds...))
- }
- func (v videoDevinfoDo) Where(conds ...gen.Condition) *videoDevinfoDo {
- return v.withDO(v.DO.Where(conds...))
- }
- func (v videoDevinfoDo) Exists(subquery interface{ UnderlyingDB() *gorm.DB }) *videoDevinfoDo {
- return v.Where(field.CompareSubQuery(field.ExistsOp, nil, subquery.UnderlyingDB()))
- }
- func (v videoDevinfoDo) Order(conds ...field.Expr) *videoDevinfoDo {
- return v.withDO(v.DO.Order(conds...))
- }
- func (v videoDevinfoDo) Distinct(cols ...field.Expr) *videoDevinfoDo {
- return v.withDO(v.DO.Distinct(cols...))
- }
- func (v videoDevinfoDo) Omit(cols ...field.Expr) *videoDevinfoDo {
- return v.withDO(v.DO.Omit(cols...))
- }
- func (v videoDevinfoDo) Join(table schema.Tabler, on ...field.Expr) *videoDevinfoDo {
- return v.withDO(v.DO.Join(table, on...))
- }
- func (v videoDevinfoDo) LeftJoin(table schema.Tabler, on ...field.Expr) *videoDevinfoDo {
- return v.withDO(v.DO.LeftJoin(table, on...))
- }
- func (v videoDevinfoDo) RightJoin(table schema.Tabler, on ...field.Expr) *videoDevinfoDo {
- return v.withDO(v.DO.RightJoin(table, on...))
- }
- func (v videoDevinfoDo) Group(cols ...field.Expr) *videoDevinfoDo {
- return v.withDO(v.DO.Group(cols...))
- }
- func (v videoDevinfoDo) Having(conds ...gen.Condition) *videoDevinfoDo {
- return v.withDO(v.DO.Having(conds...))
- }
- func (v videoDevinfoDo) Limit(limit int) *videoDevinfoDo {
- return v.withDO(v.DO.Limit(limit))
- }
- func (v videoDevinfoDo) Offset(offset int) *videoDevinfoDo {
- return v.withDO(v.DO.Offset(offset))
- }
- func (v videoDevinfoDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *videoDevinfoDo {
- return v.withDO(v.DO.Scopes(funcs...))
- }
- func (v videoDevinfoDo) Unscoped() *videoDevinfoDo {
- return v.withDO(v.DO.Unscoped())
- }
- func (v videoDevinfoDo) Create(values ...*model.VideoDevinfo) error {
- if len(values) == 0 {
- return nil
- }
- return v.DO.Create(values)
- }
- func (v videoDevinfoDo) CreateInBatches(values []*model.VideoDevinfo, batchSize int) error {
- return v.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 (v videoDevinfoDo) Save(values ...*model.VideoDevinfo) error {
- if len(values) == 0 {
- return nil
- }
- return v.DO.Save(values)
- }
- func (v videoDevinfoDo) First() (*model.VideoDevinfo, error) {
- if result, err := v.DO.First(); err != nil {
- return nil, err
- } else {
- return result.(*model.VideoDevinfo), nil
- }
- }
- func (v videoDevinfoDo) Take() (*model.VideoDevinfo, error) {
- if result, err := v.DO.Take(); err != nil {
- return nil, err
- } else {
- return result.(*model.VideoDevinfo), nil
- }
- }
- func (v videoDevinfoDo) Last() (*model.VideoDevinfo, error) {
- if result, err := v.DO.Last(); err != nil {
- return nil, err
- } else {
- return result.(*model.VideoDevinfo), nil
- }
- }
- func (v videoDevinfoDo) Find() ([]*model.VideoDevinfo, error) {
- result, err := v.DO.Find()
- return result.([]*model.VideoDevinfo), err
- }
- func (v videoDevinfoDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.VideoDevinfo, err error) {
- buf := make([]*model.VideoDevinfo, 0, batchSize)
- err = v.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 (v videoDevinfoDo) FindInBatches(result *[]*model.VideoDevinfo, batchSize int, fc func(tx gen.Dao, batch int) error) error {
- return v.DO.FindInBatches(result, batchSize, fc)
- }
- func (v videoDevinfoDo) Attrs(attrs ...field.AssignExpr) *videoDevinfoDo {
- return v.withDO(v.DO.Attrs(attrs...))
- }
- func (v videoDevinfoDo) Assign(attrs ...field.AssignExpr) *videoDevinfoDo {
- return v.withDO(v.DO.Assign(attrs...))
- }
- func (v videoDevinfoDo) Joins(fields ...field.RelationField) *videoDevinfoDo {
- for _, _f := range fields {
- v = *v.withDO(v.DO.Joins(_f))
- }
- return &v
- }
- func (v videoDevinfoDo) Preload(fields ...field.RelationField) *videoDevinfoDo {
- for _, _f := range fields {
- v = *v.withDO(v.DO.Preload(_f))
- }
- return &v
- }
- func (v videoDevinfoDo) FirstOrInit() (*model.VideoDevinfo, error) {
- if result, err := v.DO.FirstOrInit(); err != nil {
- return nil, err
- } else {
- return result.(*model.VideoDevinfo), nil
- }
- }
- func (v videoDevinfoDo) FirstOrCreate() (*model.VideoDevinfo, error) {
- if result, err := v.DO.FirstOrCreate(); err != nil {
- return nil, err
- } else {
- return result.(*model.VideoDevinfo), nil
- }
- }
- func (v videoDevinfoDo) FindByPage(offset int, limit int) (result []*model.VideoDevinfo, count int64, err error) {
- result, err = v.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 = v.Offset(-1).Limit(-1).Count()
- return
- }
- func (v videoDevinfoDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
- count, err = v.Count()
- if err != nil {
- return
- }
- err = v.Offset(offset).Limit(limit).Scan(result)
- return
- }
- func (v videoDevinfoDo) Scan(result interface{}) (err error) {
- return v.DO.Scan(result)
- }
- func (v videoDevinfoDo) Delete(models ...*model.VideoDevinfo) (result gen.ResultInfo, err error) {
- return v.DO.Delete(models)
- }
- func (v *videoDevinfoDo) withDO(do gen.Dao) *videoDevinfoDo {
- v.DO = *do.(*gen.DO)
- return v
- }
|