interfaces

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrivateInit

func PrivateInit(group *ghttp.RouterGroup, plugins ...Plugin)

PrivateInit 私有路由组注册初始化

func PublicInit

func PublicInit(group *ghttp.RouterGroup, plugins ...Plugin)

PublicInit 公开路由注册初始化

Types

type Gorm

type Gorm interface {
	// GetSources 获取主库的 gorm.Dialector 切片对象
	GetSources() (directories []gorm.Dialector)
	// GetReplicas 获取从库库的 gorm.Dialector 切片对象
	GetReplicas() (directories []gorm.Dialector)
	// GetResolver 通过主库与从库的链接组装 gorm.Plugin
	GetResolver() gorm.Plugin
	// GetGormDialector 获取数据库的 gorm.Dialector
	GetGormDialector(dsn string) gorm.Dialector
	// GetConfigPath 设置配置文件路径
	GetConfigPath() string
}

type GormConfig

type GormConfig interface {
	IsEmpty() bool
	GetDsn() string
}

type GormConfigGeneral

type GormConfigGeneral interface {
	GetMaxIdleConnes() int
	GetMaxOpenConnes() int
	GetConnMaxLifetime() time.Duration
	GetConnMaxIdleTime() time.Duration
}

type Oss

type Oss interface {
	// DeleteByKey 通过 key(唯一标识) 删除在oss上的文件
	DeleteByKey(key string) error
	// UploadByFile 方便使用 os.File 数据上传oss
	UploadByFile(file multipart.File) (filepath string, filename string, err error)
	// UploadByFilepath 通过文件路径上传文件到oss
	UploadByFilepath(path string) (filepath string, filename string, err error)
	// UploadByFileHeader 方便从http框架接收到的 multipart.FileHeader 数据上传oss
	UploadByFileHeader(header *multipart.FileHeader) (filepath string, filename string, err error)
}

type Plugin

type Plugin interface {
	// RouterPath 用户返回注册路由
	RouterPath() string
	// PublicRouterGroup 公开路由组
	PublicRouterGroup(group *ghttp.RouterGroup) PublicRouter
	// PrivateRouterGroup 私有路由组注册
	PrivateRouterGroup(group *ghttp.RouterGroup) PrivateRouter
}

Plugin 插件模式接口化

type PrivateRouter

type PrivateRouter interface {
	// Private 私有路由组
	Private() PrivateRouter
	// PrivateWithoutRecord 私有路由组 不需要记录日志
	PrivateWithoutRecord() PrivateRouter
}

type PublicRouter

type PublicRouter interface {
	// Public 公有路由组
	Public() PublicRouter
	// PublicWithoutRecord 公有路由组 不需要记录日志
	PublicWithoutRecord() PublicRouter
}

type Router

type Router interface {
	// Public 公有路由组
	Public() Router
	// Private 私有路由组
	Private() Router
	// PublicWithoutRecord 公有路由组 不需要记录日志
	PublicWithoutRecord() Router
	// PrivateWithoutRecord 私有路由组 不需要记录日志
	PrivateWithoutRecord() Router
}
type Search interface {
	Search() func(db *gorm.DB) *gorm.DB
}

Jump to

Keyboard shortcuts

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