service

package
v2.0.25 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2021 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	B  = 1
	KB = 1024 * B
	MB = 1024 * KB
	GB = 1024 * MB
)
View Source
const (
	SMS = "sendsms:%s"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiMonitor

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

func NewApiMonitor

func NewApiMonitor() *ApiMonitor

func (*ApiMonitor) Create

func (s *ApiMonitor) Create(ctx context.Context, item model.ApiMonitor) error

Create 创建数据

func (*ApiMonitor) Get

func (s *ApiMonitor) Get(ctx context.Context, id int) (*model.ApiMonitor, error)

Get 根据id查询指定数据

func (*ApiMonitor) Query

func (s *ApiMonitor) Query(ctx context.Context) ([]model.ApiMonitor, error)

Query 查询所有数据

type Column

type Column struct {
	ColumnModel *model.Columns
}

Column 列服务

func NewColumn

func NewColumn() *Column

NewColumn DBColumn实例

func (*Column) Create

func (s *Column) Create(ctx context.Context, item model.Columns) error

Create 创建数据

func (*Column) Get

func (s *Column) Get(ctx context.Context, id int) (*model.Columns, error)

Get 查询指定数据

func (*Column) Query

func (s *Column) Query(ctx context.Context, id int) ([]model.Columns, error)

Query 查询列信息

func (*Column) Update

func (s *Column) Update(ctx context.Context, item model.Columns) error

Update 更新数据

type Config

type Config struct {
	ConfigModel *model.Config
}

Config 系统配置服务

func NewConfig

func NewConfig() *Config

NewConfig Config实例

func (*Config) BatchDelete

func (s *Config) BatchDelete(ctx context.Context, id string) error

BatchDelete 批量删除

func (*Config) Create

func (s *Config) Create(ctx context.Context, item model.Config) error

Create 创建数据

func (*Config) Delete

func (s *Config) Delete(ctx context.Context, id int) error

Delete 删除数据

func (*Config) Get

func (s *Config) Get(ctx context.Context, id int) (*model.Config, error)

Get 查询指定数据

func (*Config) GetWithKey

func (s *Config) GetWithKey(ctx context.Context, key string) (*model.Config, error)

GetWithKey 查询指定数据

func (*Config) Query

func (s *Config) Query(ctx context.Context, params param.ConfigParam) (*pagination.Result, error)

Query 查询数据

func (*Config) Update

func (s *Config) Update(ctx context.Context, item model.Config) error

Update 更新数据

type DBColumn

type DBColumn struct {
	DBColumnsModel *model.DBColumns
}

DBColumn 数据库列服务

func NewDBColumn

func NewDBColumn() *DBColumn

NewDBColumn DBColumn实例

func (*DBColumn) Query

func (s *DBColumn) Query(ctx context.Context, params param.DBColumnsParam) (*pagination.Result, error)

Query 查询数据

type DBTable

type DBTable struct {
	DBTableModel *model.DBTables
}

DBTable 数据库列服务

func NewDBTable

func NewDBTable() *DBTable

NewDBTable DBTable实例

func (*DBTable) Query

func (s *DBTable) Query(ctx context.Context, params param.DBTablesParam) (*pagination.Result, error)

Query 查询数据

type Dept

type Dept struct {
	DeptModel *model.Dept
	UserModel *model.User
}

Dept 部门服务

func NewDept

func NewDept() *Dept

NewDept Dept实例

func (*Dept) Create

func (s *Dept) Create(ctx context.Context, item model.Dept) error

Create 创建数据

func (*Dept) Delete

func (s *Dept) Delete(ctx context.Context, id int) error

Delete 删除数据

func (*Dept) Get

func (s *Dept) Get(ctx context.Context, id int) (*model.Dept, error)

Get 查询指定数据

func (*Dept) GetTreeDept

func (s *Dept) GetTreeDept(ctx context.Context) ([]model.DeptLabel, error)

GetTreeDept 部门树

func (*Dept) Query

func (s *Dept) Query(ctx context.Context, dataScope string, params param.DeptParam) ([]model.Dept, error)

Query 查询数据

func (*Dept) Update

func (s *Dept) Update(ctx context.Context, item model.Dept) error

Update 更新数据

type DictData

type DictData struct {
	DictDataModel *model.DictData
}

DictData 数据字典服务

func NewDictData

func NewDictData() *DictData

NewDictData DictData实例

func (*DictData) BatchDelete

func (s *DictData) BatchDelete(ctx context.Context, dictCodes string) error

BatchDelete 批量删除

func (*DictData) Create

func (s *DictData) Create(ctx context.Context, item model.DictData) error

Create 创建数据

func (*DictData) Delete

func (s *DictData) Delete(ctx context.Context, dictCode int) error

Delete 删除数据

func (*DictData) Get

func (s *DictData) Get(ctx context.Context, id int, dictType string) (*model.DictData, error)

Get 查询指定数据

func (*DictData) Query

func (s *DictData) Query(ctx context.Context, params param.DictDataParam) (*pagination.Result, error)

Query 查询数据

func (*DictData) Update

func (s *DictData) Update(ctx context.Context, item model.DictData) error

Update 更新数据

type DictType

type DictType struct {
	DictTypeModel *model.DictType
}

DictType 数据字典类型服务

func NewDictType

func NewDictType() *DictType

NewDictType DictType实例

func (*DictType) BatchDelete

func (s *DictType) BatchDelete(ctx context.Context, dictIDs string) error

BatchDelete 批量删除

func (*DictType) Create

func (s *DictType) Create(ctx context.Context, item model.DictType) error

Create 创建数据

func (*DictType) Delete

func (s *DictType) Delete(ctx context.Context, dictCode int) error

Delete 删除数据

func (*DictType) Get

func (s *DictType) Get(ctx context.Context, dictID int) (*model.DictType, error)

Get 查询指定数据

func (*DictType) Query

func (s *DictType) Query(ctx context.Context, params param.DictTypeParam) (*pagination.Result, error)

Query 查询数据

func (*DictType) Update

func (s *DictType) Update(ctx context.Context, item model.DictType) error

Update 更新数据

type FileDir

type FileDir struct {
	FileDirModel *model.FileDir
}

FileDir 文件夹服务

func NewFileDir

func NewFileDir() *FileDir

NewFileDir FileDir实例

func (*FileDir) BatchDelete

func (s *FileDir) BatchDelete(ctx context.Context, id string) error

BatchDelete 批量删除

func (*FileDir) Create

func (s *FileDir) Create(ctx context.Context, item model.FileDir) error

Create 创建数据

func (*FileDir) Delete

func (s *FileDir) Delete(ctx context.Context, id int) error

Delete 删除数据

func (*FileDir) Get

func (s *FileDir) Get(ctx context.Context, id int) (*model.FileDir, error)

Get 查询指定数据

func (*FileDir) Query

func (s *FileDir) Query(ctx context.Context, params param.FileDirParam) ([]model.FileDir, error)

Query 查询数据

func (*FileDir) Update

func (s *FileDir) Update(ctx context.Context, item model.FileDir) error

Update 更新数据

type FileInfo

type FileInfo struct {
	FileInfoModel *model.FileInfo
}

FileInfo 文件信息服务

func NewFileInfo

func NewFileInfo() *FileInfo

NewFileInfo FileInfo实例

func (*FileInfo) BatchDelete

func (s *FileInfo) BatchDelete(ctx context.Context, id string) error

BatchDelete 批量删除

func (*FileInfo) Create

func (s *FileInfo) Create(ctx context.Context, item model.FileInfo) error

Create 创建数据

func (*FileInfo) Delete

func (s *FileInfo) Delete(ctx context.Context, id int) error

Delete 删除数据

func (*FileInfo) Get

func (s *FileInfo) Get(ctx context.Context, id int) (*model.FileInfo, error)

Get 查询指定数据

func (*FileInfo) Query

func (s *FileInfo) Query(ctx context.Context, params param.FileInfoParam) (*pagination.Result, error)

Query 查询数据

func (*FileInfo) Update

func (s *FileInfo) Update(ctx context.Context, item model.FileInfo) error

Update 更新数据

type Generate

type Generate struct {
	TablesModel *model.Tables
	ColumnModel *model.Columns
	MenuModel   *model.Menu
}

Generate 代码生成结构体

func NewGenerate

func NewGenerate() *Generate

NewGenerate 新建代码生成

func (*Generate) Code

func (s *Generate) Code(ctx context.Context, id int) error

Code 生成代码

func (*Generate) Config

func (s *Generate) Config(ctx context.Context, id int) error

Config 生成数据库信息

func (*Generate) Preview

func (s *Generate) Preview(ctx context.Context, id int) (interface{}, error)

Preview 生成预览

type LoginLog

type LoginLog struct {
	LoginLogModel *model.LoginLog
}

LoginLog 数据字典服务

func NewLoginLog

func NewLoginLog() *LoginLog

NewLoginLog LoginLog实例

func (*LoginLog) BatchDelete

func (s *LoginLog) BatchDelete(ctx context.Context, dictCodes string) error

BatchDelete 批量删除

func (*LoginLog) Create

func (s *LoginLog) Create(ctx context.Context, item model.LoginLog) error

Create 创建数据

func (*LoginLog) Delete

func (s *LoginLog) Delete(ctx context.Context, dictCode int) error

Delete 删除数据

func (*LoginLog) Get

func (s *LoginLog) Get(ctx context.Context, id int) (*model.LoginLog, error)

Get 查询指定数据

func (*LoginLog) Query

func (s *LoginLog) Query(ctx context.Context, params param.LoginLogParam) (*pagination.Result, error)

Query 查询数据

func (*LoginLog) Record

func (s *LoginLog) Record(ctx context.Context, username, userAgent, clientIP, status, msg string) error

Record 记录登录登出记录

func (*LoginLog) Update

func (s *LoginLog) Update(ctx context.Context, item model.LoginLog) error

Update 更新数据

type Menu struct {
	MenuModel               *model.Menu
	UserRoleModel           *model.UserRole
	RoleMenuModel           *model.RoleMenu
	MenuAccessModel         *model.MenuAccess
	MenuAccessResourceModel *model.MenuAccessResource
}

Menu 数据字典服务

func NewMenu

func NewMenu() *Menu

NewMenu Menu实例

func (s *Menu) Create(ctx context.Context, item param.Menu) error

Create 创建数据

func (s *Menu) Delete(ctx context.Context, id int) error

Delete 删除数据

func (s *Menu) Get(ctx context.Context, id int) (*param.Menu, error)

Get 查询指定数据

func (s *Menu) GetMenusTree(ctx context.Context, userID int) (interface{}, error)

GetMenusTree 用户菜单树

func (s *Menu) GetResourcesTree(ctx context.Context) (param.MenuAccessResourceTrees, error)

GetResourcesTree 用户菜单树

func (s *Menu) Query(ctx context.Context, params param.MenuParam) (interface{}, error)

Query 树状菜单

func (s *Menu) QueryAccess(ctx context.Context, menuID int) ([]int, error)

QueryAccess 查询权限

func (s *Menu) Update(ctx context.Context, id int, item param.Menu) error

Update 更新数据

type Monitor

type Monitor struct{}

Monitor 监控信息

func NewMonitor

func NewMonitor() *Monitor

NewMonitor 监控实例

func (*Monitor) CPU

func (s *Monitor) CPU() *param.CPUParam

CPU cpu信息

func (*Monitor) Disk

func (s *Monitor) Disk() *param.DiskParam

Disk 硬盘信息

func (*Monitor) Mem

func (s *Monitor) Mem() *param.MemParam

Mem 内存信息

func (*Monitor) OS

func (s *Monitor) OS() *param.OSParam

OS 系统信息

type OperLog

type OperLog struct {
	OperLogModel *model.OperLog
}

OperLog 数据字典服务

func NewOperLog

func NewOperLog() *OperLog

NewOperLog OperLog实例

func (*OperLog) BatchDelete

func (s *OperLog) BatchDelete(ctx context.Context, id string) error

BatchDelete 批量删除

func (*OperLog) Create

func (s *OperLog) Create(ctx context.Context, item model.OperLog) error

Create 创建数据

func (*OperLog) Delete

func (s *OperLog) Delete(ctx context.Context, id int) error

Delete 删除数据

func (*OperLog) Get

func (s *OperLog) Get(ctx context.Context, id int) (*model.OperLog, error)

Get 查询指定数据

func (*OperLog) Query

func (s *OperLog) Query(ctx context.Context, params param.OperLogParam) (*pagination.Result, error)

Query 查询数据

func (*OperLog) Update

func (s *OperLog) Update(ctx context.Context, item model.OperLog) error

Update 更新数据

type Post

type Post struct {
	PostModel *model.Post
}

Post 职务服务

func NewPost

func NewPost() *Post

NewPost Post实例

func (*Post) All

func (s *Post) All(ctx context.Context) (interface{}, error)

All 全部岗位

func (*Post) BatchDelete

func (s *Post) BatchDelete(ctx context.Context, id string) error

BatchDelete 批量删除

func (*Post) Create

func (s *Post) Create(ctx context.Context, item model.Post) error

Create 创建数据

func (*Post) Delete

func (s *Post) Delete(ctx context.Context, id int) error

Delete 删除数据

func (*Post) Get

func (s *Post) Get(ctx context.Context, id int) (*model.Post, error)

Get 查询指定数据

func (*Post) Query

func (s *Post) Query(ctx context.Context, dataScope string, params param.PostParam) (*pagination.Result, error)

Query 查询数据

func (*Post) Update

func (s *Post) Update(ctx context.Context, item model.Post) error

Update 更新数据

type Role

type Role struct {
	RoleModel      *model.Role
	UserRoleModel  *model.UserRole
	RoleMenuModel  *model.RoleMenu
	RoleDeptModel  *model.RoleDept
	CasbinEnforcer *casbin.SyncedEnforcer //casbin权限校验
}

Role 角色服务

func NewRole

func NewRole(e *casbin.SyncedEnforcer) *Role

NewRole Role服务实例

func (*Role) Create

func (s *Role) Create(ctx context.Context, item param.Role) error

Create 创建数据

func (*Role) Delete

func (s *Role) Delete(ctx context.Context, id int) error

Delete 删除数据

func (*Role) Get

func (s *Role) Get(ctx context.Context, roleID int) (*param.Role, error)

Get 查询指定数据

func (*Role) GetWithDept

func (s *Role) GetWithDept(ctx context.Context, roleID int) ([]int, error)

GetWithDept 查询角色部门ID

func (*Role) Query

func (s *Role) Query(ctx context.Context, params param.RoleParam) (*pagination.Result, error)

Query 查询数据

func (*Role) Update

func (s *Role) Update(ctx context.Context, id int, item param.Role) error

Update 更新数据

func (*Role) UpdateDataScope

func (s *Role) UpdateDataScope(ctx context.Context, item model.Role) error

UpdateDataScope 更新数据

type Setting

type Setting struct {
	SettingModel *model.Setting
}

Setting 设置服务

func NewSetting

func NewSetting() *Setting

NewSetting Setting实例

func (*Setting) Create

func (s *Setting) Create(ctx context.Context, item model.Setting) error

Create 创建数据

func (*Setting) Get

func (s *Setting) Get(ctx context.Context) (*model.Setting, error)

Get 查询指定数据

func (*Setting) Update

func (s *Setting) Update(ctx context.Context, params param.SettingParam, host string) error

Update 更新数据

type Sms added in v2.0.14

type Sms struct {
	UserModel *model.User
}

Sms 短信服务

func NewSms added in v2.0.14

func NewSms() *Sms

func (*Sms) Send added in v2.0.14

func (s *Sms) Send(ctx context.Context, params param.SmsParam) error

Send 发送短信

type Tables

type Tables struct {
	TablesModel     *model.Tables
	DBColumnModel   *model.DBColumns
	DBTableModel    *model.DBTables
	ColumnModel     *model.Columns
	TableIndexModel *model.TableIndex
}

Tables 数据字典服务

func NewTables

func NewTables() *Tables

NewTables Tables实例

func (*Tables) BatchDelete

func (s *Tables) BatchDelete(ctx context.Context, id string) error

BatchDelete 批量删除

func (*Tables) Create

func (s *Tables) Create(ctx context.Context, item model.Tables) error

Create 创建数据

func (*Tables) Delete

func (s *Tables) Delete(ctx context.Context, id int) error

Delete 删除数据

func (*Tables) GenTable

func (s *Tables) GenTable(ctx context.Context, tableName string) (*model.Tables, error)

GenTable 生成初始化表

func (*Tables) Get

func (s *Tables) Get(ctx context.Context, id int, name string) (*model.Tables, error)

Get 查询指定数据

func (*Tables) Query

func (s *Tables) Query(ctx context.Context, params param.TablesParam) (*pagination.Result, error)

Query 查询数据

func (*Tables) Tree

func (s *Tables) Tree(ctx context.Context, params param.TablesParam) ([]*model.Tables, error)

Tree 树形

func (*Tables) Update

func (s *Tables) Update(ctx context.Context, item model.Tables) error

Update 更新数据

type User

type User struct {
	UserModel     *model.User
	UserRoleModel *model.UserRole
	RoleModel     *model.Role
}

User 用户服务

func NewUser

func NewUser() *User

NewUser User实例

func (*User) BatchDelete

func (s *User) BatchDelete(ctx context.Context, id string) error

BatchDelete 批量删除

func (*User) Create

func (s *User) Create(ctx context.Context, item param.User) (string, string, error)

Create 创建数据

func (*User) Delete

func (s *User) Delete(ctx context.Context, id int) error

Delete 删除数据

func (*User) Get

func (s *User) Get(ctx context.Context, userID int) (*param.User, error)

Get 查询指定数据

func (*User) GetUserInfo

func (s *User) GetUserInfo(ctx context.Context, userID int) (*param.UserLoginInfo, error)

GetUserInfo 获取用户信息

func (*User) Login

func (s *User) Login(ctx context.Context, params param.LoginParam) (*model.User, error)

Login 用户登录

func (*User) Query

func (s *User) Query(ctx context.Context, dataScope string, params param.UserParam) (*pagination.Result, error)

Query 查询数据

func (*User) ResetPassword added in v2.0.14

func (s *User) ResetPassword(ctx context.Context, id int) (string, error)

UpdatePassword 修改密码

func (*User) Update

func (s *User) Update(ctx context.Context, item param.User) error

Update 更新数据

Jump to

Keyboard shortcuts

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