next

package module
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2023 License: MIT Imports: 24 Imported by: 1

README

kratos

基于 kratos 封装的业务框架

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Next

type Next struct {
	*kratos.App
	// contains filtered or unexported fields
}

func New

func New(opts ...Option) (*Next, error)

New create an application lifecycle manager.

type Option

type Option func(o *Options)

Option is an application option.

func AfterStart

func AfterStart(fn func(context.Context) error) Option

AfterStart run funcs after app starts

func AfterStop

func AfterStop(fn func(context.Context) error) Option

AfterStop run funcs after app stops

func BeforeStart

func BeforeStart(fn func(context.Context) error) Option

BeforeStart run funcs before app starts

func BeforeStop

func BeforeStop(fn func(context.Context) error) Option

BeforeStop run funcs before app stops

func Context

func Context(ctx context.Context) Option

Context with service context.

func Endpoint

func Endpoint(endpoints ...*url.URL) Option

Endpoint with service endpoint.

func ID

func ID(id string) Option

ID with service ID.

func Loader

func Loader(loader ...loader.Loader) Option

Loader with service Loader.

func Logger

func Logger(logger logger.Logger) Option

Logger with service Logger.

func Metadata

func Metadata(md map[string]string) Option

Metadata with service Metadata.

func Name

func Name(name string) Option

Name with service Name.

func Registrar

func Registrar(r registry.Registrar) Option

Registrar with service registry.

func RegistrarTimeout

func RegistrarTimeout(t time.Duration) Option

RegistrarTimeout with Registrar timeout.

func Server

func Server(srv ...transport.Server) Option

Server with transport Servers.

func Signal

func Signal(sigs ...os.Signal) Option

Signal with exit signals.

func StopTimeout

func StopTimeout(t time.Duration) Option

StopTimeout with app stop timeout.

func Version

func Version(version string) Option

Version with service Version.

type Options

type Options struct {
	ID        string
	Name      string
	Version   string
	Metadata  map[string]string
	Endpoints []*url.URL

	Ctx  context.Context
	Sigs []os.Signal

	Logger           logger.Logger
	Registrar        registry.Registrar
	RegistrarTimeout time.Duration
	StopTimeout      time.Duration
	Loader           []loader.Loader
	Servers          []transport.Server

	// Before and After funcs
	BeforeStart []func(context.Context) error
	BeforeStop  []func(context.Context) error
	AfterStart  []func(context.Context) error
	AfterStop   []func(context.Context) error
}

Options is an application options.

Directories

Path Synopsis
adapter
broker/kafka/otelsarama
Package otelsarama instruments the github.com/Shopify/sarama package.
Package otelsarama instruments the github.com/Shopify/sarama package.
api
Package broker is an interface used for asynchronous messaging
Package broker is an interface used for asynchronous messaging
internal
group
Package group provides a sample lazy load container.
Package group provides a sample lazy load container.
bbr
pkg
env
net

Jump to

Keyboard shortcuts

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