options

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2025 License: MPL-2.0 Imports: 10 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	FeatureNamePrefix = "mikros_framework-"

	HttpFeatureName       = FeatureNamePrefix + "http"
	LoggerFeatureName     = FeatureNamePrefix + "logger"
	ErrorsFeatureName     = FeatureNamePrefix + "errors"
	DefinitionFeatureName = FeatureNamePrefix + "definition"
	EnvFeatureName        = FeatureNamePrefix + "env"

	HttpCorsFeatureName        = FeatureNamePrefix + "http_cors"
	HttpSpecAuthFeatureName    = FeatureNamePrefix + "http_spec_auth"
	HttpAuthFeatureName        = FeatureNamePrefix + "http_auth"
	TracingFeatureName         = FeatureNamePrefix + "tracing"
	TrackerFeatureName         = FeatureNamePrefix + "tracker"
	LoggerExtractorFeatureName = FeatureNamePrefix + "logger_extractor"
	PanicRecoveryFeatureName   = FeatureNamePrefix + "panic_recovery"
)

Internal feature names

Variables

This section is empty.

Functions

This section is empty.

Types

type GrpcClient

type GrpcClient struct {
	// ServiceName should be the service name.
	ServiceName service.Name

	// NewClientFunction should point to the service API function that can create
	// its gRPC client interface.
	NewClientFunction interface{}
}

GrpcClient is a structure to set information about a gRPC client that will be coupled by a service.

func (*GrpcClient) Validate

func (g *GrpcClient) Validate() error

type GrpcServiceOptions

type GrpcServiceOptions struct {
	ProtoServiceDescription *grpc.ServiceDesc
}

GrpcServiceOptions gathers options to initialize a gRPC service.

func (*GrpcServiceOptions) Kind

type HttpServiceOptions

type HttpServiceOptions struct {
	// CORSStrict controls how invalid CORS configurations are handled if a
	// CORS middleware implementation is supplied. When true, invalid CORS
	// settings cause service initialization to fail. Otherwise, a warning
	// is emitted and the middleware is disabled.
	CORSStrict bool

	// BasePath is a common URL prefix under which all routes of this service
	// are mounted. For example, if BasePath = "/api", a handler registered at
	// "/items" will be served at "/api/items". An empty string mounts the
	// service at root.
	BasePath string

	// ReadTimeout is the maximum duration allowed for reading the entire
	// request, including the body. A zero value uses the Mikros default (15 s).
	ReadTimeout time.Duration

	// WriteTimeout is the maximum duration before timing out writes of the
	// response. A zero value uses the Mikros default (15 s).
	WriteTimeout time.Duration

	// IdleTimeout is the maximum time to wait for the next request when keep-alive
	// is enabled. A zero value uses the Mikros default (60 s).
	IdleTimeout time.Duration

	// MaxHeaderBytes controls the maximum number of bytes the server will
	// read parsing request headers. A zero value uses the Go standard
	// library default (1 MiB).
	MaxHeaderBytes int

	// Middlewares is a slice of user-supplied HTTP middlewares in the form
	// func(http.Handler) http.Handler. They are composed after core middlewares
	// (such as CORS and authentication). The first element in the slice becomes
	// the outermost wrapper.
	Middlewares []func(handler http.Handler) http.Handler
}

HttpServiceOptions defines runtime options for an HTTP service.

func (*HttpServiceOptions) Kind

type HttpSpecServiceOptions added in v0.19.0

type HttpSpecServiceOptions struct {
	ProtoHttpServer http_spec.HttpSpecServerAPI
}

HttpSpecServiceOptions gathers options to initialize a service as an HTTP service.

func (*HttpSpecServiceOptions) Kind added in v0.19.0

type NewServiceOptions

type NewServiceOptions struct {
	// Service must have all required service options according the types
	// defined in the 'service.toml' file. The same type name should be
	// used as a key here.
	Service map[string]ServiceOptions `validate:"required"`

	// RunTimeFeatures must hold everything that will only be available
	// when the service executes. The key here should be the same as the
	// feature where the options will be sent.
	RunTimeFeatures map[string]interface{}

	// GrpcClients should have every gRPC dependency that the service
	// may have.
	GrpcClients map[string]*GrpcClient
}

NewServiceOptions gathers all the main options that one can use to create a new service.

func (*NewServiceOptions) Validate

func (o *NewServiceOptions) Validate() error

Validate validates if a NewServiceOptions object contains the required information initialized to proceed.

type ScriptServiceOptions

type ScriptServiceOptions struct{}

func (*ScriptServiceOptions) Kind

type ServiceOptions

type ServiceOptions interface {
	Kind() definition.ServiceType
}

ServiceOptions is an interface that all services options structure must implement.

type WorkerServiceOptions added in v0.19.0

type WorkerServiceOptions struct{}

func (*WorkerServiceOptions) Kind added in v0.19.0

Jump to

Keyboard shortcuts

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