example_application

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KEY_PREFIX            = "__key_"
	KEY_MONGODB           = KEY_PREFIX + "mongodb"
	KEY_MONGODB_LOG       = KEY_PREFIX + "mongodblog"
	KEY_MYSQL             = KEY_PREFIX + "mysql"
	KEY_MYSQL_TEST        = KEY_PREFIX + "mysqltest"
	KEY_REDIS             = KEY_PREFIX + "redis"
	KEY_REDIS_MQ          = KEY_PREFIX + "redismq"
	KEY_EXCEPTIONS        = KEY_PREFIX + "exceptions"
	KEY_VALIDATE_TAGS     = KEY_PREFIX + "validatetags"
	KEY_ID_WRAP           = KEY_PREFIX + "IDWarp"
	KEY_JSON_SONIC_ESCAPE = KEY_PREFIX + "jsonsonicescape"
	KEY_JSON_SONIC_FAST   = KEY_PREFIX + "jsonsonicfast"
	KEY_TASK_SERVER       = KEY_PREFIX + "taskworkerserver"
	KEY_TASK_CLIENT       = KEY_PREFIX + "taskclientdispatcher"
	KEY_LOCAL_CACHE       = KEY_PREFIX + "localcache"
	KEY_REMOTE_CACHE      = KEY_PREFIX + "remotecache"
	KEY_LEVEL2_CACHE      = KEY_PREFIX + "level2cache"
)

Variables

This section is empty.

Functions

func NewApplication

func NewApplication(ctx frame.ContextFramer) frame.ApplicationRegister

NewApplication new项目应用

Types

type Application

type Application struct {
	Ctx frame.ContextFramer

	KeyMongoLog  string
	KeyRedisTest string
	// contains filtered or unexported fields
}

Application 实现Global全局接口

func (*Application) ConfigCustomValidateInitializers

func (app *Application) ConfigCustomValidateInitializers() []validate.ValidateInitializer

ConfigCustomValidateInitializers 配置并返回自定义更多的语言验证器初始化器

func (*Application) ConfigGlobalInitializers

func (app *Application) ConfigGlobalInitializers() globalmanager.InitializerMap

ConfigGlobalInitializers 配置全局对象初始化器

func (*Application) ConfigRequiredGlobalKeys

func (app *Application) ConfigRequiredGlobalKeys() []globalmanager.KeyName

ConfigRequiredGlobalKeys 配置并返回全局管理容器中在启动时必须初始化的key

func (*Application) ConfigValidatorCustomTags

func (app *Application) ConfigValidatorCustomTags() []validate.RegisterValidatorTagFunc

ConfigValidatorCustomTags 配置并返回验证器自定义tag函数

func (*Application) GetCacheKey

func (app *Application) GetCacheKey() string

func (*Application) GetContext

func (app *Application) GetContext() frame.ContextFramer

GetContext 获取应用上下文

func (*Application) GetCustomKey

func (app *Application) GetCustomKey() globalmanager.KeyName

GetCustomKey 获取自定义实例key,实现了IApplicationCustomizer接口

func (*Application) GetDBKey

func (app *Application) GetDBKey() string

func (*Application) GetDBMongoKey

func (app *Application) GetDBMongoKey() string

func (*Application) GetDBMysqlKey

func (app *Application) GetDBMysqlKey() string

func (*Application) GetDefaultJsonCodecKey

func (app *Application) GetDefaultJsonCodecKey() string

func (*Application) GetFastJsonCodecKey

func (app *Application) GetFastJsonCodecKey() string

func (*Application) GetInstanceKey

func (app *Application) GetInstanceKey(flag frame.InstanceKeyFlag) frame.InstanceKey

GetInstanceKey 获取除框架预定义实例key外的由用户自定义标识映射的实例key

func (*Application) GetLevel2CacheKey

func (app *Application) GetLevel2CacheKey() string

func (*Application) GetLocalCacheKey

func (app *Application) GetLocalCacheKey() string

func (*Application) GetName

func (app *Application) GetName() string

GetName 获取应用名称

func (*Application) GetRedisKey

func (app *Application) GetRedisKey() string

func (*Application) GetRemoteCacheKey

func (app *Application) GetRemoteCacheKey() string

func (*Application) GetTaskDispatcherKey

func (app *Application) GetTaskDispatcherKey() string

func (*Application) GetTaskServerKey

func (app *Application) GetTaskServerKey() string

func (*Application) RegisterAppMiddleware

func (app *Application) RegisterAppMiddleware(core interface{})

RegisterAppMiddleware 注册应用中间件

func (*Application) RegisterCoreHook

func (app *Application) RegisterCoreHook(core interface{})

RegisterCoreHook 注册核心应用的生命周期钩子函数

func (*Application) SetName

func (app *Application) SetName(name string)

SetName 设置应用名称

type IApplicationCustomizer

type IApplicationCustomizer interface {
	// 示例:自定义xxx全局对象key的获取方法
	GetCustomKey() globalmanager.KeyName
}

IApplicationCustomizer 定制项目应用获取实例key的方法; module业务层Api、Service、Repository、Model等层通过ctx获取application,转成IApplicationCustomizer即可调用这里定制的获取实例key方法

Jump to

Keyboard shortcuts

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