Documentation ¶
Index ¶
- Constants
- func InitClient(dbCfg *config.MySQLConfig) (err error)
- type AllByEtcdIdData
- type EtcdServersModel
- func (m *EtcdServersModel) All(name string, roleId int32) (list []*EtcdServersModel, err error)
- func (m *EtcdServersModel) Del(id int32) (err error)
- func (m *EtcdServersModel) FirstById(id int32) (one *EtcdServersModel, err error)
- func (m *EtcdServersModel) Insert() (err error)
- func (EtcdServersModel) TableName() string
- func (m *EtcdServersModel) Update() (err error)
- type JSONTime
- type RoleEtcdServersModel
- func (m *RoleEtcdServersModel) AllByEtcdId(etcdId int32) (list []*AllByEtcdIdData, err error)
- func (m *RoleEtcdServersModel) DelByEtcdId(etcdId int32) (err error)
- func (m *RoleEtcdServersModel) FirstByRoleIdAndEtcdServerIdAndType(roleId, etcdServerId, typ int32) (err error)
- func (m *RoleEtcdServersModel) Save() (err error)
- func (RoleEtcdServersModel) TableName() string
- func (m *RoleEtcdServersModel) UpByEtcdId(list []*AllByEtcdIdData) (err error)
- type RolesModel
- type UsersJoinRoleModel
- type UsersModel
- func (m *UsersModel) Del(id int32) (err error)
- func (m *UsersModel) FirstByUsernameAndPassword(username, password string) (err error)
- func (m *UsersModel) List(userId, roleId int32, name string, offset, limit int) (list []*UsersJoinRoleModel, err error)
- func (m *UsersModel) ListCount(userId, roleId int32, name string, offset, limit int) (_c int32, err error)
- func (m *UsersModel) Save(omit ...string) (err error)
- func (UsersModel) TableName() string
Constants ¶
View Source
const ( ReadOnly = iota ReadWrite )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AllByEtcdIdData ¶
type AllByEtcdIdData struct { EtcdServerId int32 `gorm:"column:etcd_server_id" json:"etcd_server_id"` // etcd服务id RoleId int32 `gorm:"column:role_id" json:"role_id"` // 角色id Name string `gorm:"column:name" json:"name"` Type int32 `gorm:"column:type" json:"type"` Read int32 `gorm:"column:read" json:"read"` Write int32 `gorm:"column:write" json:"write"` }
type EtcdServersModel ¶
type EtcdServersModel struct { ID int32 `json:"id" gorm:"column:id;primary_key"` Version string `json:"version" gorm:"column:version"` Name string `json:"name" gorm:"column:name"` Address string `json:"address" gorm:"column:address"` TlsEnable string `json:"tls_enable" gorm:"column:tls_enable"` CertFile string `json:"cert_file" gorm:"column:cert_file"` KeyFile string `json:"key_file" gorm:"column:key_file"` CaFile string `json:"ca_file" gorm:"column:ca_file"` Username string `json:"username" gorm:"column:username"` Password string `json:"password" gorm:"column:password"` Desc string `json:"desc" gorm:"column:desc"` CreatedAt JSONTime `gorm:"column:created_at" json:"created_at"` // 添加时间 UpdatedAt JSONTime `gorm:"column:updated_at" json:"updated_at"` // 更新时间 }
EtcdServersModel etcd 服务列表
func (*EtcdServersModel) All ¶
func (m *EtcdServersModel) All(name string, roleId int32) (list []*EtcdServersModel, err error)
All 获取全部
func (*EtcdServersModel) FirstById ¶
func (m *EtcdServersModel) FirstById(id int32) (one *EtcdServersModel, err error)
FirstById 根据id查询一个etcd服务
type RoleEtcdServersModel ¶
type RoleEtcdServersModel struct { Id int32 `gorm:"column:id;primary_key" json:"id"` // EtcdServerId int32 `gorm:"column:etcd_server_id" json:"etcd_server_id"` // etcd服务id Type int32 `gorm:"column:type" json:"type"` // 0读 1写 RoleId int32 `gorm:"column:role_id" json:"role_id"` // 角色id CreatedAt JSONTime `gorm:"column:created_at" json:"created_at"` // 添加时间 UpdatedAt JSONTime `gorm:"column:updated_at" json:"updated_at"` // 更新时间 }
RoleEtcdServersModel 角色权限表
func (*RoleEtcdServersModel) AllByEtcdId ¶
func (m *RoleEtcdServersModel) AllByEtcdId(etcdId int32) (list []*AllByEtcdIdData, err error)
AllByEtcdId 查询etcd服务权限配置列表
func (*RoleEtcdServersModel) DelByEtcdId ¶
func (m *RoleEtcdServersModel) DelByEtcdId(etcdId int32) (err error)
DelByEtcdId 删除
func (*RoleEtcdServersModel) FirstByRoleIdAndEtcdServerIdAndType ¶
func (m *RoleEtcdServersModel) FirstByRoleIdAndEtcdServerIdAndType(roleId, etcdServerId, typ int32) (err error)
FirstByRoleIdAndEtcdServerIdAndType 根据role_id、etcd_server_id和type查询一条数据
func (RoleEtcdServersModel) TableName ¶
func (RoleEtcdServersModel) TableName() string
TableName 获取表名
func (*RoleEtcdServersModel) UpByEtcdId ¶
func (m *RoleEtcdServersModel) UpByEtcdId(list []*AllByEtcdIdData) (err error)
UpByEtcdId 根据etcd_id更新角色
type RolesModel ¶
type RolesModel struct { Id int32 `gorm:"column:id;primary_key" json:"id"` // Name string `gorm:"column:name" json:"name"` // 角色名 CreatedAt JSONTime `gorm:"column:created_at" json:"created_at"` // 添加时间 UpdatedAt JSONTime `gorm:"column:updated_at" json:"updated_at"` // 更新时间 }
RolesModel 角色表
type UsersJoinRoleModel ¶
type UsersJoinRoleModel struct { RoleName string `gorm:"column:role_name" json:"role_name"` UsersModel }
UsersJoinRoleModel 用户列表带角色名
type UsersModel ¶
type UsersModel struct { Id int32 `gorm:"column:id;primary_key" json:"id"` // Username string `gorm:"column:username" json:"username"` // 用户名 Password string `gorm:"column:password" json:"password"` // 密码 Email string `gorm:"column:email" json:"email"` // 邮箱 RoleId int32 `gorm:"column:role_id" json:"role_id"` // 角色id CreatedAt JSONTime `gorm:"column:created_at" json:"created_at"` // 添加时间 UpdatedAt JSONTime `gorm:"column:updated_at" json:"updated_at"` // 更新时间 Token string `gorm:"-" json:"token"` // 登录token }
UsersModel 用户表
func (*UsersModel) FirstByUsernameAndPassword ¶
func (m *UsersModel) FirstByUsernameAndPassword(username, password string) (err error)
FirstByUsernameAndPassword 根据用户名密码查询数据
func (*UsersModel) List ¶
func (m *UsersModel) List(userId, roleId int32, name string, offset, limit int) (list []*UsersJoinRoleModel, err error)
List 分页列表
Click to show internal directories.
Click to hide internal directories.