map_update.gen.go 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453
  1. // Code generated by gorm.io/gen. DO NOT EDIT.
  2. // Code generated by gorm.io/gen. DO NOT EDIT.
  3. // Code generated by gorm.io/gen. DO NOT EDIT.
  4. package query
  5. import (
  6. "context"
  7. "pji_desktop_http/biz/model"
  8. "gorm.io/gorm"
  9. "gorm.io/gorm/clause"
  10. "gorm.io/gorm/schema"
  11. "gorm.io/gen"
  12. "gorm.io/gen/field"
  13. "gorm.io/plugin/dbresolver"
  14. )
  15. func newMapUpdate(db *gorm.DB, opts ...gen.DOOption) mapUpdate {
  16. _mapUpdate := mapUpdate{}
  17. _mapUpdate.mapUpdateDo.UseDB(db, opts...)
  18. _mapUpdate.mapUpdateDo.UseModel(&model.MapUpdate{})
  19. tableName := _mapUpdate.mapUpdateDo.TableName()
  20. _mapUpdate.ALL = field.NewAsterisk(tableName)
  21. _mapUpdate.ID = field.NewString(tableName, "id")
  22. _mapUpdate.MapID = field.NewString(tableName, "map_id")
  23. _mapUpdate.DeviceID = field.NewString(tableName, "device_id")
  24. _mapUpdate.DeviceName = field.NewString(tableName, "device_name")
  25. _mapUpdate.DeviceType = field.NewString(tableName, "device_type")
  26. _mapUpdate.OriginPgmPath = field.NewString(tableName, "origin_pgm_path")
  27. _mapUpdate.PrePgmPath = field.NewString(tableName, "pre_pgm_path")
  28. _mapUpdate.CurrentPgmPath = field.NewString(tableName, "current_pgm_path")
  29. _mapUpdate.CumulativeUpdateRate = field.NewInt32(tableName, "cumulative_update_rate")
  30. _mapUpdate.UpdateFlag = field.NewInt32(tableName, "update_flag")
  31. _mapUpdate.UpdateSource = field.NewInt32(tableName, "update_source")
  32. _mapUpdate.UpdateTime = field.NewTime(tableName, "update_time")
  33. _mapUpdate.FromSceneList = field.NewString(tableName, "from_scene_list")
  34. _mapUpdate.ValidFlag = field.NewInt32(tableName, "valid_flag")
  35. _mapUpdate.CreatedAt = field.NewTime(tableName, "created_at")
  36. _mapUpdate.UpdatedAt = field.NewTime(tableName, "updated_at")
  37. _mapUpdate.DeletedAt = field.NewField(tableName, "deleted_at")
  38. _mapUpdate.fillFieldMap()
  39. return _mapUpdate
  40. }
  41. type mapUpdate struct {
  42. mapUpdateDo mapUpdateDo
  43. ALL field.Asterisk
  44. ID field.String
  45. MapID field.String
  46. DeviceID field.String
  47. DeviceName field.String
  48. DeviceType field.String
  49. OriginPgmPath field.String
  50. PrePgmPath field.String
  51. CurrentPgmPath field.String
  52. CumulativeUpdateRate field.Int32
  53. UpdateFlag field.Int32
  54. UpdateSource field.Int32
  55. UpdateTime field.Time
  56. FromSceneList field.String
  57. ValidFlag field.Int32
  58. CreatedAt field.Time
  59. UpdatedAt field.Time
  60. DeletedAt field.Field
  61. fieldMap map[string]field.Expr
  62. }
  63. func (m mapUpdate) Table(newTableName string) *mapUpdate {
  64. m.mapUpdateDo.UseTable(newTableName)
  65. return m.updateTableName(newTableName)
  66. }
  67. func (m mapUpdate) As(alias string) *mapUpdate {
  68. m.mapUpdateDo.DO = *(m.mapUpdateDo.As(alias).(*gen.DO))
  69. return m.updateTableName(alias)
  70. }
  71. func (m *mapUpdate) updateTableName(table string) *mapUpdate {
  72. m.ALL = field.NewAsterisk(table)
  73. m.ID = field.NewString(table, "id")
  74. m.MapID = field.NewString(table, "map_id")
  75. m.DeviceID = field.NewString(table, "device_id")
  76. m.DeviceName = field.NewString(table, "device_name")
  77. m.DeviceType = field.NewString(table, "device_type")
  78. m.OriginPgmPath = field.NewString(table, "origin_pgm_path")
  79. m.PrePgmPath = field.NewString(table, "pre_pgm_path")
  80. m.CurrentPgmPath = field.NewString(table, "current_pgm_path")
  81. m.CumulativeUpdateRate = field.NewInt32(table, "cumulative_update_rate")
  82. m.UpdateFlag = field.NewInt32(table, "update_flag")
  83. m.UpdateSource = field.NewInt32(table, "update_source")
  84. m.UpdateTime = field.NewTime(table, "update_time")
  85. m.FromSceneList = field.NewString(table, "from_scene_list")
  86. m.ValidFlag = field.NewInt32(table, "valid_flag")
  87. m.CreatedAt = field.NewTime(table, "created_at")
  88. m.UpdatedAt = field.NewTime(table, "updated_at")
  89. m.DeletedAt = field.NewField(table, "deleted_at")
  90. m.fillFieldMap()
  91. return m
  92. }
  93. func (m *mapUpdate) WithContext(ctx context.Context) IMapUpdateDo {
  94. return m.mapUpdateDo.WithContext(ctx)
  95. }
  96. func (m mapUpdate) TableName() string { return m.mapUpdateDo.TableName() }
  97. func (m mapUpdate) Alias() string { return m.mapUpdateDo.Alias() }
  98. func (m mapUpdate) Columns(cols ...field.Expr) gen.Columns { return m.mapUpdateDo.Columns(cols...) }
  99. func (m *mapUpdate) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
  100. _f, ok := m.fieldMap[fieldName]
  101. if !ok || _f == nil {
  102. return nil, false
  103. }
  104. _oe, ok := _f.(field.OrderExpr)
  105. return _oe, ok
  106. }
  107. func (m *mapUpdate) fillFieldMap() {
  108. m.fieldMap = make(map[string]field.Expr, 17)
  109. m.fieldMap["id"] = m.ID
  110. m.fieldMap["map_id"] = m.MapID
  111. m.fieldMap["device_id"] = m.DeviceID
  112. m.fieldMap["device_name"] = m.DeviceName
  113. m.fieldMap["device_type"] = m.DeviceType
  114. m.fieldMap["origin_pgm_path"] = m.OriginPgmPath
  115. m.fieldMap["pre_pgm_path"] = m.PrePgmPath
  116. m.fieldMap["current_pgm_path"] = m.CurrentPgmPath
  117. m.fieldMap["cumulative_update_rate"] = m.CumulativeUpdateRate
  118. m.fieldMap["update_flag"] = m.UpdateFlag
  119. m.fieldMap["update_source"] = m.UpdateSource
  120. m.fieldMap["update_time"] = m.UpdateTime
  121. m.fieldMap["from_scene_list"] = m.FromSceneList
  122. m.fieldMap["valid_flag"] = m.ValidFlag
  123. m.fieldMap["created_at"] = m.CreatedAt
  124. m.fieldMap["updated_at"] = m.UpdatedAt
  125. m.fieldMap["deleted_at"] = m.DeletedAt
  126. }
  127. func (m mapUpdate) clone(db *gorm.DB) mapUpdate {
  128. m.mapUpdateDo.ReplaceConnPool(db.Statement.ConnPool)
  129. return m
  130. }
  131. func (m mapUpdate) replaceDB(db *gorm.DB) mapUpdate {
  132. m.mapUpdateDo.ReplaceDB(db)
  133. return m
  134. }
  135. type mapUpdateDo struct{ gen.DO }
  136. type IMapUpdateDo interface {
  137. gen.SubQuery
  138. Debug() IMapUpdateDo
  139. WithContext(ctx context.Context) IMapUpdateDo
  140. WithResult(fc func(tx gen.Dao)) gen.ResultInfo
  141. ReplaceDB(db *gorm.DB)
  142. ReadDB() IMapUpdateDo
  143. WriteDB() IMapUpdateDo
  144. As(alias string) gen.Dao
  145. Session(config *gorm.Session) IMapUpdateDo
  146. Columns(cols ...field.Expr) gen.Columns
  147. Clauses(conds ...clause.Expression) IMapUpdateDo
  148. Not(conds ...gen.Condition) IMapUpdateDo
  149. Or(conds ...gen.Condition) IMapUpdateDo
  150. Select(conds ...field.Expr) IMapUpdateDo
  151. Where(conds ...gen.Condition) IMapUpdateDo
  152. Order(conds ...field.Expr) IMapUpdateDo
  153. Distinct(cols ...field.Expr) IMapUpdateDo
  154. Omit(cols ...field.Expr) IMapUpdateDo
  155. Join(table schema.Tabler, on ...field.Expr) IMapUpdateDo
  156. LeftJoin(table schema.Tabler, on ...field.Expr) IMapUpdateDo
  157. RightJoin(table schema.Tabler, on ...field.Expr) IMapUpdateDo
  158. Group(cols ...field.Expr) IMapUpdateDo
  159. Having(conds ...gen.Condition) IMapUpdateDo
  160. Limit(limit int) IMapUpdateDo
  161. Offset(offset int) IMapUpdateDo
  162. Count() (count int64, err error)
  163. Scopes(funcs ...func(gen.Dao) gen.Dao) IMapUpdateDo
  164. Unscoped() IMapUpdateDo
  165. Create(values ...*model.MapUpdate) error
  166. CreateInBatches(values []*model.MapUpdate, batchSize int) error
  167. Save(values ...*model.MapUpdate) error
  168. First() (*model.MapUpdate, error)
  169. Take() (*model.MapUpdate, error)
  170. Last() (*model.MapUpdate, error)
  171. Find() ([]*model.MapUpdate, error)
  172. FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.MapUpdate, err error)
  173. FindInBatches(result *[]*model.MapUpdate, batchSize int, fc func(tx gen.Dao, batch int) error) error
  174. Pluck(column field.Expr, dest interface{}) error
  175. Delete(...*model.MapUpdate) (info gen.ResultInfo, err error)
  176. Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
  177. UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
  178. Updates(value interface{}) (info gen.ResultInfo, err error)
  179. UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
  180. UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
  181. UpdateColumns(value interface{}) (info gen.ResultInfo, err error)
  182. UpdateFrom(q gen.SubQuery) gen.Dao
  183. Attrs(attrs ...field.AssignExpr) IMapUpdateDo
  184. Assign(attrs ...field.AssignExpr) IMapUpdateDo
  185. Joins(fields ...field.RelationField) IMapUpdateDo
  186. Preload(fields ...field.RelationField) IMapUpdateDo
  187. FirstOrInit() (*model.MapUpdate, error)
  188. FirstOrCreate() (*model.MapUpdate, error)
  189. FindByPage(offset int, limit int) (result []*model.MapUpdate, count int64, err error)
  190. ScanByPage(result interface{}, offset int, limit int) (count int64, err error)
  191. Scan(result interface{}) (err error)
  192. Returning(value interface{}, columns ...string) IMapUpdateDo
  193. UnderlyingDB() *gorm.DB
  194. schema.Tabler
  195. }
  196. func (m mapUpdateDo) Debug() IMapUpdateDo {
  197. return m.withDO(m.DO.Debug())
  198. }
  199. func (m mapUpdateDo) WithContext(ctx context.Context) IMapUpdateDo {
  200. return m.withDO(m.DO.WithContext(ctx))
  201. }
  202. func (m mapUpdateDo) ReadDB() IMapUpdateDo {
  203. return m.Clauses(dbresolver.Read)
  204. }
  205. func (m mapUpdateDo) WriteDB() IMapUpdateDo {
  206. return m.Clauses(dbresolver.Write)
  207. }
  208. func (m mapUpdateDo) Session(config *gorm.Session) IMapUpdateDo {
  209. return m.withDO(m.DO.Session(config))
  210. }
  211. func (m mapUpdateDo) Clauses(conds ...clause.Expression) IMapUpdateDo {
  212. return m.withDO(m.DO.Clauses(conds...))
  213. }
  214. func (m mapUpdateDo) Returning(value interface{}, columns ...string) IMapUpdateDo {
  215. return m.withDO(m.DO.Returning(value, columns...))
  216. }
  217. func (m mapUpdateDo) Not(conds ...gen.Condition) IMapUpdateDo {
  218. return m.withDO(m.DO.Not(conds...))
  219. }
  220. func (m mapUpdateDo) Or(conds ...gen.Condition) IMapUpdateDo {
  221. return m.withDO(m.DO.Or(conds...))
  222. }
  223. func (m mapUpdateDo) Select(conds ...field.Expr) IMapUpdateDo {
  224. return m.withDO(m.DO.Select(conds...))
  225. }
  226. func (m mapUpdateDo) Where(conds ...gen.Condition) IMapUpdateDo {
  227. return m.withDO(m.DO.Where(conds...))
  228. }
  229. func (m mapUpdateDo) Order(conds ...field.Expr) IMapUpdateDo {
  230. return m.withDO(m.DO.Order(conds...))
  231. }
  232. func (m mapUpdateDo) Distinct(cols ...field.Expr) IMapUpdateDo {
  233. return m.withDO(m.DO.Distinct(cols...))
  234. }
  235. func (m mapUpdateDo) Omit(cols ...field.Expr) IMapUpdateDo {
  236. return m.withDO(m.DO.Omit(cols...))
  237. }
  238. func (m mapUpdateDo) Join(table schema.Tabler, on ...field.Expr) IMapUpdateDo {
  239. return m.withDO(m.DO.Join(table, on...))
  240. }
  241. func (m mapUpdateDo) LeftJoin(table schema.Tabler, on ...field.Expr) IMapUpdateDo {
  242. return m.withDO(m.DO.LeftJoin(table, on...))
  243. }
  244. func (m mapUpdateDo) RightJoin(table schema.Tabler, on ...field.Expr) IMapUpdateDo {
  245. return m.withDO(m.DO.RightJoin(table, on...))
  246. }
  247. func (m mapUpdateDo) Group(cols ...field.Expr) IMapUpdateDo {
  248. return m.withDO(m.DO.Group(cols...))
  249. }
  250. func (m mapUpdateDo) Having(conds ...gen.Condition) IMapUpdateDo {
  251. return m.withDO(m.DO.Having(conds...))
  252. }
  253. func (m mapUpdateDo) Limit(limit int) IMapUpdateDo {
  254. return m.withDO(m.DO.Limit(limit))
  255. }
  256. func (m mapUpdateDo) Offset(offset int) IMapUpdateDo {
  257. return m.withDO(m.DO.Offset(offset))
  258. }
  259. func (m mapUpdateDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IMapUpdateDo {
  260. return m.withDO(m.DO.Scopes(funcs...))
  261. }
  262. func (m mapUpdateDo) Unscoped() IMapUpdateDo {
  263. return m.withDO(m.DO.Unscoped())
  264. }
  265. func (m mapUpdateDo) Create(values ...*model.MapUpdate) error {
  266. if len(values) == 0 {
  267. return nil
  268. }
  269. return m.DO.Create(values)
  270. }
  271. func (m mapUpdateDo) CreateInBatches(values []*model.MapUpdate, batchSize int) error {
  272. return m.DO.CreateInBatches(values, batchSize)
  273. }
  274. // Save : !!! underlying implementation is different with GORM
  275. // The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values)
  276. func (m mapUpdateDo) Save(values ...*model.MapUpdate) error {
  277. if len(values) == 0 {
  278. return nil
  279. }
  280. return m.DO.Save(values)
  281. }
  282. func (m mapUpdateDo) First() (*model.MapUpdate, error) {
  283. if result, err := m.DO.First(); err != nil {
  284. return nil, err
  285. } else {
  286. return result.(*model.MapUpdate), nil
  287. }
  288. }
  289. func (m mapUpdateDo) Take() (*model.MapUpdate, error) {
  290. if result, err := m.DO.Take(); err != nil {
  291. return nil, err
  292. } else {
  293. return result.(*model.MapUpdate), nil
  294. }
  295. }
  296. func (m mapUpdateDo) Last() (*model.MapUpdate, error) {
  297. if result, err := m.DO.Last(); err != nil {
  298. return nil, err
  299. } else {
  300. return result.(*model.MapUpdate), nil
  301. }
  302. }
  303. func (m mapUpdateDo) Find() ([]*model.MapUpdate, error) {
  304. result, err := m.DO.Find()
  305. return result.([]*model.MapUpdate), err
  306. }
  307. func (m mapUpdateDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.MapUpdate, err error) {
  308. buf := make([]*model.MapUpdate, 0, batchSize)
  309. err = m.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error {
  310. defer func() { results = append(results, buf...) }()
  311. return fc(tx, batch)
  312. })
  313. return results, err
  314. }
  315. func (m mapUpdateDo) FindInBatches(result *[]*model.MapUpdate, batchSize int, fc func(tx gen.Dao, batch int) error) error {
  316. return m.DO.FindInBatches(result, batchSize, fc)
  317. }
  318. func (m mapUpdateDo) Attrs(attrs ...field.AssignExpr) IMapUpdateDo {
  319. return m.withDO(m.DO.Attrs(attrs...))
  320. }
  321. func (m mapUpdateDo) Assign(attrs ...field.AssignExpr) IMapUpdateDo {
  322. return m.withDO(m.DO.Assign(attrs...))
  323. }
  324. func (m mapUpdateDo) Joins(fields ...field.RelationField) IMapUpdateDo {
  325. for _, _f := range fields {
  326. m = *m.withDO(m.DO.Joins(_f))
  327. }
  328. return &m
  329. }
  330. func (m mapUpdateDo) Preload(fields ...field.RelationField) IMapUpdateDo {
  331. for _, _f := range fields {
  332. m = *m.withDO(m.DO.Preload(_f))
  333. }
  334. return &m
  335. }
  336. func (m mapUpdateDo) FirstOrInit() (*model.MapUpdate, error) {
  337. if result, err := m.DO.FirstOrInit(); err != nil {
  338. return nil, err
  339. } else {
  340. return result.(*model.MapUpdate), nil
  341. }
  342. }
  343. func (m mapUpdateDo) FirstOrCreate() (*model.MapUpdate, error) {
  344. if result, err := m.DO.FirstOrCreate(); err != nil {
  345. return nil, err
  346. } else {
  347. return result.(*model.MapUpdate), nil
  348. }
  349. }
  350. func (m mapUpdateDo) FindByPage(offset int, limit int) (result []*model.MapUpdate, count int64, err error) {
  351. result, err = m.Offset(offset).Limit(limit).Find()
  352. if err != nil {
  353. return
  354. }
  355. if size := len(result); 0 < limit && 0 < size && size < limit {
  356. count = int64(size + offset)
  357. return
  358. }
  359. count, err = m.Offset(-1).Limit(-1).Count()
  360. return
  361. }
  362. func (m mapUpdateDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
  363. count, err = m.Count()
  364. if err != nil {
  365. return
  366. }
  367. err = m.Offset(offset).Limit(limit).Scan(result)
  368. return
  369. }
  370. func (m mapUpdateDo) Scan(result interface{}) (err error) {
  371. return m.DO.Scan(result)
  372. }
  373. func (m mapUpdateDo) Delete(models ...*model.MapUpdate) (result gen.ResultInfo, err error) {
  374. return m.DO.Delete(models)
  375. }
  376. func (m *mapUpdateDo) withDO(do gen.Dao) *mapUpdateDo {
  377. m.DO = *do.(*gen.DO)
  378. return m
  379. }