sys_config.go 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. // ==========================================================================
  2. // Code generated by GoFrame CLI tool. DO NOT EDIT. Created at 2022-04-18 21:09:17
  3. // ==========================================================================
  4. package internal
  5. import (
  6. "context"
  7. "github.com/gogf/gf/v2/database/gdb"
  8. "github.com/gogf/gf/v2/frame/g"
  9. )
  10. // SysConfigDao is the data access object for table sys_config.
  11. type SysConfigDao 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 SysConfigColumns // columns contains all the column names of Table for convenient usage.
  15. }
  16. // SysConfigColumns defines and stores column names for table sys_config.
  17. type SysConfigColumns struct {
  18. ConfigId string // 参数主键
  19. ConfigName string // 参数名称
  20. ConfigKey string // 参数键名
  21. ConfigValue string // 参数键值
  22. ConfigType string // 系统内置(Y是 N否)
  23. CreateBy string // 创建者
  24. UpdateBy string // 更新者
  25. Remark string // 备注
  26. CreatedAt string // 创建时间
  27. UpdatedAt string // 修改时间
  28. }
  29. // sysConfigColumns holds the columns for table sys_config.
  30. var sysConfigColumns = SysConfigColumns{
  31. ConfigId: "config_id",
  32. ConfigName: "config_name",
  33. ConfigKey: "config_key",
  34. ConfigValue: "config_value",
  35. ConfigType: "config_type",
  36. CreateBy: "create_by",
  37. UpdateBy: "update_by",
  38. Remark: "remark",
  39. CreatedAt: "created_at",
  40. UpdatedAt: "updated_at",
  41. }
  42. // NewSysConfigDao creates and returns a new DAO object for table data access.
  43. func NewSysConfigDao() *SysConfigDao {
  44. return &SysConfigDao{
  45. group: "default",
  46. table: "sys_config",
  47. columns: sysConfigColumns,
  48. }
  49. }
  50. // DB retrieves and returns the underlying raw database management object of current DAO.
  51. func (dao *SysConfigDao) DB() gdb.DB {
  52. return g.DB(dao.group)
  53. }
  54. // Table returns the table name of current dao.
  55. func (dao *SysConfigDao) Table() string {
  56. return dao.table
  57. }
  58. // Columns returns all column names of current dao.
  59. func (dao *SysConfigDao) Columns() SysConfigColumns {
  60. return dao.columns
  61. }
  62. // Group returns the configuration group name of database of current dao.
  63. func (dao *SysConfigDao) Group() string {
  64. return dao.group
  65. }
  66. // Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
  67. func (dao *SysConfigDao) Ctx(ctx context.Context) *gdb.Model {
  68. return dao.DB().Model(dao.table).Safe().Ctx(ctx)
  69. }
  70. // Transaction wraps the transaction logic using function f.
  71. // It rollbacks the transaction and returns the error from function f if it returns non-nil error.
  72. // It commits the transaction and returns nil if function f returns nil.
  73. //
  74. // Note that, you should not Commit or Rollback the transaction in function f
  75. // as it is automatically handled by this function.
  76. func (dao *SysConfigDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
  77. return dao.Ctx(ctx).Transaction(ctx, f)
  78. }