context

package
v0.0.0-...-3c9b5b7 Latest Latest
Warning

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

Go to latest
Published: May 25, 2023 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init[T any](capacity int) map[string]T

Types

type Asyncable

type Asyncable any

type Option func(ctx *container)

type Callable

type Callable any

type Option func(ctx *container)

type Context

type Context interface {
	context.Context
	Set(k string, v Pluggable)
	Get(k string) Pluggable
	Delete(k string)
	Ctx() context.Context
	Cancel()
	Stop()
	Options(opts ...Option) Context
	Stream(k string) Asyncable
	Streams() map[string]Asyncable
	AddHandler(k string, handler Callable)
	RemoveHandler(k string)
	Handler(k string) Callable
	Handlers() map[string]Callable
}

New creates a new Context

func New

func New(opts ...Option) Context

type Option

type Option func(ctx *container)

func Cancel

func Cancel() Option

func Database

func Database(db sqlx.ExtContext) Option

func Deadline

func Deadline(deadline time.Time) Option

func Handler

func Handler(k string, handler Callable) Option

func Logger

func Logger(l *zerolog.Logger) Option

func Stream

func Stream(k string, stream any) Option

func Timeout

func Timeout(timeout time.Duration) Option

func Transaction

func Transaction(tx sqlx.ExtContext) Option

type Pluggable

type Pluggable any

type Option func(ctx *container)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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