chat_report_log.gen.go 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379
  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. "gadmin/internal/gorm/model"
  14. )
  15. func newChatReportLog(db *gorm.DB, opts ...gen.DOOption) chatReportLog {
  16. _chatReportLog := chatReportLog{}
  17. _chatReportLog.chatReportLogDo.UseDB(db, opts...)
  18. _chatReportLog.chatReportLogDo.UseModel(&model.ChatReportLog{})
  19. tableName := _chatReportLog.chatReportLogDo.TableName()
  20. _chatReportLog.ALL = field.NewAsterisk(tableName)
  21. _chatReportLog.ID = field.NewInt64(tableName, "id")
  22. _chatReportLog.PlayerID = field.NewInt64(tableName, "player_id")
  23. _chatReportLog.PlayerName = field.NewString(tableName, "player_name")
  24. _chatReportLog.ServerID = field.NewInt32(tableName, "server_id")
  25. _chatReportLog.ClanChatID = field.NewString(tableName, "clan_chat_id")
  26. _chatReportLog.ClanPlayerID = field.NewInt64(tableName, "clan_player_id")
  27. _chatReportLog.ClanPlayerName = field.NewString(tableName, "clan_player_name")
  28. _chatReportLog.ClanServerID = field.NewInt32(tableName, "clan_server_id")
  29. _chatReportLog.ClanContent = field.NewString(tableName, "clan_content")
  30. _chatReportLog.ClanChatChannel = field.NewInt32(tableName, "clan_chat_channel")
  31. _chatReportLog.LeagueCode = field.NewString(tableName, "league_code")
  32. _chatReportLog.ClanTime = field.NewInt64(tableName, "clan_time")
  33. _chatReportLog.CreateTime = field.NewInt64(tableName, "create_time")
  34. _chatReportLog.fillFieldMap()
  35. return _chatReportLog
  36. }
  37. type chatReportLog struct {
  38. chatReportLogDo chatReportLogDo
  39. ALL field.Asterisk
  40. ID field.Int64
  41. PlayerID field.Int64 // 举报者id
  42. PlayerName field.String // 举报者昵称
  43. ServerID field.Int32 // 举报者服务器id
  44. ClanChatID field.String // 违规的消息id
  45. ClanPlayerID field.Int64 // 违规者id
  46. ClanPlayerName field.String // 违规者昵称
  47. ClanServerID field.Int32 // 违规者服务器id
  48. ClanContent field.String // 违规消息内容
  49. ClanChatChannel field.Int32 // 频道类型
  50. LeagueCode field.String // 联盟code
  51. ClanTime field.Int64 // 违规时间(毫秒)
  52. CreateTime field.Int64 // 上传时间(毫秒)
  53. fieldMap map[string]field.Expr
  54. }
  55. func (c chatReportLog) Table(newTableName string) *chatReportLog {
  56. c.chatReportLogDo.UseTable(newTableName)
  57. return c.updateTableName(newTableName)
  58. }
  59. func (c chatReportLog) As(alias string) *chatReportLog {
  60. c.chatReportLogDo.DO = *(c.chatReportLogDo.As(alias).(*gen.DO))
  61. return c.updateTableName(alias)
  62. }
  63. func (c *chatReportLog) updateTableName(table string) *chatReportLog {
  64. c.ALL = field.NewAsterisk(table)
  65. c.ID = field.NewInt64(table, "id")
  66. c.PlayerID = field.NewInt64(table, "player_id")
  67. c.PlayerName = field.NewString(table, "player_name")
  68. c.ServerID = field.NewInt32(table, "server_id")
  69. c.ClanChatID = field.NewString(table, "clan_chat_id")
  70. c.ClanPlayerID = field.NewInt64(table, "clan_player_id")
  71. c.ClanPlayerName = field.NewString(table, "clan_player_name")
  72. c.ClanServerID = field.NewInt32(table, "clan_server_id")
  73. c.ClanContent = field.NewString(table, "clan_content")
  74. c.ClanChatChannel = field.NewInt32(table, "clan_chat_channel")
  75. c.LeagueCode = field.NewString(table, "league_code")
  76. c.ClanTime = field.NewInt64(table, "clan_time")
  77. c.CreateTime = field.NewInt64(table, "create_time")
  78. c.fillFieldMap()
  79. return c
  80. }
  81. func (c *chatReportLog) WithContext(ctx context.Context) *chatReportLogDo {
  82. return c.chatReportLogDo.WithContext(ctx)
  83. }
  84. func (c chatReportLog) TableName() string { return c.chatReportLogDo.TableName() }
  85. func (c chatReportLog) Alias() string { return c.chatReportLogDo.Alias() }
  86. func (c chatReportLog) Columns(cols ...field.Expr) gen.Columns {
  87. return c.chatReportLogDo.Columns(cols...)
  88. }
  89. func (c *chatReportLog) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
  90. _f, ok := c.fieldMap[fieldName]
  91. if !ok || _f == nil {
  92. return nil, false
  93. }
  94. _oe, ok := _f.(field.OrderExpr)
  95. return _oe, ok
  96. }
  97. func (c *chatReportLog) fillFieldMap() {
  98. c.fieldMap = make(map[string]field.Expr, 13)
  99. c.fieldMap["id"] = c.ID
  100. c.fieldMap["player_id"] = c.PlayerID
  101. c.fieldMap["player_name"] = c.PlayerName
  102. c.fieldMap["server_id"] = c.ServerID
  103. c.fieldMap["clan_chat_id"] = c.ClanChatID
  104. c.fieldMap["clan_player_id"] = c.ClanPlayerID
  105. c.fieldMap["clan_player_name"] = c.ClanPlayerName
  106. c.fieldMap["clan_server_id"] = c.ClanServerID
  107. c.fieldMap["clan_content"] = c.ClanContent
  108. c.fieldMap["clan_chat_channel"] = c.ClanChatChannel
  109. c.fieldMap["league_code"] = c.LeagueCode
  110. c.fieldMap["clan_time"] = c.ClanTime
  111. c.fieldMap["create_time"] = c.CreateTime
  112. }
  113. func (c chatReportLog) clone(db *gorm.DB) chatReportLog {
  114. c.chatReportLogDo.ReplaceConnPool(db.Statement.ConnPool)
  115. return c
  116. }
  117. func (c chatReportLog) replaceDB(db *gorm.DB) chatReportLog {
  118. c.chatReportLogDo.ReplaceDB(db)
  119. return c
  120. }
  121. type chatReportLogDo struct{ gen.DO }
  122. func (c chatReportLogDo) Debug() *chatReportLogDo {
  123. return c.withDO(c.DO.Debug())
  124. }
  125. func (c chatReportLogDo) WithContext(ctx context.Context) *chatReportLogDo {
  126. return c.withDO(c.DO.WithContext(ctx))
  127. }
  128. func (c chatReportLogDo) ReadDB() *chatReportLogDo {
  129. return c.Clauses(dbresolver.Read)
  130. }
  131. func (c chatReportLogDo) WriteDB() *chatReportLogDo {
  132. return c.Clauses(dbresolver.Write)
  133. }
  134. func (c chatReportLogDo) Session(config *gorm.Session) *chatReportLogDo {
  135. return c.withDO(c.DO.Session(config))
  136. }
  137. func (c chatReportLogDo) Clauses(conds ...clause.Expression) *chatReportLogDo {
  138. return c.withDO(c.DO.Clauses(conds...))
  139. }
  140. func (c chatReportLogDo) Returning(value interface{}, columns ...string) *chatReportLogDo {
  141. return c.withDO(c.DO.Returning(value, columns...))
  142. }
  143. func (c chatReportLogDo) Not(conds ...gen.Condition) *chatReportLogDo {
  144. return c.withDO(c.DO.Not(conds...))
  145. }
  146. func (c chatReportLogDo) Or(conds ...gen.Condition) *chatReportLogDo {
  147. return c.withDO(c.DO.Or(conds...))
  148. }
  149. func (c chatReportLogDo) Select(conds ...field.Expr) *chatReportLogDo {
  150. return c.withDO(c.DO.Select(conds...))
  151. }
  152. func (c chatReportLogDo) Where(conds ...gen.Condition) *chatReportLogDo {
  153. return c.withDO(c.DO.Where(conds...))
  154. }
  155. func (c chatReportLogDo) Order(conds ...field.Expr) *chatReportLogDo {
  156. return c.withDO(c.DO.Order(conds...))
  157. }
  158. func (c chatReportLogDo) Distinct(cols ...field.Expr) *chatReportLogDo {
  159. return c.withDO(c.DO.Distinct(cols...))
  160. }
  161. func (c chatReportLogDo) Omit(cols ...field.Expr) *chatReportLogDo {
  162. return c.withDO(c.DO.Omit(cols...))
  163. }
  164. func (c chatReportLogDo) Join(table schema.Tabler, on ...field.Expr) *chatReportLogDo {
  165. return c.withDO(c.DO.Join(table, on...))
  166. }
  167. func (c chatReportLogDo) LeftJoin(table schema.Tabler, on ...field.Expr) *chatReportLogDo {
  168. return c.withDO(c.DO.LeftJoin(table, on...))
  169. }
  170. func (c chatReportLogDo) RightJoin(table schema.Tabler, on ...field.Expr) *chatReportLogDo {
  171. return c.withDO(c.DO.RightJoin(table, on...))
  172. }
  173. func (c chatReportLogDo) Group(cols ...field.Expr) *chatReportLogDo {
  174. return c.withDO(c.DO.Group(cols...))
  175. }
  176. func (c chatReportLogDo) Having(conds ...gen.Condition) *chatReportLogDo {
  177. return c.withDO(c.DO.Having(conds...))
  178. }
  179. func (c chatReportLogDo) Limit(limit int) *chatReportLogDo {
  180. return c.withDO(c.DO.Limit(limit))
  181. }
  182. func (c chatReportLogDo) Offset(offset int) *chatReportLogDo {
  183. return c.withDO(c.DO.Offset(offset))
  184. }
  185. func (c chatReportLogDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *chatReportLogDo {
  186. return c.withDO(c.DO.Scopes(funcs...))
  187. }
  188. func (c chatReportLogDo) Unscoped() *chatReportLogDo {
  189. return c.withDO(c.DO.Unscoped())
  190. }
  191. func (c chatReportLogDo) Create(values ...*model.ChatReportLog) error {
  192. if len(values) == 0 {
  193. return nil
  194. }
  195. return c.DO.Create(values)
  196. }
  197. func (c chatReportLogDo) CreateInBatches(values []*model.ChatReportLog, batchSize int) error {
  198. return c.DO.CreateInBatches(values, batchSize)
  199. }
  200. // Save : !!! underlying implementation is different with GORM
  201. // The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values)
  202. func (c chatReportLogDo) Save(values ...*model.ChatReportLog) error {
  203. if len(values) == 0 {
  204. return nil
  205. }
  206. return c.DO.Save(values)
  207. }
  208. func (c chatReportLogDo) First() (*model.ChatReportLog, error) {
  209. if result, err := c.DO.First(); err != nil {
  210. return nil, err
  211. } else {
  212. return result.(*model.ChatReportLog), nil
  213. }
  214. }
  215. func (c chatReportLogDo) Take() (*model.ChatReportLog, error) {
  216. if result, err := c.DO.Take(); err != nil {
  217. return nil, err
  218. } else {
  219. return result.(*model.ChatReportLog), nil
  220. }
  221. }
  222. func (c chatReportLogDo) Last() (*model.ChatReportLog, error) {
  223. if result, err := c.DO.Last(); err != nil {
  224. return nil, err
  225. } else {
  226. return result.(*model.ChatReportLog), nil
  227. }
  228. }
  229. func (c chatReportLogDo) Find() ([]*model.ChatReportLog, error) {
  230. result, err := c.DO.Find()
  231. return result.([]*model.ChatReportLog), err
  232. }
  233. func (c chatReportLogDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ChatReportLog, err error) {
  234. buf := make([]*model.ChatReportLog, 0, batchSize)
  235. err = c.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error {
  236. defer func() { results = append(results, buf...) }()
  237. return fc(tx, batch)
  238. })
  239. return results, err
  240. }
  241. func (c chatReportLogDo) FindInBatches(result *[]*model.ChatReportLog, batchSize int, fc func(tx gen.Dao, batch int) error) error {
  242. return c.DO.FindInBatches(result, batchSize, fc)
  243. }
  244. func (c chatReportLogDo) Attrs(attrs ...field.AssignExpr) *chatReportLogDo {
  245. return c.withDO(c.DO.Attrs(attrs...))
  246. }
  247. func (c chatReportLogDo) Assign(attrs ...field.AssignExpr) *chatReportLogDo {
  248. return c.withDO(c.DO.Assign(attrs...))
  249. }
  250. func (c chatReportLogDo) Joins(fields ...field.RelationField) *chatReportLogDo {
  251. for _, _f := range fields {
  252. c = *c.withDO(c.DO.Joins(_f))
  253. }
  254. return &c
  255. }
  256. func (c chatReportLogDo) Preload(fields ...field.RelationField) *chatReportLogDo {
  257. for _, _f := range fields {
  258. c = *c.withDO(c.DO.Preload(_f))
  259. }
  260. return &c
  261. }
  262. func (c chatReportLogDo) FirstOrInit() (*model.ChatReportLog, error) {
  263. if result, err := c.DO.FirstOrInit(); err != nil {
  264. return nil, err
  265. } else {
  266. return result.(*model.ChatReportLog), nil
  267. }
  268. }
  269. func (c chatReportLogDo) FirstOrCreate() (*model.ChatReportLog, error) {
  270. if result, err := c.DO.FirstOrCreate(); err != nil {
  271. return nil, err
  272. } else {
  273. return result.(*model.ChatReportLog), nil
  274. }
  275. }
  276. func (c chatReportLogDo) FindByPage(offset int, limit int) (result []*model.ChatReportLog, count int64, err error) {
  277. result, err = c.Offset(offset).Limit(limit).Find()
  278. if err != nil {
  279. return
  280. }
  281. if size := len(result); 0 < limit && 0 < size && size < limit {
  282. count = int64(size + offset)
  283. return
  284. }
  285. count, err = c.Offset(-1).Limit(-1).Count()
  286. return
  287. }
  288. func (c chatReportLogDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
  289. count, err = c.Count()
  290. if err != nil {
  291. return
  292. }
  293. err = c.Offset(offset).Limit(limit).Scan(result)
  294. return
  295. }
  296. func (c chatReportLogDo) Scan(result interface{}) (err error) {
  297. return c.DO.Scan(result)
  298. }
  299. func (c chatReportLogDo) Delete(models ...*model.ChatReportLog) (result gen.ResultInfo, err error) {
  300. return c.DO.Delete(models)
  301. }
  302. func (c *chatReportLogDo) withDO(do gen.Dao) *chatReportLogDo {
  303. c.DO = *do.(*gen.DO)
  304. return c
  305. }