project_photo.go 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // ==========================================================================
  2. // Code generated by GoFrame CLI tool. DO NOT EDIT.
  3. // ==========================================================================
  4. package internal
  5. import (
  6. "context"
  7. "github.com/gogf/gf/database/gdb"
  8. "github.com/gogf/gf/frame/g"
  9. )
  10. // ProjectPhotoDao is the manager for logic model data accessing and custom defined data operations functions management.
  11. type ProjectPhotoDao 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 ProjectPhotoColumns // Columns is the short type for Columns, which contains all the column names of Table for convenient usage.
  15. }
  16. // ProjectPhotoColumns defines and stores column names for table project_photo.
  17. type ProjectPhotoColumns struct {
  18. ProjectPhotoId string // 项目图片id
  19. PhotoUrl string // 图片url
  20. PhotoUid string //
  21. ProjectId string // 所属项目id
  22. CreatedAt string // 创建时间
  23. }
  24. // projectPhotoColumns holds the columns for table project_photo.
  25. var projectPhotoColumns = ProjectPhotoColumns{
  26. ProjectPhotoId: "project_photo_id",
  27. PhotoUrl: "photo_url",
  28. PhotoUid: "photo_uid",
  29. ProjectId: "project_id",
  30. CreatedAt: "created_at",
  31. }
  32. // NewProjectPhotoDao creates and returns a new DAO object for table data access.
  33. func NewProjectPhotoDao() *ProjectPhotoDao {
  34. return &ProjectPhotoDao{
  35. Group: "default",
  36. Table: "project_photo",
  37. Columns: projectPhotoColumns,
  38. }
  39. }
  40. // DB retrieves and returns the underlying raw database management object of current DAO.
  41. func (dao *ProjectPhotoDao) DB() gdb.DB {
  42. return g.DB(dao.Group)
  43. }
  44. // Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
  45. func (dao *ProjectPhotoDao) Ctx(ctx context.Context) *gdb.Model {
  46. return dao.DB().Model(dao.Table).Safe().Ctx(ctx)
  47. }
  48. // Transaction wraps the transaction logic using function f.
  49. // It rollbacks the transaction and returns the error from function f if it returns non-nil error.
  50. // It commits the transaction and returns nil if function f returns nil.
  51. //
  52. // Note that, you should not Commit or Rollback the transaction in function f
  53. // as it is automatically handled by this function.
  54. func (dao *ProjectPhotoDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {
  55. return dao.Ctx(ctx).Transaction(ctx, f)
  56. }