github.com/SupenBysz/gf-admin-community@v0.7.4/sys_model/sys_dao/internal/sys_person_license.go (about)

     1  // ==========================================================================
     2  // Code generated by GoFrame CLI tool. DO NOT EDIT.
     3  // ==========================================================================
     4  
     5  package internal
     6  
     7  import (
     8  	"context"
     9  
    10  	"github.com/kysion/base-library/utility/daoctl"
    11  	"github.com/kysion/base-library/utility/daoctl/dao_interface"
    12  
    13  	"github.com/gogf/gf/v2/database/gdb"
    14  	"github.com/gogf/gf/v2/frame/g"
    15  )
    16  
    17  // SysPersonLicenseDao is the data access object for table sys_person_license.
    18  type SysPersonLicenseDao struct {
    19  	table   string                  // table is the underlying table name of the DAO.
    20  	group   string                  // group is the database configuration group name of current DAO.
    21  	columns SysPersonLicenseColumns // columns contains all the column names of Table for convenient usage.
    22  }
    23  
    24  // SysPersonLicenseColumns defines and stores column names for table sys_person_license.
    25  type SysPersonLicenseColumns struct {
    26  	Id               string // ID
    27  	IdcardFrontPath  string // 身份证头像面照片
    28  	IdcardBackPath   string // 身份证国徽面照片
    29  	No               string // 身份证号
    30  	Gender           string // 性别
    31  	Nation           string // 名族
    32  	Name             string // 姓名
    33  	Birthday         string // 出生日期
    34  	Address          string // 家庭住址
    35  	IssuingAuthorit  string // 签发机关
    36  	IssuingDate      string // 签发日期
    37  	ExpriyDate       string //
    38  	CreatedAt        string //
    39  	UpdatedAt        string //
    40  	DeletedAt        string //
    41  	State            string // 状态:0失效、1正常
    42  	AuthType         string // 认证类型:
    43  	Remark           string // 备注信息
    44  	LatestAuditLogId string // 最新的审核记录id
    45  }
    46  
    47  // sysPersonLicenseColumns holds the columns for table sys_person_license.
    48  var sysPersonLicenseColumns = SysPersonLicenseColumns{
    49  	Id:               "id",
    50  	IdcardFrontPath:  "idcard_front_path",
    51  	IdcardBackPath:   "idcard_back_path",
    52  	No:               "no",
    53  	Gender:           "gender",
    54  	Nation:           "nation",
    55  	Name:             "name",
    56  	Birthday:         "birthday",
    57  	Address:          "address",
    58  	IssuingAuthorit:  "issuing_authorit",
    59  	IssuingDate:      "issuing_date",
    60  	ExpriyDate:       "expriy_date",
    61  	CreatedAt:        "created_at",
    62  	UpdatedAt:        "updated_at",
    63  	DeletedAt:        "deleted_at",
    64  	State:            "state",
    65  	AuthType:         "auth_type",
    66  	Remark:           "remark",
    67  	LatestAuditLogId: "latest_audit_logId",
    68  }
    69  
    70  // NewSysPersonLicenseDao creates and returns a new DAO object for table data access.
    71  func NewSysPersonLicenseDao(proxy ...dao_interface.IDao) *SysPersonLicenseDao {
    72  	var dao *SysPersonLicenseDao
    73  	if len(proxy) > 0 {
    74  		dao = &SysPersonLicenseDao{
    75  			group:   proxy[0].Group(),
    76  			table:   proxy[0].Table(),
    77  			columns: sysPersonLicenseColumns,
    78  		}
    79  		return dao
    80  	}
    81  
    82  	return &SysPersonLicenseDao{
    83  		group:   "default",
    84  		table:   "sys_person_license",
    85  		columns: sysPersonLicenseColumns,
    86  	}
    87  }
    88  
    89  // DB retrieves and returns the underlying raw database management object of current DAO.
    90  func (dao *SysPersonLicenseDao) DB() gdb.DB {
    91  	return g.DB(dao.group)
    92  }
    93  
    94  // Table returns the table name of current dao.
    95  func (dao *SysPersonLicenseDao) Table() string {
    96  	return dao.table
    97  }
    98  
    99  // Group returns the configuration group name of database of current dao.
   100  func (dao *SysPersonLicenseDao) Group() string {
   101  	return dao.group
   102  }
   103  
   104  // Columns returns all column names of current dao.
   105  func (dao *SysPersonLicenseDao) Columns() SysPersonLicenseColumns {
   106  	return dao.columns
   107  }
   108  
   109  // Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
   110  func (dao *SysPersonLicenseDao) Ctx(ctx context.Context, cacheOption ...*gdb.CacheOption) *gdb.Model {
   111  	return dao.DaoConfig(ctx, cacheOption...).Model
   112  }
   113  
   114  func (dao *SysPersonLicenseDao) DaoConfig(ctx context.Context, cacheOption ...*gdb.CacheOption) dao_interface.DaoConfig {
   115  	daoConfig := dao_interface.DaoConfig{
   116  		Dao:   dao,
   117  		DB:    dao.DB(),
   118  		Table: dao.table,
   119  		Group: dao.group,
   120  		Model: dao.DB().Model(dao.Table()).Safe().Ctx(ctx),
   121  	}
   122  
   123  	if len(cacheOption) == 0 {
   124  		daoConfig.CacheOption = daoctl.MakeDaoCache(dao.Table())
   125  		daoConfig.Model = daoConfig.Model.Cache(*daoConfig.CacheOption)
   126  	} else {
   127  		if cacheOption[0] != nil {
   128  			daoConfig.CacheOption = cacheOption[0]
   129  			daoConfig.Model = daoConfig.Model.Cache(*daoConfig.CacheOption)
   130  		}
   131  	}
   132  
   133  	daoConfig.Model = daoctl.RegisterDaoHook(daoConfig.Model)
   134  
   135  	return daoConfig
   136  }
   137  
   138  // Transaction wraps the transaction logic using function f.
   139  // It rollbacks the transaction and returns the error from function f if it returns non-nil error.
   140  // It commits the transaction and returns nil if function f returns nil.
   141  //
   142  // Note that, you should not Commit or Rollback the transaction in function f
   143  // as it is automatically handled by this function.
   144  func (dao *SysPersonLicenseDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
   145  	return dao.Ctx(ctx).Transaction(ctx, f)
   146  }