12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- // ==========================================================================
- // Code generated by GoFrame CLI tool. DO NOT EDIT.
- // ==========================================================================
- package internal
- import (
- "context"
- "github.com/gogf/gf/database/gdb"
- "github.com/gogf/gf/frame/g"
- )
- // EnterpriseDao is the manager for logic model data accessing and custom defined data operations functions management.
- type EnterpriseDao struct {
- Table string // Table is the underlying table name of the DAO.
- Group string // Group is the database configuration group name of current DAO.
- Columns EnterpriseColumns // Columns is the short type for Columns, which contains all the column names of Table for convenient usage.
- }
- // EnterpriseColumns defines and stores column names for table enterprise.
- type EnterpriseColumns struct {
- EnterpriseId string // 企业id,用户ID的生成规则为:1(企业用户代码)+分秒数字+四位随机数字
- Industry string // 行业,1-14分别代表能源、化工、材料、机械设备/军工、企业服务/造纸印刷、运输设备、旅游酒店、媒体/信息通信服务、批发/零售、消费品、卫生保健/医疗、金融、建材/建筑/房地产、公共事业
- BusinessName string // 公司或组织名称
- UserId string // 对应用户id
- Balance string // 账户余额
- FrozenBalance string // 冻结余额
- AvailableBalance string // 可用余额
- BillableAmount string // 可开票金额
- Invoicing string // 开票中金额
- Recharging string // 充值中金额
- CreatedAt string // 创建时间
- UpdatedAt string // 更新时间
- }
- // enterpriseColumns holds the columns for table enterprise.
- var enterpriseColumns = EnterpriseColumns{
- EnterpriseId: "enterprise_id",
- Industry: "industry",
- BusinessName: "business_name",
- UserId: "user_id",
- Balance: "balance",
- FrozenBalance: "frozen_balance",
- AvailableBalance: "available_balance",
- BillableAmount: "billable_amount",
- Invoicing: "invoicing",
- Recharging: "recharging",
- CreatedAt: "created_at",
- UpdatedAt: "updated_at",
- }
- // NewEnterpriseDao creates and returns a new DAO object for table data access.
- func NewEnterpriseDao() *EnterpriseDao {
- return &EnterpriseDao{
- Group: "default",
- Table: "enterprise",
- Columns: enterpriseColumns,
- }
- }
- // DB retrieves and returns the underlying raw database management object of current DAO.
- func (dao *EnterpriseDao) DB() gdb.DB {
- return g.DB(dao.Group)
- }
- // Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
- func (dao *EnterpriseDao) Ctx(ctx context.Context) *gdb.Model {
- return dao.DB().Model(dao.Table).Safe().Ctx(ctx)
- }
- // Transaction wraps the transaction logic using function f.
- // It rollbacks the transaction and returns the error from function f if it returns non-nil error.
- // It commits the transaction and returns nil if function f returns nil.
- //
- // Note that, you should not Commit or Rollback the transaction in function f
- // as it is automatically handled by this function.
- func (dao *EnterpriseDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {
- return dao.Ctx(ctx).Transaction(ctx, f)
- }
|