map_update.gen.go 14 KB

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