plugins_manage.go 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. // ==========================================================================
  2. // GFast自动生成dao internal操作代码,无需手动修改,重新生成会自动覆盖.
  3. // 生成日期:2021-08-31 17:58:43
  4. // 生成路径: gfast/app/system/dao/internal/plugins_manage.go
  5. // 生成人:gfast
  6. // ==========================================================================
  7. package internal
  8. import (
  9. "context"
  10. "github.com/gogf/gf/database/gdb"
  11. "github.com/gogf/gf/frame/g"
  12. )
  13. // PluginsManageDao is the manager for logic model data accessing and custom defined data operations functions management.
  14. type PluginsManageDao struct {
  15. Table string // Table is the underlying table name of the DAO.
  16. Group string // Group is the database configuration group name of current DAO.
  17. Columns PluginsManageColumns // Columns is the short type for Columns, which contains all the column names of Table for convenient usage.
  18. }
  19. // PluginsManageColumns defines and stores column names for table plugins_manage.
  20. type PluginsManageColumns struct {
  21. Id string // ID
  22. StoreId string // 插件在商城中的id
  23. PName string // 插件名称英文
  24. PTitle string // 插件名称
  25. PDescription string // 插件介绍
  26. PAuth string // 作者
  27. IsInstall string // 是否安装
  28. Status string // 状态
  29. Version string // 当前版本
  30. Price string // 价格
  31. DownloadTimes string // 下载次数
  32. InstallPath string // 安装路径
  33. }
  34. var pluginsManageColumns = PluginsManageColumns{
  35. Id: "id",
  36. StoreId: "store_id",
  37. PName: "p_name",
  38. PTitle: "p_title",
  39. PDescription: "p_description",
  40. PAuth: "p_auth",
  41. IsInstall: "is_install",
  42. Status: "status",
  43. Version: "version",
  44. Price: "price",
  45. DownloadTimes: "download_times",
  46. InstallPath: "install_path",
  47. }
  48. // NewPluginsManageDao creates and returns a new DAO object for table data access.
  49. func NewPluginsManageDao() *PluginsManageDao {
  50. return &PluginsManageDao{
  51. Group: "default",
  52. Table: "plugins_manage",
  53. Columns: pluginsManageColumns,
  54. }
  55. }
  56. // DB retrieves and returns the underlying raw database management object of current DAO.
  57. func (dao *PluginsManageDao) DB() gdb.DB {
  58. return g.DB(dao.Group)
  59. }
  60. // Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
  61. func (dao *PluginsManageDao) Ctx(ctx context.Context) *gdb.Model {
  62. return dao.DB().Model(dao.Table).Safe().Ctx(ctx)
  63. }
  64. // Transaction wraps the transaction logic using function f.
  65. // It rollbacks the transaction and returns the error from function f if it returns non-nil error.
  66. // It commits the transaction and returns nil if function f returns nil.
  67. //
  68. // Note that, you should not Commit or Rollback the transaction in function f
  69. // as it is automatically handled by this function.
  70. func (dao *PluginsManageDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {
  71. return dao.Ctx(ctx).Transaction(ctx, f)
  72. }