irisapp

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCache

func GetCache() cache.ICache

获取全局唯一的cache, 默认返回memcache

func GetDb added in v0.2.2

func GetDb() *database.Db

获取全局唯一的settings

func GetLogger

func GetLogger() *logging.IRFLogger

func GetSettings

func GetSettings() *settings.Settings

获取全局唯一的settings

func NewIrisApp

func NewIrisApp(c *IrisAppConfig) *iris.Application

1. 创建 iris app 2. 设置日志级别 3. 设置 recover 中间件 4. 设置 logger 中间件 @params settingsName 配置文件名称

Types

type IrisAppConfig

type IrisAppConfig struct {
	// setting 名字, 默认值 settings.yaml
	SettingsName string
	// 默认值: notFound
	NotFoundHandler iris.Handler
	// 默认值: internalServerError
	InternalServerErrorHandler iris.Handler
	// 是否启用swagger, 默认值: false, swagger 无法做到完全与main函数分离,不在这里初始化
	// EnableSwagger bool
	// 启用cache, 选项: cache.CacheTypeMem, cache.CacheTypeRedis, 默认值: cache.CacheTypeMem
	CacheType string
	// 是否初始化数据库, 默认值: false
	EnableDb bool
	// Auth处理函数, 默认值: nil
	AuthFunc auth.AuthFunc
	// 启用jwt中间件
	EnableJwt bool
}

Jump to

Keyboard shortcuts

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