younggee_product_photo.go 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. // YounggeeProductPhotoDao is the manager for logic model data accessing and custom defined data operations functions management.
  11. type YounggeeProductPhotoDao 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 YounggeeProductPhotoColumns // Columns is the short type for Columns, which contains all the column names of Table for convenient usage.
  15. }
  16. // YounggeeProductPhotoColumns defines and stores column names for table younggee_product_photo.
  17. type YounggeeProductPhotoColumns struct {
  18. ProductPhotoId string // 商品图片id
  19. ProductId string // 所属商品id
  20. Symbol string // 图片为主图或详情图标志位,1为主图,2为详情图,3为视频
  21. PhotoUrl string // 图片或视频url
  22. PhotoUid string //
  23. CreatedAt string // 创建时间
  24. }
  25. // younggeeProductPhotoColumns holds the columns for table younggee_product_photo.
  26. var younggeeProductPhotoColumns = YounggeeProductPhotoColumns{
  27. ProductPhotoId: "product_photo_id",
  28. ProductId: "product_id",
  29. Symbol: "symbol",
  30. PhotoUrl: "photo_url",
  31. PhotoUid: "photo_uid",
  32. CreatedAt: "created_at",
  33. }
  34. // NewYounggeeProductPhotoDao creates and returns a new DAO object for table data access.
  35. func NewYounggeeProductPhotoDao() *YounggeeProductPhotoDao {
  36. return &YounggeeProductPhotoDao{
  37. Group: "default",
  38. Table: "younggee_product_photo",
  39. Columns: younggeeProductPhotoColumns,
  40. }
  41. }
  42. // DB retrieves and returns the underlying raw database management object of current DAO.
  43. func (dao *YounggeeProductPhotoDao) DB() gdb.DB {
  44. return g.DB(dao.Group)
  45. }
  46. // Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
  47. func (dao *YounggeeProductPhotoDao) Ctx(ctx context.Context) *gdb.Model {
  48. return dao.DB().Model(dao.Table).Safe().Ctx(ctx)
  49. }
  50. // Transaction wraps the transaction logic using function f.
  51. // It rollbacks the transaction and returns the error from function f if it returns non-nil error.
  52. // It commits the transaction and returns nil if function f returns nil.
  53. //
  54. // Note that, you should not Commit or Rollback the transaction in function f
  55. // as it is automatically handled by this function.
  56. func (dao *YounggeeProductPhotoDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {
  57. return dao.Ctx(ctx).Transaction(ctx, f)
  58. }