aliyun_avatar.gen.go 13 KB

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