Documentation ¶
Index ¶
- Constants
- func DetectAddress(addr ...string) string
- func HostEnding(log XLog.ILogger, context *HostBuildContext)
- func HostRunning(log XLog.ILogger, context *HostBuildContext)
- func PrintLogo(l XLog.ILogger, env *Context.HostEnvironment)
- func RunningHostEnvironmentSetting(hostEnv *Context.HostEnvironment)
- type ApplicationChannel
- type ApplicationEvent
- type ApplicationEventPublisher
- type ApplicationLife
- type Configuration
- func (c *Configuration) Get(name string) interface{}
- func (c *Configuration) GetConfDir() string
- func (c *Configuration) GetInt(name string) int
- func (c *Configuration) GetProfile() string
- func (c *Configuration) GetSection(name string) IConfiguration
- func (c *Configuration) GetString(name string) string
- func (c *Configuration) Unmarshal(obj interface{})
- type ConfigurationBuilder
- func (builder *ConfigurationBuilder) AddEnvironment() *ConfigurationBuilder
- func (builder *ConfigurationBuilder) AddFlagArgs() *ConfigurationBuilder
- func (builder *ConfigurationBuilder) AddJsonFile(name string) *ConfigurationBuilder
- func (builder *ConfigurationBuilder) AddYamlFile(name string) *ConfigurationBuilder
- func (builder *ConfigurationBuilder) Build() *Configuration
- func (builder *ConfigurationBuilder) BuildEnv(env string) *Configuration
- type ConfigurationContext
- type DataChannelSlice
- type HostBuildContext
- type HostBuilder
- func (host *HostBuilder) Build() IServiceHost
- func (host *HostBuilder) Configure(configure interface{}) *HostBuilder
- func (host *HostBuilder) ConfigureServices(configure func(*DependencyInjection.ServiceCollection)) *HostBuilder
- func (host *HostBuilder) OnApplicationLifeEvent(lifeConfigure func(*ApplicationLife)) *HostBuilder
- func (host *HostBuilder) SetEnvironment(mode string) *HostBuilder
- func (host *HostBuilder) UseConfiguration(configuration IConfiguration) *HostBuilder
- func (host *HostBuilder) UseServer(server IServer) *HostBuilder
- type IApplicationBuilder
- type IConfiguration
- type IHostBuilderDecorator
- type IServer
- type IServiceHost
Constants ¶
View Source
const ( APPLICATION_LIFE_START = "APPLICATION_LIFE_START" APPLICATION_LIFE_STOP = "APPLICATION_LIFE_STOP" )
View Source
const (
// DefaultAddress is used if no other is specified.
DefaultAddress = ":8080"
)
Variables ¶
This section is empty.
Functions ¶
func DetectAddress ¶
func HostEnding ¶ added in v1.5.3
func HostEnding(log XLog.ILogger, context *HostBuildContext)
func HostRunning ¶ added in v1.5.3
func HostRunning(log XLog.ILogger, context *HostBuildContext)
func RunningHostEnvironmentSetting ¶
func RunningHostEnvironmentSetting(hostEnv *Context.HostEnvironment)
RunningHostEnvironmentSetting ,get running Env setting.
Types ¶
type ApplicationChannel ¶
type ApplicationChannel chan ApplicationEvent
ApplicationChannel 是一个能接收 ApplicationEvent 的 channel
type ApplicationEvent ¶
type ApplicationEvent struct { Data interface{} Topic string }
type ApplicationEventPublisher ¶
type ApplicationEventPublisher struct {
// contains filtered or unexported fields
}
ApplicationEventPublisher 存储有关订阅者感兴趣的特定主题的信息
func NewEventPublisher ¶
func NewEventPublisher() *ApplicationEventPublisher
func (*ApplicationEventPublisher) NewEvent ¶
func (eb *ApplicationEventPublisher) NewEvent() chan ApplicationEvent
func (*ApplicationEventPublisher) Publish ¶
func (eb *ApplicationEventPublisher) Publish(topic string, data interface{})
func (*ApplicationEventPublisher) Subscribe ¶
func (eb *ApplicationEventPublisher) Subscribe(topic string, ch ApplicationChannel)
type ApplicationLife ¶
type ApplicationLife struct { ApplicationStopped chan ApplicationEvent ApplicationStarted chan ApplicationEvent // contains filtered or unexported fields }
func NewApplicationLife ¶
func NewApplicationLife() *ApplicationLife
func (*ApplicationLife) StartApplication ¶
func (life *ApplicationLife) StartApplication()
func (*ApplicationLife) StopApplication ¶
func (life *ApplicationLife) StopApplication()
type Configuration ¶
type Configuration struct {
// contains filtered or unexported fields
}
func NewConfiguration ¶
func NewConfiguration(configContext *ConfigurationContext) *Configuration
func (*Configuration) Get ¶
func (c *Configuration) Get(name string) interface{}
func (*Configuration) GetConfDir ¶ added in v1.5.6
func (c *Configuration) GetConfDir() string
func (*Configuration) GetInt ¶ added in v1.5.6
func (c *Configuration) GetInt(name string) int
func (*Configuration) GetProfile ¶ added in v1.5.2
func (c *Configuration) GetProfile() string
func (*Configuration) GetSection ¶
func (c *Configuration) GetSection(name string) IConfiguration
func (*Configuration) GetString ¶ added in v1.5.6
func (c *Configuration) GetString(name string) string
func (*Configuration) Unmarshal ¶ added in v1.5.1
func (c *Configuration) Unmarshal(obj interface{})
type ConfigurationBuilder ¶
type ConfigurationBuilder struct {
// contains filtered or unexported fields
}
func NewConfigurationBuilder ¶
func NewConfigurationBuilder() *ConfigurationBuilder
func (*ConfigurationBuilder) AddEnvironment ¶
func (builder *ConfigurationBuilder) AddEnvironment() *ConfigurationBuilder
func (*ConfigurationBuilder) AddFlagArgs ¶
func (builder *ConfigurationBuilder) AddFlagArgs() *ConfigurationBuilder
func (*ConfigurationBuilder) AddJsonFile ¶
func (builder *ConfigurationBuilder) AddJsonFile(name string) *ConfigurationBuilder
func (*ConfigurationBuilder) AddYamlFile ¶
func (builder *ConfigurationBuilder) AddYamlFile(name string) *ConfigurationBuilder
func (*ConfigurationBuilder) Build ¶
func (builder *ConfigurationBuilder) Build() *Configuration
func (*ConfigurationBuilder) BuildEnv ¶ added in v1.5.2
func (builder *ConfigurationBuilder) BuildEnv(env string) *Configuration
type ConfigurationContext ¶
type ConfigurationContext struct {
// contains filtered or unexported fields
}
type DataChannelSlice ¶
type DataChannelSlice []ApplicationChannel
DataChannelSlice 是一个包含 DataChannels 数据的切片
type HostBuildContext ¶
type HostBuildContext struct { RequestDelegate interface{} ApplicationCycle *ApplicationLife HostingEnvironment *Context.HostEnvironment Configuration IConfiguration HostConfiguration *Configs.HostConfig ApplicationServicesDef *DependencyInjection.ServiceCollection ApplicationServices DependencyInjection.IServiceProvider HostServices DependencyInjection.IServiceProvider }
type HostBuilder ¶
type HostBuilder struct { Server IServer // Server Context *HostBuildContext // context of Host builder Decorator IHostBuilderDecorator // host builder decorator or extension // contains filtered or unexported fields }
host builder
func (*HostBuilder) Configure ¶
func (host *HostBuilder) Configure(configure interface{}) *HostBuilder
Configure function func(IApplicationBuilder)
func (*HostBuilder) ConfigureServices ¶
func (host *HostBuilder) ConfigureServices(configure func(*DependencyInjection.ServiceCollection)) *HostBuilder
ConfigureServices configure function by ServiceCollection of DI.
func (*HostBuilder) OnApplicationLifeEvent ¶
func (host *HostBuilder) OnApplicationLifeEvent(lifeConfigure func(*ApplicationLife)) *HostBuilder
OnApplicationLifeEvent on application life event
func (*HostBuilder) SetEnvironment ¶
func (host *HostBuilder) SetEnvironment(mode string) *HostBuilder
SetEnvironment set value(Dev,Test,Prod) by environment
func (*HostBuilder) UseConfiguration ¶ added in v1.5.1
func (host *HostBuilder) UseConfiguration(configuration IConfiguration) *HostBuilder
func (*HostBuilder) UseServer ¶
func (host *HostBuilder) UseServer(server IServer) *HostBuilder
UseServer set IServer to host builder
type IApplicationBuilder ¶
type IApplicationBuilder interface { Build() interface{} SetHostBuildContext(*HostBuildContext) }
type IConfiguration ¶
type IHostBuilderDecorator ¶
type IHostBuilderDecorator interface { // OverrideConfigure is configure function by application builder. OverrideConfigure(configureFunc interface{}, builder IApplicationBuilder) // OverrideNewApplicationBuilder create application builder. OverrideNewApplicationBuilder(context *HostBuildContext) IApplicationBuilder // OverrideNewHost Create IServiceHost. OverrideNewHost(server IServer, context *HostBuildContext) IServiceHost }
IHostBuilderDecorator Host Builder decorator or extension
type IServer ¶
type IServer interface { GetAddr() string Run(context *HostBuildContext) (e error) Shutdown() }
type IServiceHost ¶
type IServiceHost interface { Run() Shutdown() StopApplicationNotify() SetAppMode(mode string) }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.