internal

package
v0.0.0-...-66d6a2b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 3, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MenuColumnsX = MenuColumns{}
	Menu         = MenuDao{
		M:     g.DB("default").Model("sys_menu").Safe(),
		DB:    g.DB("default"),
		Table: "sys_menu",
		Columns: MenuColumns{
			Id:         "id",
			ParentId:   "parent_id",
			Title:      "title",
			Icon:       "icon",
			Path:       "path",
			Component:  "component",
			Target:     "target",
			Permission: "permission",
			Type:       "type",
			Method:     "method",
			Status:     "status",
			Hide:       "hide",
			Note:       "note",
			Sort:       "sort",
			CreateUser: "create_user",
			CreateTime: "create_time",
			UpdateUser: "update_user",
			UpdateTime: "update_time",
			Mark:       "mark",
		},
	}
)

MenuColumns holds the columns for table sys_menu.

View Source
var (
	UserColumn = UserColumns{}
	User       = UserDao{
		M:     g.DB("default").Model("sys_user").Safe(),
		DB:    g.DB("default"),
		Table: "sys_user",
		Columns: UserColumns{
			Id:           "id",
			Realname:     "realname",
			Nickname:     "nickname",
			Gender:       "gender",
			Avatar:       "avatar",
			Mobile:       "mobile",
			Email:        "email",
			Birthday:     "birthday",
			DeptId:       "dept_id",
			LevelId:      "level_id",
			PositionId:   "position_id",
			ProvinceCode: "province_code",
			CityCode:     "city_code",
			DistrictCode: "district_code",
			Address:      "address",
			CityName:     "city_name",
			Username:     "username",
			Password:     "password",
			Salt:         "salt",
			Intro:        "intro",
			Status:       "status",
			Note:         "note",
			Sort:         "sort",
			LoginNum:     "login_num",
			LoginIp:      "login_ip",
			LoginTime:    "login_time",
			CreateUser:   "create_user",
			CreateTime:   "create_time",
			UpdateUser:   "update_user",
			UpdateTime:   "update_time",
			Mark:         "mark",
		},
	}
)

UserColumns holds the columns for table sys_user.

View Source
var AdColumns = AdColumns{}

AdColumns holds the columns for table sys_ad.

View Source
var AdSortColumns = AdSortColumns{}

AdSortColumns holds the columns for table sys_ad_sort.

View Source
var CityColumns = CityColumns{}

CityColumns holds the columns for table sys_city.

View Source
var ConfigColumns = ConfigColumns{}

ConfigColumns holds the columns for table sys_config.

View Source
var ConfigDataColumns = ConfigDataColumns{}

ConfigDataColumns holds the columns for table sys_config_data.

View Source
var DeptColumns = DeptColumns{}

DeptColumns holds the columns for table sys_dept.

View Source
var DictColumns = DictColumns{}

DictColumns holds the columns for table sys_dict.

View Source
var DictDataColumns = DictDataColumns{}

DictDataColumns holds the columns for table sys_dict_data.

View Source
var ExampleColumns = ExampleColumns{}

ExampleColumns holds the columns for table sys_example.

View Source
var ItemCateColumns = ItemCateColumns{}

ItemCateColumns holds the columns for table sys_item_cate.

View Source
var ItemColumns = ItemColumns{}

ItemColumns holds the columns for table sys_item.

View Source
var LevelColumns = LevelColumns{}

LevelColumns holds the columns for table sys_level.

View Source
var LinkColumns = LinkColumns{}

LinkColumns holds the columns for table sys_link.

View Source
var (
	// LoginLog is globally public accessible object for table sys_login_log operations.
	LoginLog = LoginLogDao{
		M:     g.DB("default").Model("sys_login_log").Safe(),
		DB:    g.DB("default"),
		Table: "sys_login_log",
		Columns: LoginLogColumns{
			Id:           "id",
			Username:     "username",
			Method:       "method",
			OperUrl:      "oper_url",
			OperIp:       "oper_ip",
			OperLocation: "oper_location",
			Os:           "os",
			RequestParam: "request_param",
			Browser:      "browser",
			Result:       "result",
			Status:       "status",
			Type:         "type",
			UserAgent:    "user_agent",
			Note:         "note",
			CreateUser:   "create_user",
			CreateTime:   "create_time",
			UpdateUser:   "update_user",
			UpdateTime:   "update_time",
			Mark:         "mark",
		},
	}
)
View Source
var MemberColumns = MemberColumns{}

MemberColumns holds the columns for table ums_member.

View Source
var MemberLevelColumns = MemberLevelColumns{}

MemberLevelColumns holds the columns for table ums_member_level.

View Source
var NoticeColumns = NoticeColumns{}

NoticeColumns holds the columns for table sys_notice.

View Source
var (
	// OperLog is globally public accessible object for table sys_oper_log operations.
	OperLog = OperLogDao{
		M:     g.DB("default").Model("sys_oper_log").Safe(),
		DB:    g.DB("default"),
		Table: "sys_oper_log",
		Columns: OperLogColumns{
			Id:           "id",
			Model:        "model",
			OperType:     "oper_type",
			OperMethod:   "oper_method",
			Username:     "username",
			OperName:     "oper_name",
			OperUrl:      "oper_url",
			OperIp:       "oper_ip",
			OperLocation: "oper_location",
			RequestParam: "request_param",
			Result:       "result",
			Status:       "status",
			UserAgent:    "user_agent",
			Note:         "note",
			CreateUser:   "create_user",
			CreateTime:   "create_time",
			UpdateUser:   "update_user",
			UpdateTime:   "update_time",
			Mark:         "mark",
		},
	}
)
View Source
var PositionColumns = PositionColumns{}

PositionColumns holds the columns for table sys_position.

View Source
var RoleColumns = RoleColumns{}

RoleColumns holds the columns for table sys_role.

View Source
var RoleMenuColumns = RoleMenuColumns{}

RoleMenuColumns holds the columns for table sys_role_menu.

View Source
var UserRoleColumns = UserRoleColumns{}

UserRoleColumns holds the columns for table sys_user_role.

Functions

This section is empty.

Types

type AdColumns

type AdColumns struct {
}

AdColumns defines and stores column names for table sys_ad.

type AdDao

type AdDao struct {
	// contains filtered or unexported fields
}

AdDao is the data access object for table sys_ad.

func NewAdDao

func NewAdDao() *AdDao

NewAdDao creates and returns a new DAO object for table data access.

func (*AdDao) Columns

func (dao *AdDao) Columns() AdColumns

Columns returns all column names of current dao.

func (*AdDao) Ctx

func (dao *AdDao) Ctx(ctx context.Context) *gdb.Model

Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.

func (*AdDao) DB

func (dao *AdDao) DB() gdb.DB

DB retrieves and returns the underlying raw database management object of current DAO.

func (*AdDao) Group

func (dao *AdDao) Group() string

Group returns the configuration group name of database of current dao.

func (*AdDao) Table

func (dao *AdDao) Table() string

Table returns the table name of current dao.

func (*AdDao) Transaction

func (dao *AdDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error)

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.

type AdSortColumns

type AdSortColumns struct {
}

AdSortColumns defines and stores column names for table sys_ad_sort.

type AdSortDao

type AdSortDao struct {
	// contains filtered or unexported fields
}

AdSortDao is the data access object for table sys_ad_sort.

func NewAdSortDao

func NewAdSortDao() *AdSortDao

NewAdSortDao creates and returns a new DAO object for table data access.

func (*AdSortDao) Columns

func (dao *AdSortDao) Columns() AdSortColumns

Columns returns all column names of current dao.

func (*AdSortDao) Ctx

func (dao *AdSortDao) Ctx(ctx context.Context) *gdb.Model

Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.

func (*AdSortDao) DB

func (dao *AdSortDao) DB() gdb.DB

DB retrieves and returns the underlying raw database management object of current DAO.

func (*AdSortDao) Group

func (dao *AdSortDao) Group() string

Group returns the configuration group name of database of current dao.

func (*AdSortDao) Table

func (dao *AdSortDao) Table() string

Table returns the table name of current dao.

func (*AdSortDao) Transaction

func (dao *AdSortDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error)

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.

type CityColumns

type CityColumns struct {
}

CityColumns defines and stores column names for table sys_city.

type CityDao

type CityDao struct {
	// contains filtered or unexported fields
}

CityDao is the data access object for table sys_city.

func NewCityDao

func NewCityDao() *CityDao

NewCityDao creates and returns a new DAO object for table data access.

func (*CityDao) Columns

func (dao *CityDao) Columns() CityColumns

Columns returns all column names of current dao.

func (*CityDao) Ctx

func (dao *CityDao) Ctx(ctx context.Context) *gdb.Model

Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.

func (*CityDao) DB

func (dao *CityDao) DB() gdb.DB

DB retrieves and returns the underlying raw database management object of current DAO.

func (*CityDao) Group

func (dao *CityDao) Group() string

Group returns the configuration group name of database of current dao.

func (*CityDao) Table

func (dao *CityDao) Table() string

Table returns the table name of current dao.

func (*CityDao) Transaction

func (dao *CityDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error)

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.

type ConfigColumns

type ConfigColumns struct {
}

ConfigColumns defines and stores column names for table sys_config.

type ConfigDao

type ConfigDao struct {
	// contains filtered or unexported fields
}

ConfigDao is the data access object for table sys_config.

func NewConfigDao

func NewConfigDao() *ConfigDao

NewConfigDao creates and returns a new DAO object for table data access.

func (*ConfigDao) Columns

func (dao *ConfigDao) Columns() ConfigColumns

Columns returns all column names of current dao.

func (*ConfigDao) Ctx

func (dao *ConfigDao) Ctx(ctx context.Context) *gdb.Model

Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.

func (*ConfigDao) DB

func (dao *ConfigDao) DB() gdb.DB

DB retrieves and returns the underlying raw database management object of current DAO.

func (*ConfigDao) Group

func (dao *ConfigDao) Group() string

Group returns the configuration group name of database of current dao.

func (*ConfigDao) Table

func (dao *ConfigDao) Table() string

Table returns the table name of current dao.

func (*ConfigDao) Transaction

func (dao *ConfigDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error)

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.

type ConfigDataColumns

type ConfigDataColumns struct {
}

ConfigDataColumns defines and stores column names for table sys_config_data.

type ConfigDataDao

type ConfigDataDao struct {
	// contains filtered or unexported fields
}

ConfigDataDao is the data access object for table sys_config_data.

func NewConfigDataDao

func NewConfigDataDao() *ConfigDataDao

NewConfigDataDao creates and returns a new DAO object for table data access.

func (*ConfigDataDao) Columns

func (dao *ConfigDataDao) Columns() ConfigDataColumns

Columns returns all column names of current dao.

func (*ConfigDataDao) Ctx

func (dao *ConfigDataDao) Ctx(ctx context.Context) *gdb.Model

Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.

func (*ConfigDataDao) DB

func (dao *ConfigDataDao) DB() gdb.DB

DB retrieves and returns the underlying raw database management object of current DAO.

func (*ConfigDataDao) Group

func (dao *ConfigDataDao) Group() string

Group returns the configuration group name of database of current dao.

func (*ConfigDataDao) Table

func (dao *ConfigDataDao) Table() string

Table returns the table name of current dao.

func (*ConfigDataDao) Transaction

func (dao *ConfigDataDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error)

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.

type DeptColumns

type DeptColumns struct {
}

DeptColumns defines and stores column names for table sys_dept.

type DeptDao

type DeptDao struct {
	// contains filtered or unexported fields
}

DeptDao is the data access object for table sys_dept.

func NewDeptDao

func NewDeptDao() *DeptDao

NewDeptDao creates and returns a new DAO object for table data access.

func (*DeptDao) Columns

func (dao *DeptDao) Columns() DeptColumns

Columns returns all column names of current dao.

func (*DeptDao) Ctx

func (dao *DeptDao) Ctx(ctx context.Context) *gdb.Model

Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.

func (*DeptDao) DB

func (dao *DeptDao) DB() gdb.DB

DB retrieves and returns the underlying raw database management object of current DAO.

func (*DeptDao) Group

func (dao *DeptDao) Group() string

Group returns the configuration group name of database of current dao.

func (*DeptDao) Table

func (dao *DeptDao) Table() string

Table returns the table name of current dao.

func (*DeptDao) Transaction

func (dao *DeptDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error)

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.

type DictColumns

type DictColumns struct {
}

DictColumns defines and stores column names for table sys_dict.

type DictDao

type DictDao struct {
	// contains filtered or unexported fields
}

DictDao is the data access object for table sys_dict.

func NewDictDao

func NewDictDao() *DictDao

NewDictDao creates and returns a new DAO object for table data access.

func (*DictDao) Columns

func (dao *DictDao) Columns() DictColumns

Columns returns all column names of current dao.

func (*DictDao) Ctx

func (dao *DictDao) Ctx(ctx context.Context) *gdb.Model

Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.

func (*DictDao) DB

func (dao *DictDao) DB() gdb.DB

DB retrieves and returns the underlying raw database management object of current DAO.

func (*DictDao) Group

func (dao *DictDao) Group() string

Group returns the configuration group name of database of current dao.

func (*DictDao) Table

func (dao *DictDao) Table() string

Table returns the table name of current dao.

func (*DictDao) Transaction

func (dao *DictDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error)

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.

type DictDataColumns

type DictDataColumns struct {
}

DictDataColumns defines and stores column names for table sys_dict_data.

type DictDataDao

type DictDataDao struct {
	// contains filtered or unexported fields
}

DictDataDao is the data access object for table sys_dict_data.

func NewDictDataDao

func NewDictDataDao() *DictDataDao

NewDictDataDao creates and returns a new DAO object for table data access.

func (*DictDataDao) Columns

func (dao *DictDataDao) Columns() DictDataColumns

Columns returns all column names of current dao.

func (*DictDataDao) Ctx

func (dao *DictDataDao) Ctx(ctx context.Context) *gdb.Model

Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.

func (*DictDataDao) DB

func (dao *DictDataDao) DB() gdb.DB

DB retrieves and returns the underlying raw database management object of current DAO.

func (*DictDataDao) Group

func (dao *DictDataDao) Group() string

Group returns the configuration group name of database of current dao.

func (*DictDataDao) Table

func (dao *DictDataDao) Table() string

Table returns the table name of current dao.

func (*DictDataDao) Transaction

func (dao *DictDataDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error)

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.

type ExampleColumns

type ExampleColumns struct {
}

ExampleColumns defines and stores column names for table sys_example.

type ExampleDao

type ExampleDao struct {
	// contains filtered or unexported fields
}

ExampleDao is the data access object for table sys_example.

func NewExampleDao

func NewExampleDao() *ExampleDao

NewExampleDao creates and returns a new DAO object for table data access.

func (*ExampleDao) Columns

func (dao *ExampleDao) Columns() ExampleColumns

Columns returns all column names of current dao.

func (*ExampleDao) Ctx

func (dao *ExampleDao) Ctx(ctx context.Context) *gdb.Model

Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.

func (*ExampleDao) DB

func (dao *ExampleDao) DB() gdb.DB

DB retrieves and returns the underlying raw database management object of current DAO.

func (*ExampleDao) Group

func (dao *ExampleDao) Group() string

Group returns the configuration group name of database of current dao.

func (*ExampleDao) Table

func (dao *ExampleDao) Table() string

Table returns the table name of current dao.

func (*ExampleDao) Transaction

func (dao *ExampleDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error)

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.

type ItemCateColumns

type ItemCateColumns struct {
}

ItemCateColumns defines and stores column names for table sys_item_cate.

type ItemCateDao

type ItemCateDao struct {
	// contains filtered or unexported fields
}

ItemCateDao is the data access object for table sys_item_cate.

func NewItemCateDao

func NewItemCateDao() *ItemCateDao

NewItemCateDao creates and returns a new DAO object for table data access.

func (*ItemCateDao) Columns

func (dao *ItemCateDao) Columns() ItemCateColumns

Columns returns all column names of current dao.

func (*ItemCateDao) Ctx

func (dao *ItemCateDao) Ctx(ctx context.Context) *gdb.Model

Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.

func (*ItemCateDao) DB

func (dao *ItemCateDao) DB() gdb.DB

DB retrieves and returns the underlying raw database management object of current DAO.

func (*ItemCateDao) Group

func (dao *ItemCateDao) Group() string

Group returns the configuration group name of database of current dao.

func (*ItemCateDao) Table

func (dao *ItemCateDao) Table() string

Table returns the table name of current dao.

func (*ItemCateDao) Transaction

func (dao *ItemCateDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error)

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.

type ItemColumns

type ItemColumns struct {
}

ItemColumns defines and stores column names for table sys_item.

type ItemDao

type ItemDao struct {
	// contains filtered or unexported fields
}

ItemDao is the data access object for table sys_item.

func NewItemDao

func NewItemDao() *ItemDao

NewItemDao creates and returns a new DAO object for table data access.

func (*ItemDao) Columns

func (dao *ItemDao) Columns() ItemColumns

Columns returns all column names of current dao.

func (*ItemDao) Ctx

func (dao *ItemDao) Ctx(ctx context.Context) *gdb.Model

Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.

func (*ItemDao) DB

func (dao *ItemDao) DB() gdb.DB

DB retrieves and returns the underlying raw database management object of current DAO.

func (*ItemDao) Group

func (dao *ItemDao) Group() string

Group returns the configuration group name of database of current dao.

func (*ItemDao) Table

func (dao *ItemDao) Table() string

Table returns the table name of current dao.

func (*ItemDao) Transaction

func (dao *ItemDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error)

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.

type LevelColumns

type LevelColumns struct {
}

LevelColumns defines and stores column names for table sys_level.

type LevelDao

type LevelDao struct {
	// contains filtered or unexported fields
}

LevelDao is the data access object for table sys_level.

func NewLevelDao

func NewLevelDao() *LevelDao

NewLevelDao creates and returns a new DAO object for table data access.

func (*LevelDao) Columns

func (dao *LevelDao) Columns() LevelColumns

Columns returns all column names of current dao.

func (*LevelDao) Ctx

func (dao *LevelDao) Ctx(ctx context.Context) *gdb.Model

Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.

func (*LevelDao) DB

func (dao *LevelDao) DB() gdb.DB

DB retrieves and returns the underlying raw database management object of current DAO.

func (*LevelDao) Group

func (dao *LevelDao) Group() string

Group returns the configuration group name of database of current dao.

func (*LevelDao) Table

func (dao *LevelDao) Table() string

Table returns the table name of current dao.

func (*LevelDao) Transaction

func (dao *LevelDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error)

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.

type LinkColumns

type LinkColumns struct {
}

LinkColumns defines and stores column names for table sys_link.

type LinkDao

type LinkDao struct {
	// contains filtered or unexported fields
}

LinkDao is the data access object for table sys_link.

func NewLinkDao

func NewLinkDao() *LinkDao

NewLinkDao creates and returns a new DAO object for table data access.

func (*LinkDao) Columns

func (dao *LinkDao) Columns() LinkColumns

Columns returns all column names of current dao.

func (*LinkDao) Ctx

func (dao *LinkDao) Ctx(ctx context.Context) *gdb.Model

Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.

func (*LinkDao) DB

func (dao *LinkDao) DB() gdb.DB

DB retrieves and returns the underlying raw database management object of current DAO.

func (*LinkDao) Group

func (dao *LinkDao) Group() string

Group returns the configuration group name of database of current dao.

func (*LinkDao) Table

func (dao *LinkDao) Table() string

Table returns the table name of current dao.

func (*LinkDao) Transaction

func (dao *LinkDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error)

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.

type LoginLogColumns

type LoginLogColumns struct {
	Id           string // 主键ID
	Username     string // 操作账号
	Method       string // 操作方法
	OperUrl      string // 请求URL
	OperIp       string // 主机地址
	OperLocation string // 操作地点
	Os           string // 操作系统
	RequestParam string // 请求参数
	Browser      string // 浏览器
	Result       string // 返回参数
	Status       string // 操作状态:0操作成功 1操作失败
	Type         string // 操作类型:1登录成功 2登录失败 3注销成功 2注销失败
	UserAgent    string // 代理信息
	Note         string // 备注
	CreateUser   string // 添加人
	CreateTime   string // 操作时间
	UpdateUser   string // 更新人
	UpdateTime   string // 更新时间
	Mark         string // 有效标识
}

type LoginLogDao

type LoginLogDao struct {
	gmvc.M
	DB      gdb.DB
	Table   string
	Columns LoginLogColumns
}

func (*LoginLogDao) All

func (d *LoginLogDao) All(where ...interface{}) ([]*model.LoginLog, error)

func (*LoginLogDao) And

func (d *LoginLogDao) And(where interface{}, args ...interface{}) *LoginLogDao

And adds "AND" condition to the where statement.

func (*LoginLogDao) Args

func (d *LoginLogDao) Args(args ...interface{}) *LoginLogDao

Args sets custom arguments for model operation.

func (*LoginLogDao) As

func (d *LoginLogDao) As(as string) *LoginLogDao

As sets an alias name for current table.

func (*LoginLogDao) Batch

func (d *LoginLogDao) Batch(batch int) *LoginLogDao

func (*LoginLogDao) Cache

func (d *LoginLogDao) Cache(duration time.Duration, name ...string) *LoginLogDao

func (*LoginLogDao) Chunk

func (d *LoginLogDao) Chunk(limit int, callback func(entities []*model.LoginLog, err error) bool)

Chunk iterates the table with given size and callback function.

func (*LoginLogDao) Ctx

func (d *LoginLogDao) Ctx(ctx context.Context) *LoginLogDao

a global or package variable for long using.

func (*LoginLogDao) Data

func (d *LoginLogDao) Data(data ...interface{}) *LoginLogDao

func (*LoginLogDao) Fields

func (d *LoginLogDao) Fields(fieldNamesOrMapStruct ...interface{}) *LoginLogDao

Fields sets the operation fields of the model, multiple fields joined using char ','. The parameter <fieldNamesOrMapStruct> can be type of string/map/*map/struct/*struct.

func (*LoginLogDao) FieldsEx

func (d *LoginLogDao) FieldsEx(fieldNamesOrMapStruct ...interface{}) *LoginLogDao

FieldsEx sets the excluded operation fields of the model, multiple fields joined using char ','. The parameter <fieldNamesOrMapStruct> can be type of string/map/*map/struct/*struct.

func (*LoginLogDao) Filter

func (d *LoginLogDao) Filter() *LoginLogDao

Filter marks filtering the fields which does not exist in the fields of the operated table.

func (*LoginLogDao) FindAll

func (d *LoginLogDao) FindAll(where ...interface{}) ([]*model.LoginLog, error)

FindAll retrieves and returns Result by by M.WherePri and M.All. Also see M.WherePri and M.All.

func (*LoginLogDao) FindOne

func (d *LoginLogDao) FindOne(where ...interface{}) (*model.LoginLog, error)

func (*LoginLogDao) Group

func (d *LoginLogDao) Group(groupBy string) *LoginLogDao

Group sets the "GROUP BY" statement for the model.

func (*LoginLogDao) InnerJoin

func (d *LoginLogDao) InnerJoin(table ...string) *LoginLogDao

func (*LoginLogDao) LeftJoin

func (d *LoginLogDao) LeftJoin(table ...string) *LoginLogDao

func (*LoginLogDao) Limit

func (d *LoginLogDao) Limit(limit ...int) *LoginLogDao

Limit sets the "LIMIT" statement for the model. The parameter <limit> can be either one or two number, if passed two number is passed, it then sets "LIMIT limit[0],limit[1]" statement for the model, or else it sets "LIMIT limit[0]" statement.

func (*LoginLogDao) LockShared

func (d *LoginLogDao) LockShared() *LoginLogDao

func (*LoginLogDao) LockUpdate

func (d *LoginLogDao) LockUpdate() *LoginLogDao

func (*LoginLogDao) Master

func (d *LoginLogDao) Master() *LoginLogDao

Master marks the following operation on master node.

func (*LoginLogDao) Offset

func (d *LoginLogDao) Offset(offset int) *LoginLogDao

func (*LoginLogDao) OmitEmpty

func (d *LoginLogDao) OmitEmpty() *LoginLogDao

OmitEmpty sets OPTION_OMITEMPTY option for the model, which automatically filers the data and where attributes for empty values.

func (*LoginLogDao) One

func (d *LoginLogDao) One(where ...interface{}) (*model.LoginLog, error)

func (*LoginLogDao) Option

func (d *LoginLogDao) Option(option int) *LoginLogDao

Option sets the extra operation option for the model.

func (*LoginLogDao) Or

func (d *LoginLogDao) Or(where interface{}, args ...interface{}) *LoginLogDao

Or adds "OR" condition to the where statement.

func (*LoginLogDao) Order

func (d *LoginLogDao) Order(orderBy ...string) *LoginLogDao

Order sets the "ORDER BY" statement for the model.

func (*LoginLogDao) Page

func (d *LoginLogDao) Page(page, limit int) *LoginLogDao

func (*LoginLogDao) RightJoin

func (d *LoginLogDao) RightJoin(table ...string) *LoginLogDao

func (*LoginLogDao) Scan

func (d *LoginLogDao) Scan(pointer interface{}, where ...interface{}) error

func (*LoginLogDao) Slave

func (d *LoginLogDao) Slave() *LoginLogDao

func (*LoginLogDao) Struct

func (d *LoginLogDao) Struct(pointer interface{}, where ...interface{}) error

func (*LoginLogDao) Structs

func (d *LoginLogDao) Structs(pointer interface{}, where ...interface{}) error

func (*LoginLogDao) TX

func (d *LoginLogDao) TX(tx *gdb.TX) *LoginLogDao

TX sets the transaction for current operation.

func (*LoginLogDao) Unscoped

func (d *LoginLogDao) Unscoped() *LoginLogDao

Unscoped enables/disables the soft deleting feature.

func (*LoginLogDao) Where

func (d *LoginLogDao) Where(where interface{}, args ...interface{}) *LoginLogDao

Where sets the condition statement for the model. The parameter <where> can be type of string/map/gmap/slice/struct/*struct, etc. Note that, if it's called more than one times, multiple conditions will be joined into where statement using "AND". Eg: Where("uid=10000") Where("uid", 10000) Where("money>? AND name like ?", 99999, "vip_%") Where("uid", 1).Where("name", "john") Where("status IN (?)", g.Slice{1,2,3}) Where("age IN(?,?)", 18, 50) Where(User{ Id : 1, UserName : "john"})

func (*LoginLogDao) WherePri

func (d *LoginLogDao) WherePri(where interface{}, args ...interface{}) *LoginLogDao

WherePri does the same logic as M.Where except that if the parameter <where> is a single condition like int/string/float/slice, it treats the condition as the primary key value. That is, if primary key is "id" and given <where> parameter as "123", the WherePri function treats the condition as "id=123", but M.Where treats the condition as string "123".

type MemberColumns

type MemberColumns struct {
}

MemberColumns defines and stores column names for table ums_member.

type MemberDao

type MemberDao struct {
	// contains filtered or unexported fields
}

MemberDao is the data access object for table ums_member.

func NewMemberDao

func NewMemberDao() *MemberDao

NewMemberDao creates and returns a new DAO object for table data access.

func (*MemberDao) Columns

func (dao *MemberDao) Columns() MemberColumns

Columns returns all column names of current dao.

func (*MemberDao) Ctx

func (dao *MemberDao) Ctx(ctx context.Context) *gdb.Model

Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.

func (*MemberDao) DB

func (dao *MemberDao) DB() gdb.DB

DB retrieves and returns the underlying raw database management object of current DAO.

func (*MemberDao) Group

func (dao *MemberDao) Group() string

Group returns the configuration group name of database of current dao.

func (*MemberDao) Table

func (dao *MemberDao) Table() string

Table returns the table name of current dao.

func (*MemberDao) Transaction

func (dao *MemberDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error)

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.

type MemberLevelColumns

type MemberLevelColumns struct {
}

MemberLevelColumns defines and stores column names for table ums_member_level.

type MemberLevelDao

type MemberLevelDao struct {
	// contains filtered or unexported fields
}

MemberLevelDao is the data access object for table ums_member_level.

func NewMemberLevelDao

func NewMemberLevelDao() *MemberLevelDao

NewMemberLevelDao creates and returns a new DAO object for table data access.

func (*MemberLevelDao) Columns

func (dao *MemberLevelDao) Columns() MemberLevelColumns

Columns returns all column names of current dao.

func (*MemberLevelDao) Ctx

func (dao *MemberLevelDao) Ctx(ctx context.Context) *gdb.Model

Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.

func (*MemberLevelDao) DB

func (dao *MemberLevelDao) DB() gdb.DB

DB retrieves and returns the underlying raw database management object of current DAO.

func (*MemberLevelDao) Group

func (dao *MemberLevelDao) Group() string

Group returns the configuration group name of database of current dao.

func (*MemberLevelDao) Table

func (dao *MemberLevelDao) Table() string

Table returns the table name of current dao.

func (*MemberLevelDao) Transaction

func (dao *MemberLevelDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error)

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.

type MenuColumns struct {
	Id         string // 主键ID
	ParentId   string // 父级ID
	Title      string // 菜单标题
	Icon       string // 图标
	Path       string // 菜单路径
	Component  string // 菜单组件
	Target     string // 打开方式:0组件 1内链 2外链
	Permission string // 权限标识
	Type       string // 类型:0菜单 1节点
	Method     string // 请求方式
	Status     string // 状态:1正常 2禁用
	Hide       string // 是否可见:1是 2否
	Note       string // 备注
	Sort       string // 显示顺序
	CreateUser string // 添加人
	CreateTime string // 创建时间
	UpdateUser string // 更新人
	UpdateTime string // 更新时间
	Mark       string // 有效标识
}

MenuColumns defines and stores column names for table sys_menu.

type MenuDao struct {
	gmvc.M
	DB    gdb.DB
	Table string

	Columns MenuColumns // columns contains all the column names of Table for convenient usage.
	// contains filtered or unexported fields
}

MenuDao is the data access object for table sys_menu.

func NewMenuDao

func NewMenuDao() *MenuDao

NewMenuDao creates and returns a new DAO object for table data access.

func (d *MenuDao) All(where ...interface{}) ([]*model.Menu, error)

All does "SELECT FROM ..." statement for the model. It retrieves the records from table and returns the result as []*model.Menu. It returns nil if there's no record retrieved with the given conditions from table.

The optional parameter <where> is the same as the parameter of M.Where function, see M.Where.

func (d *MenuDao) And(where interface{}, args ...interface{}) *MenuDao

And adds "AND" condition to the where statement.

func (d *MenuDao) Args(args ...interface{}) *MenuDao

Args sets custom arguments for model operation.

func (d *MenuDao) As(as string) *MenuDao

As sets an alias name for current table.

func (d *MenuDao) Batch(batch int) *MenuDao

Batch sets the batch operation number for the model.

func (d *MenuDao) Cache(duration time.Duration, name ...string) *MenuDao

Cache sets the cache feature for the model. It caches the result of the sql, which means if there's another same sql request, it just reads and returns the result from cache, it but not committed and executed into the database.

If the parameter <duration> < 0, which means it clear the cache with given <name>. If the parameter <duration> = 0, which means it never expires. If the parameter <duration> > 0, which means it expires after <duration>.

The optional parameter <name> is used to bind a name to the cache, which means you can later control the cache like changing the <duration> or clearing the cache with specified <name>.

Note that, the cache feature is disabled if the model is operating on a transaction.

func (d *MenuDao) Chunk(limit int, callback func(entities []*model.Menu, err error) bool)

Chunk iterates the table with given size and callback function.

func (dao *MenuDao) Columnsx() MenuColumns

Columns returns all column names of current dao.

func (d *MenuDao) Ctx(ctx context.Context) *MenuDao
func (dao *MenuDao) CtxO(ctx context.Context) *gdb.Model

Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.

func (dao *MenuDao) DBO() gdb.DB

DB retrieves and returns the underlying raw database management object of current DAO.

func (d *MenuDao) Data(data ...interface{}) *MenuDao

Data sets the operation data for the model. The parameter <data> can be type of string/map/gmap/slice/struct/*struct, etc. Eg: Data("uid=10000") Data("uid", 10000) Data(g.Map{"uid": 10000, "name":"john"}) Data(g.Slice{g.Map{"uid": 10000, "name":"john"}, g.Map{"uid": 20000, "name":"smith"})

func (d *MenuDao) Fields(fieldNamesOrMapStruct ...interface{}) *MenuDao

Fields sets the operation fields of the model, multiple fields joined using char ','. The parameter <fieldNamesOrMapStruct> can be type of string/map/*map/struct/*struct.

func (d *MenuDao) FieldsEx(fieldNamesOrMapStruct ...interface{}) *MenuDao

FieldsEx sets the excluded operation fields of the model, multiple fields joined using char ','. The parameter <fieldNamesOrMapStruct> can be type of string/map/*map/struct/*struct.

func (d *MenuDao) Filter() *MenuDao

Filter marks filtering the fields which does not exist in the fields of the operated table.

func (d *MenuDao) FindAll(where ...interface{}) ([]*model.Menu, error)

FindAll retrieves and returns Result by by M.WherePri and M.All. Also see M.WherePri and M.All.

func (d *MenuDao) FindOne(where ...interface{}) (*model.Menu, error)

FindOne retrieves and returns a single Record by M.WherePri and M.One. Also see M.WherePri and M.One.

func (d *MenuDao) Group(groupBy string) *MenuDao

Group sets the "GROUP BY" statement for the model.

func (d *MenuDao) InnerJoin(table ...string) *MenuDao

InnerJoin does "INNER JOIN ... ON ..." statement on the model. The parameter <table> can be joined table and its joined condition, and also with its alias name, like: Table("user").InnerJoin("user_detail", "user_detail.uid=user.uid") Table("user", "u").InnerJoin("user_detail", "ud", "ud.uid=u.uid")

func (d *MenuDao) LeftJoin(table ...string) *MenuDao

LeftJoin does "LEFT JOIN ... ON ..." statement on the model. The parameter <table> can be joined table and its joined condition, and also with its alias name, like: Table("user").LeftJoin("user_detail", "user_detail.uid=user.uid") Table("user", "u").LeftJoin("user_detail", "ud", "ud.uid=u.uid")

func (d *MenuDao) Limit(limit ...int) *MenuDao

Limit sets the "LIMIT" statement for the model. The parameter <limit> can be either one or two number, if passed two number is passed, it then sets "LIMIT limit[0],limit[1]" statement for the model, or else it sets "LIMIT limit[0]" statement.

func (d *MenuDao) LockShared() *MenuDao

LockShared sets the lock in share mode for current operation.

func (d *MenuDao) LockUpdate() *MenuDao

LockUpdate sets the lock for update for current operation.

func (d *MenuDao) Master() *MenuDao

Master marks the following operation on master node.

func (d *MenuDao) Offset(offset int) *MenuDao

Offset sets the "OFFSET" statement for the model. It only makes sense for some databases like SQLServer, PostgreSQL, etc.

func (d *MenuDao) OmitEmpty() *MenuDao

OmitEmpty sets OPTION_OMITEMPTY option for the model, which automatically filers the data and where attributes for empty values.

func (d *MenuDao) One(where ...interface{}) (*model.Menu, error)

One retrieves one record from table and returns the result as *model.Menu. It returns nil if there's no record retrieved with the given conditions from table.

The optional parameter <where> is the same as the parameter of M.Where function, see M.Where.

func (d *MenuDao) Option(option int) *MenuDao

Option sets the extra operation option for the model.

func (d *MenuDao) Or(where interface{}, args ...interface{}) *MenuDao

Or adds "OR" condition to the where statement.

func (d *MenuDao) Order(orderBy ...string) *MenuDao

Order sets the "ORDER BY" statement for the model.

func (d *MenuDao) Page(page, limit int) *MenuDao

Page sets the paging number for the model. The parameter <page> is started from 1 for paging. Note that, it differs that the Limit function start from 0 for "LIMIT" statement.

func (d *MenuDao) RightJoin(table ...string) *MenuDao

RightJoin does "RIGHT JOIN ... ON ..." statement on the model. The parameter <table> can be joined table and its joined condition, and also with its alias name, like: Table("user").RightJoin("user_detail", "user_detail.uid=user.uid") Table("user", "u").RightJoin("user_detail", "ud", "ud.uid=u.uid")

func (d *MenuDao) Scan(pointer interface{}, where ...interface{}) error

Scan automatically calls Struct or Structs function according to the type of parameter <pointer>. It calls function Struct if <pointer> is type of *struct/**struct. It calls function Structs if <pointer> is type of *[]struct/*[]*struct.

The optional parameter <where> is the same as the parameter of Model.Where function, see Model.Where.

Note that it returns sql.ErrNoRows if there's no record retrieved and given pointer is not empty or nil.

Eg: user := new(User) err := dao.User.Where("id", 1).Scan(user)

user := (*User)(nil) err := dao.User.Where("id", 1).Scan(&user)

users := ([]User)(nil) err := dao.User.Scan(&users)

users := ([]*User)(nil) err := dao.User.Scan(&users)

func (d *MenuDao) Slave() *MenuDao

Slave marks the following operation on slave node. Note that it makes sense only if there's any slave node configured.

func (d *MenuDao) Struct(pointer interface{}, where ...interface{}) error

Struct retrieves one record from table and converts it into given struct. The parameter <pointer> should be type of *struct/**struct. If type **struct is given, it can create the struct internally during converting.

The optional parameter <where> is the same as the parameter of Model.Where function, see Model.Where.

Note that it returns sql.ErrNoRows if there's no record retrieved with the given conditions from table and <pointer> is not nil.

Eg: user := new(User) err := dao.User.Where("id", 1).Struct(user)

user := (*User)(nil) err := dao.User.Where("id", 1).Struct(&user)

func (d *MenuDao) Structs(pointer interface{}, where ...interface{}) error

Structs retrieves records from table and converts them into given struct slice. The parameter <pointer> should be type of *[]struct/*[]*struct. It can create and fill the struct slice internally during converting.

The optional parameter <where> is the same as the parameter of Model.Where function, see Model.Where.

Note that it returns sql.ErrNoRows if there's no record retrieved with the given conditions from table and <pointer> is not empty.

Eg: users := ([]User)(nil) err := dao.User.Structs(&users)

users := ([]*User)(nil) err := dao.User.Structs(&users)

func (d *MenuDao) TX(tx *gdb.TX) *MenuDao

TX sets the transaction for current operation.

func (d *MenuDao) Unscoped() *MenuDao

Unscoped enables/disables the soft deleting feature.

func (d *MenuDao) Where(where interface{}, args ...interface{}) *MenuDao

Where sets the condition statement for the model. The parameter <where> can be type of string/map/gmap/slice/struct/*struct, etc. Note that, if it's called more than one times, multiple conditions will be joined into where statement using "AND". Eg: Where("uid=10000") Where("uid", 10000) Where("money>? AND name like ?", 99999, "vip_%") Where("uid", 1).Where("name", "john") Where("status IN (?)", g.Slice{1,2,3}) Where("age IN(?,?)", 18, 50) Where(User{ Id : 1, UserName : "john"})

func (d *MenuDao) WherePri(where interface{}, args ...interface{}) *MenuDao

WherePri does the same logic as M.Where except that if the parameter <where> is a single condition like int/string/float/slice, it treats the condition as the primary key value. That is, if primary key is "id" and given <where> parameter as "123", the WherePri function treats the condition as "id=123", but M.Where treats the condition as string "123".

type NoticeColumns

type NoticeColumns struct {
}

NoticeColumns defines and stores column names for table sys_notice.

type NoticeDao

type NoticeDao struct {
	// contains filtered or unexported fields
}

NoticeDao is the data access object for table sys_notice.

func NewNoticeDao

func NewNoticeDao() *NoticeDao

NewNoticeDao creates and returns a new DAO object for table data access.

func (*NoticeDao) Columns

func (dao *NoticeDao) Columns() NoticeColumns

Columns returns all column names of current dao.

func (*NoticeDao) Ctx

func (dao *NoticeDao) Ctx(ctx context.Context) *gdb.Model

Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.

func (*NoticeDao) DB

func (dao *NoticeDao) DB() gdb.DB

DB retrieves and returns the underlying raw database management object of current DAO.

func (*NoticeDao) Group

func (dao *NoticeDao) Group() string

Group returns the configuration group name of database of current dao.

func (*NoticeDao) Table

func (dao *NoticeDao) Table() string

Table returns the table name of current dao.

func (*NoticeDao) Transaction

func (dao *NoticeDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error)

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.

type OperLogColumns

type OperLogColumns struct {
	Id           string // 主键ID
	Model        string // 操作模块
	OperType     string // 操作类型:0其它 1新增 2修改 3删除 4查询 5设置状态 6导入 7导出 8设置权限 9设置密码
	OperMethod   string // 操作方法
	Username     string // 操作账号
	OperName     string // 操作用户
	OperUrl      string // 请求URL
	OperIp       string // 主机地址
	OperLocation string // 操作地点
	RequestParam string // 请求参数
	Result       string // 返回参数
	Status       string // 日志状态:0正常日志 1错误日志
	UserAgent    string // 代理信息
	Note         string // 备注
	CreateUser   string // 添加人
	CreateTime   string // 操作时间
	UpdateUser   string // 更新人
	UpdateTime   string // 更新时间
	Mark         string // 有效标识
}

OperLogColumns defines and stores column names for table sys_oper_log.

type OperLogDao

type OperLogDao struct {
	gmvc.M
	DB      gdb.DB
	Table   string
	Columns OperLogColumns
}

func (*OperLogDao) All

func (d *OperLogDao) All(where ...interface{}) ([]*model.OperLog, error)

All does "SELECT FROM ..." statement for the model. It retrieves the records from table and returns the result as []*model.OperLog. It returns nil if there's no record retrieved with the given conditions from table.

The optional parameter <where> is the same as the parameter of M.Where function, see M.Where.

func (*OperLogDao) And

func (d *OperLogDao) And(where interface{}, args ...interface{}) *OperLogDao

And adds "AND" condition to the where statement.

func (*OperLogDao) Args

func (d *OperLogDao) Args(args ...interface{}) *OperLogDao

Args sets custom arguments for model operation.

func (*OperLogDao) As

func (d *OperLogDao) As(as string) *OperLogDao

As sets an alias name for current table.

func (*OperLogDao) Batch

func (d *OperLogDao) Batch(batch int) *OperLogDao

Batch sets the batch operation number for the model.

func (*OperLogDao) Cache

func (d *OperLogDao) Cache(duration time.Duration, name ...string) *OperLogDao

Cache sets the cache feature for the model. It caches the result of the sql, which means if there's another same sql request, it just reads and returns the result from cache, it but not committed and executed into the database.

If the parameter <duration> < 0, which means it clear the cache with given <name>. If the parameter <duration> = 0, which means it never expires. If the parameter <duration> > 0, which means it expires after <duration>.

The optional parameter <name> is used to bind a name to the cache, which means you can later control the cache like changing the <duration> or clearing the cache with specified <name>.

Note that, the cache feature is disabled if the model is operating on a transaction.

func (*OperLogDao) Chunk

func (d *OperLogDao) Chunk(limit int, callback func(entities []*model.OperLog, err error) bool)

Chunk iterates the table with given size and callback function.

func (*OperLogDao) Ctx

func (d *OperLogDao) Ctx(ctx context.Context) *OperLogDao

Ctx is a chaining function, which creates and returns a new DB that is a shallow copy of current DB object and with given context in it. Note that this returned DB object can be used only once, so do not assign it to a global or package variable for long using.

func (*OperLogDao) Data

func (d *OperLogDao) Data(data ...interface{}) *OperLogDao

Data sets the operation data for the model. The parameter <data> can be type of string/map/gmap/slice/struct/*struct, etc. Eg: Data("uid=10000") Data("uid", 10000) Data(g.Map{"uid": 10000, "name":"john"}) Data(g.Slice{g.Map{"uid": 10000, "name":"john"}, g.Map{"uid": 20000, "name":"smith"})

func (*OperLogDao) Fields

func (d *OperLogDao) Fields(fieldNamesOrMapStruct ...interface{}) *OperLogDao

Fields sets the operation fields of the model, multiple fields joined using char ','. The parameter <fieldNamesOrMapStruct> can be type of string/map/*map/struct/*struct.

func (*OperLogDao) FieldsEx

func (d *OperLogDao) FieldsEx(fieldNamesOrMapStruct ...interface{}) *OperLogDao

FieldsEx sets the excluded operation fields of the model, multiple fields joined using char ','. The parameter <fieldNamesOrMapStruct> can be type of string/map/*map/struct/*struct.

func (*OperLogDao) Filter

func (d *OperLogDao) Filter() *OperLogDao

Filter marks filtering the fields which does not exist in the fields of the operated table.

func (*OperLogDao) FindAll

func (d *OperLogDao) FindAll(where ...interface{}) ([]*model.OperLog, error)

FindAll retrieves and returns Result by by M.WherePri and M.All. Also see M.WherePri and M.All.

func (*OperLogDao) FindOne

func (d *OperLogDao) FindOne(where ...interface{}) (*model.OperLog, error)

FindOne retrieves and returns a single Record by M.WherePri and M.One. Also see M.WherePri and M.One.

func (*OperLogDao) Group

func (d *OperLogDao) Group(groupBy string) *OperLogDao

Group sets the "GROUP BY" statement for the model.

func (*OperLogDao) InnerJoin

func (d *OperLogDao) InnerJoin(table ...string) *OperLogDao

InnerJoin does "INNER JOIN ... ON ..." statement on the model. The parameter <table> can be joined table and its joined condition, and also with its alias name, like: Table("user").InnerJoin("user_detail", "user_detail.uid=user.uid") Table("user", "u").InnerJoin("user_detail", "ud", "ud.uid=u.uid")

func (*OperLogDao) LeftJoin

func (d *OperLogDao) LeftJoin(table ...string) *OperLogDao

LeftJoin does "LEFT JOIN ... ON ..." statement on the model. The parameter <table> can be joined table and its joined condition, and also with its alias name, like: Table("user").LeftJoin("user_detail", "user_detail.uid=user.uid") Table("user", "u").LeftJoin("user_detail", "ud", "ud.uid=u.uid")

func (*OperLogDao) Limit

func (d *OperLogDao) Limit(limit ...int) *OperLogDao

Limit sets the "LIMIT" statement for the model. The parameter <limit> can be either one or two number, if passed two number is passed, it then sets "LIMIT limit[0],limit[1]" statement for the model, or else it sets "LIMIT limit[0]" statement.

func (*OperLogDao) LockShared

func (d *OperLogDao) LockShared() *OperLogDao

LockShared sets the lock in share mode for current operation.

func (*OperLogDao) LockUpdate

func (d *OperLogDao) LockUpdate() *OperLogDao

LockUpdate sets the lock for update for current operation.

func (*OperLogDao) Master

func (d *OperLogDao) Master() *OperLogDao

Master marks the following operation on master node.

func (*OperLogDao) Offset

func (d *OperLogDao) Offset(offset int) *OperLogDao

Offset sets the "OFFSET" statement for the model. It only makes sense for some databases like SQLServer, PostgreSQL, etc.

func (*OperLogDao) OmitEmpty

func (d *OperLogDao) OmitEmpty() *OperLogDao

OmitEmpty sets OPTION_OMITEMPTY option for the model, which automatically filers the data and where attributes for empty values.

func (*OperLogDao) One

func (d *OperLogDao) One(where ...interface{}) (*model.OperLog, error)

One retrieves one record from table and returns the result as *model.OperLog. It returns nil if there's no record retrieved with the given conditions from table.

The optional parameter <where> is the same as the parameter of M.Where function, see M.Where.

func (*OperLogDao) Option

func (d *OperLogDao) Option(option int) *OperLogDao

Option sets the extra operation option for the model.

func (*OperLogDao) Or

func (d *OperLogDao) Or(where interface{}, args ...interface{}) *OperLogDao

Or adds "OR" condition to the where statement.

func (*OperLogDao) Order

func (d *OperLogDao) Order(orderBy ...string) *OperLogDao

Order sets the "ORDER BY" statement for the model.

func (*OperLogDao) Page

func (d *OperLogDao) Page(page, limit int) *OperLogDao

Page sets the paging number for the model. The parameter <page> is started from 1 for paging. Note that, it differs that the Limit function start from 0 for "LIMIT" statement.

func (*OperLogDao) RightJoin

func (d *OperLogDao) RightJoin(table ...string) *OperLogDao

RightJoin does "RIGHT JOIN ... ON ..." statement on the model. The parameter <table> can be joined table and its joined condition, and also with its alias name, like: Table("user").RightJoin("user_detail", "user_detail.uid=user.uid") Table("user", "u").RightJoin("user_detail", "ud", "ud.uid=u.uid")

func (*OperLogDao) Scan

func (d *OperLogDao) Scan(pointer interface{}, where ...interface{}) error

Scan automatically calls Struct or Structs function according to the type of parameter <pointer>. It calls function Struct if <pointer> is type of *struct/**struct. It calls function Structs if <pointer> is type of *[]struct/*[]*struct.

The optional parameter <where> is the same as the parameter of Model.Where function, see Model.Where.

Note that it returns sql.ErrNoRows if there's no record retrieved and given pointer is not empty or nil.

Eg: user := new(User) err := dao.User.Where("id", 1).Scan(user)

user := (*User)(nil) err := dao.User.Where("id", 1).Scan(&user)

users := ([]User)(nil) err := dao.User.Scan(&users)

users := ([]*User)(nil) err := dao.User.Scan(&users)

func (*OperLogDao) Slave

func (d *OperLogDao) Slave() *OperLogDao

Slave marks the following operation on slave node. Note that it makes sense only if there's any slave node configured.

func (*OperLogDao) Struct

func (d *OperLogDao) Struct(pointer interface{}, where ...interface{}) error

Struct retrieves one record from table and converts it into given struct. The parameter <pointer> should be type of *struct/**struct. If type **struct is given, it can create the struct internally during converting.

The optional parameter <where> is the same as the parameter of Model.Where function, see Model.Where.

Note that it returns sql.ErrNoRows if there's no record retrieved with the given conditions from table and <pointer> is not nil.

Eg: user := new(User) err := dao.User.Where("id", 1).Struct(user)

user := (*User)(nil) err := dao.User.Where("id", 1).Struct(&user)

func (*OperLogDao) Structs

func (d *OperLogDao) Structs(pointer interface{}, where ...interface{}) error

Structs retrieves records from table and converts them into given struct slice. The parameter <pointer> should be type of *[]struct/*[]*struct. It can create and fill the struct slice internally during converting.

The optional parameter <where> is the same as the parameter of Model.Where function, see Model.Where.

Note that it returns sql.ErrNoRows if there's no record retrieved with the given conditions from table and <pointer> is not empty.

Eg: users := ([]User)(nil) err := dao.User.Structs(&users)

users := ([]*User)(nil) err := dao.User.Structs(&users)

func (*OperLogDao) TX

func (d *OperLogDao) TX(tx *gdb.TX) *OperLogDao

TX sets the transaction for current operation.

func (*OperLogDao) Unscoped

func (d *OperLogDao) Unscoped() *OperLogDao

Unscoped enables/disables the soft deleting feature.

func (*OperLogDao) Where

func (d *OperLogDao) Where(where interface{}, args ...interface{}) *OperLogDao

Where sets the condition statement for the model. The parameter <where> can be type of string/map/gmap/slice/struct/*struct, etc. Note that, if it's called more than one times, multiple conditions will be joined into where statement using "AND". Eg: Where("uid=10000") Where("uid", 10000) Where("money>? AND name like ?", 99999, "vip_%") Where("uid", 1).Where("name", "john") Where("status IN (?)", g.Slice{1,2,3}) Where("age IN(?,?)", 18, 50) Where(User{ Id : 1, UserName : "john"})

func (*OperLogDao) WherePri

func (d *OperLogDao) WherePri(where interface{}, args ...interface{}) *OperLogDao

WherePri does the same logic as M.Where except that if the parameter <where> is a single condition like int/string/float/slice, it treats the condition as the primary key value. That is, if primary key is "id" and given <where> parameter as "123", the WherePri function treats the condition as "id=123", but M.Where treats the condition as string "123".

type PositionColumns

type PositionColumns struct {
}

PositionColumns defines and stores column names for table sys_position.

type PositionDao

type PositionDao struct {
	// contains filtered or unexported fields
}

PositionDao is the data access object for table sys_position.

func NewPositionDao

func NewPositionDao() *PositionDao

NewPositionDao creates and returns a new DAO object for table data access.

func (*PositionDao) Columns

func (dao *PositionDao) Columns() PositionColumns

Columns returns all column names of current dao.

func (*PositionDao) Ctx

func (dao *PositionDao) Ctx(ctx context.Context) *gdb.Model

Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.

func (*PositionDao) DB

func (dao *PositionDao) DB() gdb.DB

DB retrieves and returns the underlying raw database management object of current DAO.

func (*PositionDao) Group

func (dao *PositionDao) Group() string

Group returns the configuration group name of database of current dao.

func (*PositionDao) Table

func (dao *PositionDao) Table() string

Table returns the table name of current dao.

func (*PositionDao) Transaction

func (dao *PositionDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error)

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.

type RoleColumns

type RoleColumns struct {
}

RoleColumns defines and stores column names for table sys_role.

type RoleDao

type RoleDao struct {
	// contains filtered or unexported fields
}

RoleDao is the data access object for table sys_role.

func NewRoleDao

func NewRoleDao() *RoleDao

NewRoleDao creates and returns a new DAO object for table data access.

func (*RoleDao) Columns

func (dao *RoleDao) Columns() RoleColumns

Columns returns all column names of current dao.

func (*RoleDao) Ctx

func (dao *RoleDao) Ctx(ctx context.Context) *gdb.Model

Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.

func (*RoleDao) DB

func (dao *RoleDao) DB() gdb.DB

DB retrieves and returns the underlying raw database management object of current DAO.

func (*RoleDao) Group

func (dao *RoleDao) Group() string

Group returns the configuration group name of database of current dao.

func (*RoleDao) Table

func (dao *RoleDao) Table() string

Table returns the table name of current dao.

func (*RoleDao) Transaction

func (dao *RoleDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error)

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.

type RoleMenuColumns

type RoleMenuColumns struct {
}

RoleMenuColumns defines and stores column names for table sys_role_menu.

type RoleMenuDao

type RoleMenuDao struct {
	// contains filtered or unexported fields
}

RoleMenuDao is the data access object for table sys_role_menu.

func NewRoleMenuDao

func NewRoleMenuDao() *RoleMenuDao

NewRoleMenuDao creates and returns a new DAO object for table data access.

func (*RoleMenuDao) Columns

func (dao *RoleMenuDao) Columns() RoleMenuColumns

Columns returns all column names of current dao.

func (*RoleMenuDao) Ctx

func (dao *RoleMenuDao) Ctx(ctx context.Context) *gdb.Model

Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.

func (*RoleMenuDao) DB

func (dao *RoleMenuDao) DB() gdb.DB

DB retrieves and returns the underlying raw database management object of current DAO.

func (*RoleMenuDao) Group

func (dao *RoleMenuDao) Group() string

Group returns the configuration group name of database of current dao.

func (*RoleMenuDao) Table

func (dao *RoleMenuDao) Table() string

Table returns the table name of current dao.

func (*RoleMenuDao) Transaction

func (dao *RoleMenuDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error)

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.

type UserColumns

type UserColumns struct {
	Id           string // 主键ID
	Realname     string // 真实姓名
	Nickname     string // 昵称
	Gender       string // 性别:1男 2女 3保密
	Avatar       string // 头像
	Mobile       string // 手机号码
	Email        string // 邮箱地址
	Birthday     string // 出生日期
	DeptId       string // 部门ID
	LevelId      string // 职级ID
	PositionId   string // 岗位ID
	ProvinceCode string // 省份编号
	CityCode     string // 市区编号
	DistrictCode string // 区县编号
	Address      string // 详细地址
	CityName     string // 所属城市
	Username     string // 登录用户名
	Password     string // 登录密码
	Salt         string // 盐加密
	Intro        string // 个人简介
	Status       string // 状态:1正常 2禁用
	Note         string // 备注
	Sort         string // 排序号
	LoginNum     string // 登录次数
	LoginIp      string // 最近登录IP
	LoginTime    string // 最近登录时间
	CreateUser   string // 添加人
	CreateTime   string // 创建时间
	UpdateUser   string // 更新人
	UpdateTime   string // 更新时间
	Mark         string // 有效标识(1正常 0删除)
}

UserColumns defines and stores column names for table sys_user.

type UserDao

type UserDao struct {
	gmvc.M
	DB    gdb.DB
	Table string

	Columns UserColumns // columns contains all the column names of Table for convenient usage.
	// contains filtered or unexported fields
}

UserDao is the data access object for table sys_user.

func NewUserDao

func NewUserDao() *UserDao

NewUserDao creates and returns a new DAO object for table data access.

func (*UserDao) All

func (d *UserDao) All(where ...interface{}) ([]*model.User, error)

All does "SELECT FROM ..." statement for the model. It retrieves the records from table and returns the result as []*model.User. It returns nil if there's no record retrieved with the given conditions from table.

The optional parameter <where> is the same as the parameter of M.Where function, see M.Where.

func (*UserDao) And

func (d *UserDao) And(where interface{}, args ...interface{}) *UserDao

And adds "AND" condition to the where statement.

func (*UserDao) Args

func (d *UserDao) Args(args ...interface{}) *UserDao

Args sets custom arguments for model operation.

func (*UserDao) As

func (d *UserDao) As(as string) *UserDao

As sets an alias name for current table.

func (*UserDao) Batch

func (d *UserDao) Batch(batch int) *UserDao

Batch sets the batch operation number for the model.

func (*UserDao) Cache

func (d *UserDao) Cache(duration time.Duration, name ...string) *UserDao

Cache sets the cache feature for the model. It caches the result of the sql, which means if there's another same sql request, it just reads and returns the result from cache, it but not committed and executed into the database.

If the parameter <duration> < 0, which means it clear the cache with given <name>. If the parameter <duration> = 0, which means it never expires. If the parameter <duration> > 0, which means it expires after <duration>.

The optional parameter <name> is used to bind a name to the cache, which means you can later control the cache like changing the <duration> or clearing the cache with specified <name>.

Note that, the cache feature is disabled if the model is operating on a transaction.

func (*UserDao) Chunk

func (d *UserDao) Chunk(limit int, callback func(entities []*model.User, err error) bool)

Chunk iterates the table with given size and callback function.

func (*UserDao) Ctx

func (d *UserDao) Ctx(ctx context.Context) *UserDao

func (*UserDao) Ctxo

func (dao *UserDao) Ctxo(ctx context.Context) *gdb.Model

Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.

func (*UserDao) DBO

func (dao *UserDao) DBO() gdb.DB

DB retrieves and returns the underlying raw database management object of current DAO.

func (*UserDao) Data

func (d *UserDao) Data(data ...interface{}) *UserDao

Data sets the operation data for the model. The parameter <data> can be type of string/map/gmap/slice/struct/*struct, etc. Eg: Data("uid=10000") Data("uid", 10000) Data(g.Map{"uid": 10000, "name":"john"}) Data(g.Slice{g.Map{"uid": 10000, "name":"john"}, g.Map{"uid": 20000, "name":"smith"})

func (*UserDao) Fields

func (d *UserDao) Fields(fieldNamesOrMapStruct ...interface{}) *UserDao

Fields sets the operation fields of the model, multiple fields joined using char ','. The parameter <fieldNamesOrMapStruct> can be type of string/map/*map/struct/*struct.

func (*UserDao) FieldsEx

func (d *UserDao) FieldsEx(fieldNamesOrMapStruct ...interface{}) *UserDao

FieldsEx sets the excluded operation fields of the model, multiple fields joined using char ','. The parameter <fieldNamesOrMapStruct> can be type of string/map/*map/struct/*struct.

func (*UserDao) Filter

func (d *UserDao) Filter() *UserDao

Filter marks filtering the fields which does not exist in the fields of the operated table.

func (*UserDao) FindAll

func (d *UserDao) FindAll(where ...interface{}) ([]*model.User, error)

FindAll retrieves and returns Result by by M.WherePri and M.All. Also see M.WherePri and M.All.

func (*UserDao) FindOne

func (d *UserDao) FindOne(where ...interface{}) (*model.User, error)

FindOne retrieves and returns a single Record by M.WherePri and M.One. Also see M.WherePri and M.One.

func (*UserDao) Group

func (d *UserDao) Group(groupBy string) *UserDao

Group sets the "GROUP BY" statement for the model.

func (*UserDao) InnerJoin

func (d *UserDao) InnerJoin(table ...string) *UserDao

InnerJoin does "INNER JOIN ... ON ..." statement on the model. The parameter <table> can be joined table and its joined condition, and also with its alias name, like: Table("user").InnerJoin("user_detail", "user_detail.uid=user.uid") Table("user", "u").InnerJoin("user_detail", "ud", "ud.uid=u.uid")

func (*UserDao) LeftJoin

func (d *UserDao) LeftJoin(table ...string) *UserDao

func (*UserDao) Limit

func (d *UserDao) Limit(limit ...int) *UserDao

Limit sets the "LIMIT" statement for the model. The parameter <limit> can be either one or two number, if passed two number is passed, it then sets "LIMIT limit[0],limit[1]" statement for the model, or else it sets "LIMIT limit[0]" statement.

func (*UserDao) LockShared

func (d *UserDao) LockShared() *UserDao

LockShared sets the lock in share mode for current operation.

func (*UserDao) LockUpdate

func (d *UserDao) LockUpdate() *UserDao

LockUpdate sets the lock for update for current operation.

func (*UserDao) Master

func (d *UserDao) Master() *UserDao

Master marks the following operation on master node.

func (*UserDao) Offset

func (d *UserDao) Offset(offset int) *UserDao

Offset sets the "OFFSET" statement for the model. It only makes sense for some databases like SQLServer, PostgreSQL, etc.

func (*UserDao) OmitEmpty

func (d *UserDao) OmitEmpty() *UserDao

OmitEmpty sets OPTION_OMITEMPTY option for the model, which automatically filers the data and where attributes for empty values.

func (*UserDao) One

func (d *UserDao) One(where ...interface{}) (*model.User, error)

One retrieves one record from table and returns the result as *model.User. It returns nil if there's no record retrieved with the given conditions from table.

The optional parameter <where> is the same as the parameter of M.Where function, see M.Where.

func (*UserDao) Option

func (d *UserDao) Option(option int) *UserDao

Option sets the extra operation option for the model.

func (*UserDao) Or

func (d *UserDao) Or(where interface{}, args ...interface{}) *UserDao

Or adds "OR" condition to the where statement.

func (*UserDao) Order

func (d *UserDao) Order(orderBy ...string) *UserDao

Order sets the "ORDER BY" statement for the model.

func (*UserDao) Page

func (d *UserDao) Page(page, limit int) *UserDao

Page sets the paging number for the model. The parameter <page> is started from 1 for paging. Note that, it differs that the Limit function start from 0 for "LIMIT" statement.

func (*UserDao) RightJoin

func (d *UserDao) RightJoin(table ...string) *UserDao

RightJoin does "RIGHT JOIN ... ON ..." statement on the model. The parameter <table> can be joined table and its joined condition, and also with its alias name, like: Table("user").RightJoin("user_detail", "user_detail.uid=user.uid") Table("user", "u").RightJoin("user_detail", "ud", "ud.uid=u.uid")

func (*UserDao) Scan

func (d *UserDao) Scan(pointer interface{}, where ...interface{}) error

Scan automatically calls Struct or Structs function according to the type of parameter <pointer>. It calls function Struct if <pointer> is type of *struct/**struct. It calls function Structs if <pointer> is type of *[]struct/*[]*struct.

The optional parameter <where> is the same as the parameter of Model.Where function, see Model.Where.

Note that it returns sql.ErrNoRows if there's no record retrieved and given pointer is not empty or nil.

Eg: user := new(User) err := dao.User.Where("id", 1).Scan(user)

user := (*User)(nil) err := dao.User.Where("id", 1).Scan(&user)

users := ([]User)(nil) err := dao.User.Scan(&users)

users := ([]*User)(nil) err := dao.User.Scan(&users)

func (*UserDao) Slave

func (d *UserDao) Slave() *UserDao

Slave marks the following operation on slave node. Note that it makes sense only if there's any slave node configured.

func (*UserDao) Struct

func (d *UserDao) Struct(pointer interface{}, where ...interface{}) error

Struct retrieves one record from table and converts it into given struct. The parameter <pointer> should be type of *struct/**struct. If type **struct is given, it can create the struct internally during converting.

The optional parameter <where> is the same as the parameter of Model.Where function, see Model.Where.

Note that it returns sql.ErrNoRows if there's no record retrieved with the given conditions from table and <pointer> is not nil.

Eg: user := new(User) err := dao.User.Where("id", 1).Struct(user)

user := (*User)(nil) err := dao.User.Where("id", 1).Struct(&user)

func (*UserDao) Structs

func (d *UserDao) Structs(pointer interface{}, where ...interface{}) error

Structs retrieves records from table and converts them into given struct slice. The parameter <pointer> should be type of *[]struct/*[]*struct. It can create and fill the struct slice internally during converting.

The optional parameter <where> is the same as the parameter of Model.Where function, see Model.Where.

Note that it returns sql.ErrNoRows if there's no record retrieved with the given conditions from table and <pointer> is not empty.

Eg: users := ([]User)(nil) err := dao.User.Structs(&users)

users := ([]*User)(nil) err := dao.User.Structs(&users)

func (*UserDao) TX

func (d *UserDao) TX(tx *gdb.TX) *UserDao

TX sets the transaction for current operation.

func (*UserDao) Transaction

func (dao *UserDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error)

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 (*UserDao) Unscoped

func (d *UserDao) Unscoped() *UserDao

Unscoped enables/disables the soft deleting feature.

func (*UserDao) Where

func (d *UserDao) Where(where interface{}, args ...interface{}) *UserDao

Where sets the condition statement for the model. The parameter <where> can be type of string/map/gmap/slice/struct/*struct, etc. Note that, if it's called more than one times, multiple conditions will be joined into where statement using "AND". Eg: Where("uid=10000") Where("uid", 10000) Where("money>? AND name like ?", 99999, "vip_%") Where("uid", 1).Where("name", "john") Where("status IN (?)", g.Slice{1,2,3}) Where("age IN(?,?)", 18, 50) Where(User{ Id : 1, UserName : "john"})

func (*UserDao) WherePri

func (d *UserDao) WherePri(where interface{}, args ...interface{}) *UserDao

WherePri does the same logic as M.Where except that if the parameter <where> is a single condition like int/string/float/slice, it treats the condition as the primary key value. That is, if primary key is "id" and given <where> parameter as "123", the WherePri function treats the condition as "id=123", but M.Where treats the condition as string "123".

type UserRoleColumns

type UserRoleColumns struct {
}

UserRoleColumns defines and stores column names for table sys_user_role.

type UserRoleDao

type UserRoleDao struct {
	// contains filtered or unexported fields
}

UserRoleDao is the data access object for table sys_user_role.

func NewUserRoleDao

func NewUserRoleDao() *UserRoleDao

NewUserRoleDao creates and returns a new DAO object for table data access.

func (*UserRoleDao) Columns

func (dao *UserRoleDao) Columns() UserRoleColumns

Columns returns all column names of current dao.

func (*UserRoleDao) Ctx

func (dao *UserRoleDao) Ctx(ctx context.Context) *gdb.Model

Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.

func (*UserRoleDao) DB

func (dao *UserRoleDao) DB() gdb.DB

DB retrieves and returns the underlying raw database management object of current DAO.

func (*UserRoleDao) Group

func (dao *UserRoleDao) Group() string

Group returns the configuration group name of database of current dao.

func (*UserRoleDao) Table

func (dao *UserRoleDao) Table() string

Table returns the table name of current dao.

func (*UserRoleDao) Transaction

func (dao *UserRoleDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL