admin_token.go 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. // AdminTokenDao is the data access object for the table admin_token.
  11. type AdminTokenDao 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 AdminTokenColumns // columns contains all the column names of Table for convenient usage.
  15. }
  16. // AdminTokenColumns defines and stores column names for the table admin_token.
  17. type AdminTokenColumns struct {
  18. Id string //
  19. Token string // token
  20. AdminUserId string // 用户ID
  21. ExpireTime string // 过期时间
  22. CreateTime string // 创建时间
  23. UpdateTime string // 更新时间
  24. }
  25. // adminTokenColumns holds the columns for the table admin_token.
  26. var adminTokenColumns = AdminTokenColumns{
  27. Id: "id",
  28. Token: "token",
  29. AdminUserId: "admin_user_id",
  30. ExpireTime: "expire_time",
  31. CreateTime: "create_time",
  32. UpdateTime: "update_time",
  33. }
  34. // NewAdminTokenDao creates and returns a new DAO object for table data access.
  35. func NewAdminTokenDao() *AdminTokenDao {
  36. return &AdminTokenDao{
  37. group: "cadmin",
  38. table: "admin_token",
  39. columns: adminTokenColumns,
  40. }
  41. }
  42. // DB retrieves and returns the underlying raw database management object of the current DAO.
  43. func (dao *AdminTokenDao) DB() gdb.DB {
  44. return g.DB(dao.group)
  45. }
  46. // Table returns the table name of the current DAO.
  47. func (dao *AdminTokenDao) Table() string {
  48. return dao.table
  49. }
  50. // Columns returns all column names of the current DAO.
  51. func (dao *AdminTokenDao) Columns() AdminTokenColumns {
  52. return dao.columns
  53. }
  54. // Group returns the database configuration group name of the current DAO.
  55. func (dao *AdminTokenDao) Group() string {
  56. return dao.group
  57. }
  58. // Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation.
  59. func (dao *AdminTokenDao) Ctx(ctx context.Context) *gdb.Model {
  60. return dao.DB().Model(dao.table).Safe().Ctx(ctx)
  61. }
  62. // Transaction wraps the transaction logic using function f.
  63. // It rolls back the transaction and returns the error if function f returns a non-nil error.
  64. // It commits the transaction and returns nil if function f returns nil.
  65. //
  66. // Note: Do not commit or roll back the transaction in function f,
  67. // as it is automatically handled by this function.
  68. func (dao *AdminTokenDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
  69. return dao.Ctx(ctx).Transaction(ctx, f)
  70. }