talent_delivery_address.go 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. // TalentDeliveryAddressDao is the manager for logic model data accessing and custom defined data operations functions management.
  11. type TalentDeliveryAddressDao 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 TalentDeliveryAddressColumns // Columns is the short type for Columns, which contains all the column names of Table for convenient usage.
  15. }
  16. // TalentDeliveryAddressColumns defines and stores column names for table talent_delivery_address.
  17. type TalentDeliveryAddressColumns struct {
  18. AddressId string //
  19. RegionCode string // 区域码,取info_region表中的self_code字段值
  20. DetailAddr string // 详细地址
  21. PhoneNumber string // 联系电话
  22. ReceiverName string // 收货人名字
  23. DefaultTag string // 是否默认收货地址
  24. TalentId string // 达人id(talent_info表中的id)
  25. }
  26. // talentDeliveryAddressColumns holds the columns for table talent_delivery_address.
  27. var talentDeliveryAddressColumns = TalentDeliveryAddressColumns{
  28. AddressId: "address_id",
  29. RegionCode: "region_code",
  30. DetailAddr: "detail_addr",
  31. PhoneNumber: "phone_number",
  32. ReceiverName: "receiver_name",
  33. DefaultTag: "default_tag",
  34. TalentId: "talent_id",
  35. }
  36. // NewTalentDeliveryAddressDao creates and returns a new DAO object for table data access.
  37. func NewTalentDeliveryAddressDao() *TalentDeliveryAddressDao {
  38. return &TalentDeliveryAddressDao{
  39. Group: "default",
  40. Table: "talent_delivery_address",
  41. Columns: talentDeliveryAddressColumns,
  42. }
  43. }
  44. // DB retrieves and returns the underlying raw database management object of current DAO.
  45. func (dao *TalentDeliveryAddressDao) DB() gdb.DB {
  46. return g.DB(dao.Group)
  47. }
  48. // Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
  49. func (dao *TalentDeliveryAddressDao) Ctx(ctx context.Context) *gdb.Model {
  50. return dao.DB().Model(dao.Table).Safe().Ctx(ctx)
  51. }
  52. // Transaction wraps the transaction logic using function f.
  53. // It rollbacks the transaction and returns the error from function f if it returns non-nil error.
  54. // It commits the transaction and returns nil if function f returns nil.
  55. //
  56. // Note that, you should not Commit or Rollback the transaction in function f
  57. // as it is automatically handled by this function.
  58. func (dao *TalentDeliveryAddressDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {
  59. return dao.Ctx(ctx).Transaction(ctx, f)
  60. }