interfaces

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Codec

type Codec interface {
	Encoder
	Decoder
}

Codec 解编码器

type Decoder

type Decoder interface {
	Unmarshal(data []byte, v interface{}) error
}

Decoder 解码器

type Encoder

type Encoder interface {
	// Marshal returns the wire format of v.
	Marshal(v interface{}) ([]byte, error)
}

Encoder 编码器

type ItfAccreditController

type ItfAccreditController interface {
	AccreditInfo(ctx *gin.Context) //权限信息

	CheckAccreditHandler() gin.HandlerFunc //权限检查校验的handler
	Permissions() []*dto.PermissionItem
}

type ItfAdmin

type ItfAdmin interface {
	Search(search *dto.SearchAdminParams, pa *paginate.Pager) ([]*models.Admin, *paginate.Pager, error)
	Query(id int64) (*models.Admin, error)
	QueryByAccount(string) (*models.Admin, error)
	QueryPassword(id int64) (string, string, error)
	Add(*models.Admin) (int64, error)
	AddCheckAccount(*models.Admin) (int64, error)
	Update(id int64, admin *models.Admin) (int64, error)
	Delete(id int64) (int64, error)

	ResetStatus(id int64, status int) (int64, error)
	ResetPassword(id int64, password string, noRoot bool) (int64, error)
	UpdateProInfo(id int64, admin *models.Admin) (int64, error)

	LoginNote(id int64, info *dto.LoginInfoParam) (int64, error) //登录记录

	Use(db *gorm.DB) ItfAdmin //使用db

	ItfMigrate
	ItfGormDB
}

type ItfAdminLog

type ItfAdminLog interface {
	Search(search *dto.SearchAdminLogParams, p *paginate.Pager) ([]*models.AdminLog, *paginate.Pager, error)
	Add(log *models.AdminLog) (int64, error)

	Use(db *gorm.DB) ItfAdminLog

	ItfMigrate
	ItfGormDB
}

type ItfAdminLogController

type ItfAdminLogController interface {
	SearchAdminLog(ctx *gin.Context)

	LogHandler() gin.HandlerFunc //日志记录的handler
}

ItfAdminLogController 管理员日志管理

type ItfAdminManageController

type ItfAdminManageController interface {
	SearchAdmin(ctx *gin.Context)
	QueryAdmin(ctx *gin.Context)
	SaveAdmin(ctx *gin.Context)
	DisableAdmin(ctx *gin.Context)
	DeleteAdmin(ctx *gin.Context)
}

ItfAdminManageController 管理员管理

type ItfAdminService added in v1.0.1

type ItfAdminService interface {
	ValidatePassword(adminId int64, password string) (bool, error)          //验证密码是否正确
	AutoCreateAdmin(nickname string, account string, password string) error //自动创建超级管理员
}

type ItfApiServer

type ItfApiServer interface {
	Start() error
	Stop() error
}

type ItfApp

type ItfApp interface {
	Name() string //app名称

	//Start 开始
	//处理上视为非异步处理
	Start() error

	//Stop 停止,视为同步阻塞处理
	Stop() error
}

type ItfAuthController

type ItfAuthController interface {
	AuthLogin(ctx *gin.Context)  //登录
	AuthLogout(ctx *gin.Context) //登出

	AuthInfo(ctx *gin.Context)       //获取认证信息
	AuthFreshToken(ctx *gin.Context) //token刷新
}

ItfAuthController 通用授权模块

type ItfAuthService

type ItfAuthService interface {
	DoAuth(*dto.AccountLoginParams) (*dto.AuthInfo, error)
}

type ItfBaseDataController

type ItfBaseDataController interface {
	Regions(ctx *gin.Context)
}

ItfBaseDataController 基本数据

type ItfBlockContent

type ItfBlockContent interface {
	Search(search *dto.SearchBlockContentParams, pa *paginate.Pager) ([]*models.BlockContent, *paginate.Pager, error)
	Query(id int64) (*models.BlockContent, error)
	QueryByCode(code string) (*models.BlockContent, error)
	Add(code *models.BlockContent) (int64, error)
	Delete(id int64) (int64, error)

	Use(db *gorm.DB) ItfBlockContent //使用db

	ItfMigrate
	ItfGormDB
}

ItfBlockContent 块内容操作接口

type ItfCaptchaController

type ItfCaptchaController interface {
	GetCaptcha(ctx *gin.Context)
	VerifyCaptcha(ctx *gin.Context)

	VerifyHandler() gin.HandlerFunc //验证handler,用于中间件
}

ItfCaptchaController 图片验证码相关

type ItfDistributeLocker

type ItfDistributeLocker interface {
	Lock(key string, ttl int64) (bool, error) //加锁
	Release(key string) error                 //释放锁

	Delay(key string, ttl int64) error //延迟锁,对锁进行续期延长
	TTL(key string) (int64, error)     //锁剩余时间
}

ItfDistributeLocker 分布式锁接口

type ItfGinApiServer

type ItfGinApiServer interface {
	ItfApiServer

	InitRouterForGin(engine *gin.Engine)
}

type ItfGormDB

type ItfGormDB interface {
	DB() *gorm.DB
}

type ItfJwtParser

type ItfJwtParser interface {
	GetToken(data interface{}) (string, error)
	ParseToken(data interface{}, token string) error
}

type ItfMigrate

type ItfMigrate interface {
	Migrate() (int64, error)
}

type ItfOptimisticLock

type ItfOptimisticLock interface {
	Lock(name string) bool
	UnLock(name string) bool
}

ItfOptimisticLock 乐观锁实现

type ItfOrganize

type ItfOrganize interface {
	Search(search *dto.SearchOrganizeParams, pa *paginate.Pager) ([]*models.Organize, *paginate.Pager, error)
	Query(id int64) (*models.Organize, error)
	Add(org *models.Organize) (int64, error)
	Update(id int64, org *models.Organize) (int64, error)
	Delete(id int64) (int64, error)
	DeleteByPid(pid int64) (int64, error)
	ResetStatus(id int64, status int) (int64, error)

	SearchOrganizeExtras(orgId int64) ([]*models.OrganizeExtra, error)
	AddOrganizeExtra(*models.OrganizeExtra) (int64, error)
	ClearOrganizeExtra(orgId int64) (int64, error)

	Use(db *gorm.DB) ItfOrganize //使用db

	ItfMigrate
	ItfGormDB
}

ItfOrganize 组织相关

type ItfRbac

type ItfRbac interface {
	UserRoles(uid int64) ([]*models.RbacRole, error)
	UserPerms(uid int64) ([]*models.RbacPermission, error)
	UserPermIds(uid int64) ([]int64, error)

	//用户关联角色
	UserRoleIds(uid int64) ([]int64, error)
	UserRelateRoles(uid int64, roleIds []int64) error

	//角色相关
	SearchRoles(search *dto.SearchRbacRoleParams, pa *paginate.Pager) ([]*models.RbacRole, *paginate.Pager, error)
	Roles() ([]*models.RbacRole, error)
	QueryRole(id int64) (*models.RbacRole, error)
	AddRole(*models.RbacRole) (int64, error)
	UpdateRole(int64, *models.RbacRole) (int64, error)
	DeleteRole(id int64) error
	ResetRoleStatus(id int64, status int) (int64, error)

	//角色关联权限
	RolePermIds(roleId int64, moreRoles ...int64) ([]int64, error)
	RoleRelatePerms(roleId int64, permIds []int64) error

	//权限相关
	Perms() ([]*models.RbacPermission, error)
	QueryPerm(id int64) (*models.RbacPermission, error)
	AddPerm(*models.RbacPermission) (int64, error)
	BatchAddPerm(...*models.RbacPermission) (int64, error)
	UpdatePerm(int64, *models.RbacPermission) (int64, error)
	DeletePerm(id int64) error

	//simple相关
	SimplePerms() ([]*dto.RbacPermissionSimple, error)

	Use(db *gorm.DB) ItfRbac //使用db

	ItfMigrate
	ItfGormDB
}

type ItfRbacManageController

type ItfRbacManageController interface {
	//用户与角色绑定关系维护
	SearchUserRoles(ctx *gin.Context) //用户绑定roles列表搜索
	BindUserRoles(ctx *gin.Context)   //用户绑定roles操作

	//角色管理
	SearchRoles(ctx *gin.Context)
	SimpleRoles(ctx *gin.Context)
	QueryRole(ctx *gin.Context)
	SaveRole(ctx *gin.Context)
	DisableRole(ctx *gin.Context)
	DeleteRole(ctx *gin.Context)

	//角色和权限绑定关系维护
	SearchRolePermissions(ctx *gin.Context)
	SaveRolePermissions(ctx *gin.Context)

	//权限管理
	SearchPermissions(ctx *gin.Context)
	DeletePermission(ctx *gin.Context)
	SavePermission(ctx *gin.Context)
}

ItfRbacManageController RBAC管理

type ItfRbacRole

type ItfRbacRole interface {
	Search(search *dto.SearchRbacRoleParams, pa *paginate.Pager) ([]*models.RbacRole, *paginate.Pager, error)
	Query(id int64) (*models.RbacRole, error)
	Add(*models.RbacRole) (int64, error)
	Update(int64, *models.RbacRole) (int64, error)
	Delete(id int64) error
	ResetStatus(id int64, status int) (int64, error)

	Use(db *gorm.DB) ItfRbacRole //使用db

	ItfMigrate
	ItfGormDB
}

ItfRbacRole 角色相关

type ItfResponseController

type ItfResponseController interface {
	Response(ctx *gin.Context, data respdata.ResponseData, msgData ...map[string]string)
	ResponseCode(ctx *gin.Context, code int, data respdata.ResponseData, msgData ...map[string]string)
}

type ItfSetting

type ItfSetting interface {
	Set(key, value string) error
	Get(key string) (string, error)

	SetMulti(data map[string]string) error
	GetMulti(keys ...string) (map[string]string, error)

	Use(db *gorm.DB) ItfSetting

	ItfMigrate
	ItfGormDB
}

type ItfStatistical

type ItfStatistical interface {
	Search(search *dto.SearchStatisticalParams, pa *paginate.Pager) ([]*models.Statistical, *paginate.Pager, error)
	Query(search *dto.SearchStatisticalParams) (*models.Statistical, error)
	Add(st *models.Statistical) (int64, error)
	Delete(id int64) (int64, error)
	DeleteByName(name, date string) (int64, error)

	Use(db *gorm.DB) ItfStatistical //使用db

	ItfMigrate
	ItfGormDB
}

ItfStatistical 统计相关

type ItfSupportModule

type ItfSupportModule interface {
	WithModule(t bool)
}

ItfSupportModule 支持模块服务

type ItfUser

type ItfUser interface {
	Search(search *dto.SearchUserParams, pa *paginate.Pager) ([]*models.User, *paginate.Pager, error)
	Query(id int64) (*models.User, error)
	QueryByAccount(string) (*models.User, error)
	QueryByPhone(string) (*models.User, error)
	QueryByEmail(string) (*models.User, error)
	Add(*models.User) (int64, error)
	Update(id int64, user *models.User) (int64, error)
	Delete(id int64) (int64, error)

	LoginNote(id int64, info *dto.LoginInfoParam) (int64, error) //登录记录

	ResetStatus(id int64, status int) (int64, error)
	ResetPassword(id int64, password string) (int64, error)
	UpdateProInfo(id int64, user *models.User) (int64, error)

	Use(db *gorm.DB) ItfUser //使用db

	ItfMigrate
	ItfGormDB
}

type ItfUserAccount

type ItfUserAccount interface {
	QueryByAccount(string) (*models.UserAccount, error)
	Add(*models.UserAccount) (int64, error)
	Delete(id int64) (int64, error)

	Use(db *gorm.DB) ItfUserAccount //使用db

	ItfMigrate
	ItfGormDB
}

type ItfUserAuthController

type ItfUserAuthController interface {
	SignUp(ctx *gin.Context)       //注册
	AuthByWxCode(ctx *gin.Context) //微信登录
	AuthByQQ(ctx *gin.Context)     //QQ登录

	//debug用
	DebugAuthByThird(ctx *gin.Context)

	ItfAuthController
}

ItfUserAuthController 用户授权模块

type ItfUserCenterController

type ItfUserCenterController interface {
	ResetPassword(ctx *gin.Context)  //重置密码
	BindEmailPhone(ctx *gin.Context) //绑定邮箱
	LoginRecord(ctx *gin.Context)    //登录记录
	ModifyInfo(ctx *gin.Context)     //修改个人信息
	ModifyPassword(ctx *gin.Context) //修改密码
}

ItfUserCenterController 用户中心模块

type ItfUserGenericRecord

type ItfUserGenericRecord interface {
	Search(search *dto.SearchGenericRecordParams, pa *paginate.Pager) ([]*models.UserGenericRecord, *paginate.Pager, error)
	Add(code *models.UserGenericRecord) (int64, error)
	Delete(id int64) (int64, error)

	Use(db *gorm.DB) ItfUserGenericRecord //使用db

	ItfMigrate
	ItfGormDB
}

ItfUserGenericRecord 用户通用记录

type ItfUserLoginRecord

type ItfUserLoginRecord interface {
	Search(search *dto.SearchLoginRecordParams, pa *paginate.Pager) ([]*models.UserLoginRecord, *paginate.Pager, error)
	Add(code *models.UserLoginRecord) (int64, error)

	Use(db *gorm.DB) ItfUserLoginRecord //使用db

	ItfMigrate
	ItfGormDB
}

ItfUserLoginRecord 用户登录记录

type ItfUserManageController

type ItfUserManageController interface {
	SearchUser(ctx *gin.Context)
	QueryUser(ctx *gin.Context)
	SaveUser(ctx *gin.Context)
	DeleteUser(ctx *gin.Context)
	DisableUser(ctx *gin.Context)
	ResetUserPassword(ctx *gin.Context)
}

ItfUserManageController 用户管理

type ItfUserService

type ItfUserService interface {
	SignUp(*dto.UserRegisterParams) (int64, error)
}

type ItfUserThird

type ItfUserThird interface {
	Search(search *dto.SearchUserThirdParams, pa *paginate.Pager) ([]*models.UserThird, *paginate.Pager, error)
	Query(id int64) (*models.UserThird, error)
	QueryByThirdId(thirdType string, thirdId string) (*models.UserThird, error)
	QueryByThirdUnionId(thirdType string, unionId string) (*models.UserThird, error)
	Add(*models.UserThird) (int64, error)
	Delete(id int64) (int64, error)

	Use(db *gorm.DB) ItfUserThird //使用db

	ItfMigrate
	ItfGormDB
}

type ItfVerifyCode

type ItfVerifyCode interface {
	Query(id int64) (*models.VerifyCode, error)
	QueryByTarget(target string) (*models.VerifyCode, error)
	Verify(target string, code string) (bool, error)
	Add(code *models.VerifyCode) (int64, error)
	Delete(id int64) (int64, error)

	Use(db *gorm.DB) ItfVerifyCode //使用db

	ItfMigrate
	ItfGormDB
}

ItfVerifyCode 验证码相关db操作接口

type ItfVerifyCodeController

type ItfVerifyCodeController interface {
	SendCode(ctx *gin.Context)
	VerifyCode(ctx *gin.Context)

	VerifyHandler() gin.HandlerFunc //验证handler,用于中间件
}

ItfVerifyCodeController 发送验证码相关

type ItfWorker

type ItfWorker interface {
	Start() error
	Stop() error

	Run() error //运行一次
}

type PasswdBuilder

type PasswdBuilder interface {
	GenPassword(pass string) string
}

PasswdBuilder 密码生成

type PasswdChecker

type PasswdChecker interface {
	CheckPassword(pass string) (bool, string)
}

PasswdChecker 密码校验

Jump to

Keyboard shortcuts

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