You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
2.8 KiB

9 months ago
  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. // SearchKeywordDao is the data access object for table cms_search_keyword.
  11. type SearchKeywordDao 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 SearchKeywordColumns // columns contains all the column names of Table for convenient usage.
  15. }
  16. // SearchKeywordColumns defines and stores column names for table cms_search_keyword.
  17. type SearchKeywordColumns struct {
  18. Id string // 主键
  19. CreatedAt string // 创建时间
  20. UpdatedAt string // 更新时间
  21. Keyword string // 搜索关键字
  22. Total string // 搜索次数
  23. }
  24. // searchKeywordColumns holds the columns for table cms_search_keyword.
  25. var searchKeywordColumns = SearchKeywordColumns{
  26. Id: "id",
  27. CreatedAt: "created_at",
  28. UpdatedAt: "updated_at",
  29. Keyword: "keyword",
  30. Total: "total",
  31. }
  32. // NewSearchKeywordDao creates and returns a new DAO object for table data access.
  33. func NewSearchKeywordDao() *SearchKeywordDao {
  34. return &SearchKeywordDao{
  35. group: "cms",
  36. table: "cms_search_keyword",
  37. columns: searchKeywordColumns,
  38. }
  39. }
  40. // DB retrieves and returns the underlying raw database management object of current DAO.
  41. func (dao *SearchKeywordDao) DB() gdb.DB {
  42. return g.DB(dao.group)
  43. }
  44. // Table returns the table name of current dao.
  45. func (dao *SearchKeywordDao) Table() string {
  46. return dao.table
  47. }
  48. // Columns returns all column names of current dao.
  49. func (dao *SearchKeywordDao) Columns() SearchKeywordColumns {
  50. return dao.columns
  51. }
  52. // Group returns the configuration group name of database of current dao.
  53. func (dao *SearchKeywordDao) Group() string {
  54. return dao.group
  55. }
  56. // Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
  57. func (dao *SearchKeywordDao) Ctx(ctx context.Context) *gdb.Model {
  58. return dao.DB().Model(dao.table).Safe().Ctx(ctx)
  59. }
  60. // Transaction wraps the transaction logic using function f.
  61. // It rollbacks the transaction and returns the error from function f if it returns non-nil error.
  62. // It commits the transaction and returns nil if function f returns nil.
  63. //
  64. // Note that, you should not Commit or Rollback the transaction in function f
  65. // as it is automatically handled by this function.
  66. func (dao *SearchKeywordDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
  67. return dao.Ctx(ctx).Transaction(ctx, f)
  68. }