akasar

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 11, 2024 License: Apache-2.0 Imports: 26 Imported by: 0

README

akasa

Documentation

Index

Constants

View Source
const HealthURL = "/debug/akasar/health"

Variables

View Source
var HealthHandler = func(w http.ResponseWriter, _ *http.Request) {
	_, _ = fmt.Fprintf(w, "OK")
}
View Source
var RemoteCallError = errors.New("service akasar remote call error")

Functions

func GetSingleton

func GetSingleton[T any](key string) T

func InstrumentHandler

func InstrumentHandler(label string, handler http.Handler) http.Handler

func InstrumentHandlerFunc

func InstrumentHandlerFunc(label string, f func(w http.ResponseWriter, r *http.Request)) http.Handler

func Run

func Run[T any, P PointerToRoot[T]](ctx context.Context, app func(context.Context, *T) error) error

func SetSingleton added in v0.3.0

func SetSingleton[T any](key string, val T)

Types

type AutoMarshal

type AutoMarshal struct {
}

func (*AutoMarshal) AkasarMarshal

func (*AutoMarshal) AkasarMarshal(enc *codegen.Serializer)

func (*AutoMarshal) AkasarUnmarshal

func (*AutoMarshal) AkasarUnmarshal(enc *codegen.Deserializer)

type Components

type Components[T any] struct {
	// contains filtered or unexported fields
}

func (*Components[T]) Logger

func (c *Components[T]) Logger(ctx context.Context) *slog.Logger

type ErrorResult added in v0.3.0

type ErrorResult = Result[placeholder]

func WithErrorResult added in v0.3.0

func WithErrorResult(errs ...error) ErrorResult

type Initializer

type Initializer interface {
	Init(context.Context) error
}

type Injector

type Injector[T any] interface {
	New(context.Context) (T, error)
}

type InstanceOf

type InstanceOf[T any] interface {
	// contains filtered or unexported methods
}

InstanceOf 组件实例标识

type Listener

type Listener struct {
	net.Listener
	// contains filtered or unexported fields
}

type NotRetriable

type NotRetriable interface {
}

type Placeholder added in v0.3.0

type Placeholder = placeholder

type PointerToRoot

type PointerToRoot[T any] interface {
	*T
	InstanceOf[Root]
}

type Ref

type Ref[T any] struct {
	// contains filtered or unexported fields
}

func (*Ref[T]) Get

func (r *Ref[T]) Get() T

type Result

type Result[T any] struct {
	// contains filtered or unexported fields
}

func NewResult

func NewResult[T any](value T, errs ...error) Result[T]

func ResultError added in v0.3.0

func ResultError[T any](errs ...error) Result[T]

func (Result[T]) Error

func (r Result[T]) Error() error

func (Result[T]) Unwrap

func (r Result[T]) Unwrap() T

func (Result[T]) Value

func (r Result[T]) Value() T

type Root

type Root interface {
}

type Singleton

type Singleton[T any] struct {
}

type WithConfig

type WithConfig[T any] struct {
	// contains filtered or unexported fields
}

func (*WithConfig[T]) Config

func (wc *WithConfig[T]) Config() *T

type WithRouter

type WithRouter[T any] struct {
}

Jump to

Keyboard shortcuts

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