interfaces

package
v1.0.0-alpha.4 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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
	// Register 注册路由
	Register(group *ghttp.RouterGroup)
}

Plugin 插件模式接口化

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