runtime

package
v1.3.0-rc.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Application

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

func NewConfig

func NewConfig() *Application

NewConfig 默认值

func (*Application) GetCasbinKey

func (c *Application) GetCasbinKey(key string) *casbin.SyncedEnforcer

GetCasbinKey 根据key获取casbin

func (*Application) GetCrontab

func (c *Application) GetCrontab() map[string]*cron.Cron

GetCrontab 获取所有map里的crontab数据

func (*Application) GetCrontabKey

func (c *Application) GetCrontabKey(key string) *cron.Cron

GetCrontabKey 根据key获取crontab

func (*Application) GetDb

func (c *Application) GetDb() map[string]*gorm.DB

GetDb 获取所有map里的db数据

func (*Application) GetDbByKey

func (c *Application) GetDbByKey(key string) *gorm.DB

GetDbByKey 根据key获取db

func (*Application) GetEngine

func (c *Application) GetEngine() http.Handler

GetEngine 获取路由引擎

func (*Application) GetLogger

func (c *Application) GetLogger() logger.Logger

GetLogger 获取日志组件

func (*Application) SetCasbin

func (c *Application) SetCasbin(key string, enforcer *casbin.SyncedEnforcer)

func (*Application) SetCrontab

func (c *Application) SetCrontab(key string, crontab *cron.Cron)

SetCrontab 设置对应key的crontab

func (*Application) SetDb

func (c *Application) SetDb(key string, db *gorm.DB)

SetDb 设置对应key的db

func (*Application) SetEngine

func (c *Application) SetEngine(engine http.Handler)

SetEngine 设置路由引擎

func (*Application) SetLogger

func (c *Application) SetLogger(l logger.Logger)

SetLogger 设置日志组件

type Runtime

type Runtime interface {
	//多db设置,⚠️SetDbs不允许并发,可以根据自己的业务,例如app分库、host分库
	SetDb(key string, db *gorm.DB)
	GetDb() map[string]*gorm.DB
	GetDbByKey(key string) *gorm.DB

	SetCasbin(key string, enforcer *casbin.SyncedEnforcer)
	GetCasbinKey(key string) *casbin.SyncedEnforcer

	//使用的路由
	SetEngine(engine http.Handler)
	GetEngine() http.Handler

	//使用go-admin定义的logger,参考来源go-micro
	SetLogger(logger logger.Logger)
	GetLogger() logger.Logger

	//crontab
	SetCrontab(key string, crontab *cron.Cron)
	GetCrontab() map[string]*cron.Cron
	GetCrontabKey(key string) *cron.Cron
}

Jump to

Keyboard shortcuts

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