foundation

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 17, 2026 License: MIT Imports: 2 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 interface {
	Version() string

	GetBasePath() string
	GetBootstrapPath() string
	GetConfigPath() string
	GetLangPath() string
	GetPublicPath() string
	GetResourcePath() string
	GetStoragePath() string

	Environment(...string) (string, bool)
	MaintenanceMode() context.Context
	IsDownForMaintenance() bool

	// Register a service provider with the application.
	Register(provider ...any)
	Provide(function interface{}, opts ...dig.ProvideOption) error
	Invoke(function interface{}, opts ...dig.InvokeOption) error

	// Boot the application's service providers.
	Boot()

	// Register a new boot listener.
	Booting(callback func(application Application))

	// Register a new "booted" listener.
	Booted(callback func(application Application))

	// Get the current application locale.
	GetLocale() string

	// Get the registered service provider instances if any exist.
	GetProviders(provider interface{}) []interface{}

	// Determine if the application has been bootstrapped before.
	HasBeenBootstrapped() bool

	// Set the current application locale.
	SetLocale(locale string)

	// Register a terminating callback with the application.
	Terminating(callback interface{}) Application

	// Terminate the application.
	Terminate()
}

Application 接口定义

type ServiceProvider

type ServiceProvider interface {
	Register()               // 注册服务
	Boot()                   // 启动服务,视图,路由等等都可以在这个方法中初始化
	Conf() map[string]string // 生成配置
	Description() string     // 服务描述
}

Source Files

  • application.go
  • service_provider.go

Jump to

Keyboard shortcuts

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