// ========================================================================== // Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. // ========================================================================== package internal import ( "context" "github.com/gogf/gf/v2/database/gdb" "github.com/gogf/gf/v2/frame/g" ) // MerchantsDao is the data access object for the table merchants. type MerchantsDao struct { table string // table is the underlying table name of the DAO. group string // group is the database configuration group name of the current DAO. columns MerchantsColumns // columns contains all the column names of Table for convenient usage. } // MerchantsColumns defines and stores column names for the table merchants. type MerchantsColumns struct { Id string // 商户ID Name string // 商户名称 BusinessLicense string // 营业执照号 LegalPerson string // 法人姓名 ContactName string // 联系人姓名 ContactPhone string // 联系人电话 ContactEmail string // 联系人邮箱 Address string // 商户地址 Status string // 状态:1=正常,2=禁用 ExpireAt string // 服务到期时间 CreatedAt string // 创建时间 UpdatedAt string // 更新时间 DeletedAt string // 软删除时间戳 ApplicationReason string // 申请理由 CreatedBy string // 创建人ID CreatedByType string // 创建人类型:1=系统管理员,2=商户注册 AuditStatus string // 审核状态:0=待审核,1=审核通过,2=审核拒绝 AuditBy string // 审核人ID AuditAt string // 审核时间 AuditRemark string // 审核备注 RejectReason string // 拒绝原因 } // merchantsColumns holds the columns for the table merchants. var merchantsColumns = MerchantsColumns{ Id: "id", Name: "name", BusinessLicense: "business_license", LegalPerson: "legal_person", ContactName: "contact_name", ContactPhone: "contact_phone", ContactEmail: "contact_email", Address: "address", Status: "status", ExpireAt: "expire_at", CreatedAt: "created_at", UpdatedAt: "updated_at", DeletedAt: "deleted_at", ApplicationReason: "application_reason", CreatedBy: "created_by", CreatedByType: "created_by_type", AuditStatus: "audit_status", AuditBy: "audit_by", AuditAt: "audit_at", AuditRemark: "audit_remark", RejectReason: "reject_reason", } // NewMerchantsDao creates and returns a new DAO object for table data access. func NewMerchantsDao() *MerchantsDao { return &MerchantsDao{ group: "default", table: "merchants", columns: merchantsColumns, } } // DB retrieves and returns the underlying raw database management object of the current DAO. func (dao *MerchantsDao) DB() gdb.DB { return g.DB(dao.group) } // Table returns the table name of the current DAO. func (dao *MerchantsDao) Table() string { return dao.table } // Columns returns all column names of the current DAO. func (dao *MerchantsDao) Columns() MerchantsColumns { return dao.columns } // Group returns the database configuration group name of the current DAO. func (dao *MerchantsDao) Group() string { return dao.group } // Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. func (dao *MerchantsDao) Ctx(ctx context.Context) *gdb.Model { return dao.DB().Model(dao.table).Safe().Ctx(ctx) } // Transaction wraps the transaction logic using function f. // It rolls back the transaction and returns the error if function f returns a non-nil error. // It commits the transaction and returns nil if function f returns nil. // // Note: Do not commit or roll back the transaction in function f, // as it is automatically handled by this function. func (dao *MerchantsDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { return dao.Ctx(ctx).Transaction(ctx, f) }