younggee_message_info.go 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. // ==========================================================================
  2. // Code generated by GoFrame CLI tool. DO NOT EDIT.
  3. // ==========================================================================
  4. package internal
  5. import (
  6. "context"
  7. "github.com/gogf/gf/database/gdb"
  8. "github.com/gogf/gf/frame/g"
  9. )
  10. // YounggeeMessageInfoDao is the manager for logic model data accessing and custom defined data operations functions management.
  11. type YounggeeMessageInfoDao struct {
  12. Table string // Table is the underlying table name of the DAO.
  13. Group string // Group is the database configuration group name of current DAO.
  14. Columns YounggeeMessageInfoColumns // Columns is the short type for Columns, which contains all the column names of Table for convenient usage.
  15. }
  16. // YounggeeMessageInfoColumns defines and stores column names for table younggee_message_info.
  17. type YounggeeMessageInfoColumns struct {
  18. Id string // id,递增
  19. MessageId string // 消息内容id,对应info_message
  20. MessageType string // 消息类型,1-4分别表示成功、通知、错误、警告
  21. TalentId string // 达人id
  22. ProjectName string // 项目名称
  23. CreatedAt string // 消息创建时间
  24. IsReaded string // 是否已读,1表示未读,2表示已读
  25. IsDeleted string // 是否删除,1表示未删,2表示已删
  26. }
  27. // younggeeMessageInfoColumns holds the columns for table younggee_message_info.
  28. var younggeeMessageInfoColumns = YounggeeMessageInfoColumns{
  29. Id: "id",
  30. MessageId: "message_id",
  31. MessageType: "message_type",
  32. TalentId: "talent_id",
  33. ProjectName: "project_name",
  34. CreatedAt: "created_at",
  35. IsReaded: "is_readed",
  36. IsDeleted: "is_deleted",
  37. }
  38. // NewYounggeeMessageInfoDao creates and returns a new DAO object for table data access.
  39. func NewYounggeeMessageInfoDao() *YounggeeMessageInfoDao {
  40. return &YounggeeMessageInfoDao{
  41. Group: "default",
  42. Table: "younggee_message_info",
  43. Columns: younggeeMessageInfoColumns,
  44. }
  45. }
  46. // DB retrieves and returns the underlying raw database management object of current DAO.
  47. func (dao *YounggeeMessageInfoDao) DB() gdb.DB {
  48. return g.DB(dao.Group)
  49. }
  50. // Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
  51. func (dao *YounggeeMessageInfoDao) Ctx(ctx context.Context) *gdb.Model {
  52. return dao.DB().Model(dao.Table).Safe().Ctx(ctx)
  53. }
  54. // Transaction wraps the transaction logic using function f.
  55. // It rollbacks the transaction and returns the error from function f if it returns non-nil error.
  56. // It commits the transaction and returns nil if function f returns nil.
  57. //
  58. // Note that, you should not Commit or Rollback the transaction in function f
  59. // as it is automatically handled by this function.
  60. func (dao *YounggeeMessageInfoDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {
  61. return dao.Ctx(ctx).Transaction(ctx, f)
  62. }