admin_user.go 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. // ==========================================================================
  2. // Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
  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. // AdminUserDao is the data access object for the table admin_user.
  11. type AdminUserDao struct {
  12. table string // table is the underlying table name of the DAO.
  13. group string // group is the database configuration group name of the current DAO.
  14. columns AdminUserColumns // columns contains all the column names of Table for convenient usage.
  15. }
  16. // AdminUserColumns defines and stores column names for the table admin_user.
  17. type AdminUserColumns struct {
  18. Id string //
  19. Username string // 用户名
  20. Password string // 密码
  21. LastLoginIp string // 最后登录IP
  22. LastLoginTime string // 最后登录时间
  23. Status string // 状态
  24. Description string // 描述
  25. CreateTime string // 创建时间
  26. UpdateTime string // 更新时间
  27. Phone string // 手机号
  28. Wxuserid string // 企业微信关联id
  29. }
  30. // adminUserColumns holds the columns for the table admin_user.
  31. var adminUserColumns = AdminUserColumns{
  32. Id: "id",
  33. Username: "username",
  34. Password: "password",
  35. LastLoginIp: "last_login_ip",
  36. LastLoginTime: "last_login_time",
  37. Status: "status",
  38. Description: "description",
  39. CreateTime: "create_time",
  40. UpdateTime: "update_time",
  41. Phone: "phone",
  42. Wxuserid: "wxuserid",
  43. }
  44. // NewAdminUserDao creates and returns a new DAO object for table data access.
  45. func NewAdminUserDao() *AdminUserDao {
  46. return &AdminUserDao{
  47. group: "cadmin",
  48. table: "admin_user",
  49. columns: adminUserColumns,
  50. }
  51. }
  52. // DB retrieves and returns the underlying raw database management object of the current DAO.
  53. func (dao *AdminUserDao) DB() gdb.DB {
  54. return g.DB(dao.group)
  55. }
  56. // Table returns the table name of the current DAO.
  57. func (dao *AdminUserDao) Table() string {
  58. return dao.table
  59. }
  60. // Columns returns all column names of the current DAO.
  61. func (dao *AdminUserDao) Columns() AdminUserColumns {
  62. return dao.columns
  63. }
  64. // Group returns the database configuration group name of the current DAO.
  65. func (dao *AdminUserDao) Group() string {
  66. return dao.group
  67. }
  68. // Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
  69. func (dao *AdminUserDao) Ctx(ctx context.Context) *gdb.Model {
  70. return dao.DB().Model(dao.table).Safe().Ctx(ctx)
  71. }
  72. // Transaction wraps the transaction logic using function f.
  73. // It rolls back the transaction and returns the error if function f returns a non-nil error.
  74. // It commits the transaction and returns nil if function f returns nil.
  75. //
  76. // Note: Do not commit or roll back the transaction in function f,
  77. // as it is automatically handled by this function.
  78. func (dao *AdminUserDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
  79. return dao.Ctx(ctx).Transaction(ctx, f)
  80. }