Documentation ¶
Index ¶
- Constants
- func EncoderError() http.EncodeErrorFunc
- func EncoderResponse() http.EncodeResponseFunc
- func NewContextFromApp(ctx context.Context, s AppInfo) context.Context
- type App
- type AppInfo
- type Context
- type LogField
- type Option
- func AfterStart(fn func(context.Context) error) Option
- func AfterStop(fn func(context.Context) error) Option
- func BeforeStart(fn func(context.Context) error) Option
- func BeforeStop(fn func(context.Context) error) Option
- func Config(source config.Source) Option
- func Endpoint(endpoints ...*url.URL) Option
- func ID(id string) Option
- func LoggerWith(fields LogField) Option
- func Metadata(md map[string]string) Option
- func Name(name string) Option
- func Registrar(r registry.Registrar) Option
- func RegistrarServer(fn registrarServerFn) Option
- func RegistrarTimeout(t time.Duration) Option
- func Server(srv ...transport.Server) Option
- func Signal(sigs ...os.Signal) Option
- func StopTimeout(t time.Duration) Option
- func Version(version string) Option
Constants ¶
View Source
const Release = "v2.7.0"
Release is the current kratos version.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
App is an application components lifecycle manager.
type AppInfo ¶
type AppInfo interface { ID() string Name() string Version() string Metadata() map[string]string Endpoint() []string Config() config.Config }
AppInfo is application context value.
type Context ¶
type Context interface { Logger() *log.Helper DB(name ...string) *gorm.DB Go(runner pool.Runner) error Loader(name string) []byte Email() email.Email ClientIP() string Captcha() captcha.Captcha JWT() jwt.Jwt Authentication() authentication.Authentication Ctx() context.Context GetMetadata(string) string SetMetadata(key, value string) ID() string Name() string Version() string Metadata() map[string]string Config() config.Config Endpoint() []string Deadline() (deadline time.Time, ok bool) Done() <-chan struct{} Err() error Value(key any) interface{} }
func MustContext ¶
MustContext returns the Transport value stored in ctx, if any.
type Option ¶
type Option func(o *options)
Option is an application option.
func AfterStart ¶
AfterStart run funcs after app starts
func BeforeStart ¶
BeforeStart run funcs before app starts
func BeforeStop ¶
BeforeStop run funcs before app stops
func LoggerWith ¶
LoggerWith with service logger with field.
func RegistrarServer ¶
func RegistrarServer(fn registrarServerFn) Option
RegistrarServer with service register server.
func RegistrarTimeout ¶
RegistrarTimeout with registrar timeout.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
api
|
|
cmd
|
|
kratos
Module
|
|
protoc-gen-go-errors
Module
|
|
protoc-gen-go-http
Module
|
|
contrib
|
|
registry/kubernetes
Package kuberegistry registry simply implements the Kubernetes-based Registry
|
Package kuberegistry registry simply implements the Kubernetes-based Registry |
proto
Package proto defines the protobuf codec.
|
Package proto defines the protobuf codec. |
nolint:gomnd
|
nolint:gomnd |
extra
|
|
internal
|
|
group
Package group provides a sample lazy load container.
|
Package group provides a sample lazy load container. |
Click to show internal directories.
Click to hide internal directories.