m

package
v0.1.13 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2025 License: MIT Imports: 15 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Config

func Config(name ...string) *mcfg.Config

Config returns the instance of the configuration with the specified name.

func DB

func DB(name ...string) *mdb.DB

DB returns the instance of the database with the specified name.

func DBContext

func DBContext(ctx context.Context, name ...string) *mdb.DB

DBContext returns the instance of the database with the specified name and context.

func Log

func Log(name ...string) *mlog.Logger

Log returns the instance of the logger with the specified name.

func Redis

func Redis(name ...string) *mredis.Redis

Redis returns the instance of the redis with the specified name.

func RequestFromCtx

func RequestFromCtx(ctx context.Context) *mhttp.Request

func Server

func Server(name ...string) *mhttp.Server

Server returns the instance of the HTTP server with the specified name.

Types

type App

type App struct {
	// contains filtered or unexported fields
}

App is the core application structure that manages the lifecycle of services and hooks.

func NewApp added in v0.1.4

func NewApp(opts ...Option) *App

NewApp creates a new App instance with the given options.

func (*App) Run added in v0.1.4

func (a *App) Run() error

Run starts the application and waits for a signal to gracefully shutdown.

type AppServer added in v0.1.4

type AppServer interface {
	Start(ctx context.Context) error
	Shutdown(ctx context.Context) error
}

AppServer defines the interface for a server that can be managed by the App.

type Meta

type Meta = mmeta.Meta // Meta is alias of frequently-used type gmeta.Meta.

type Option added in v0.1.4

type Option func(*App)

An Option configures an App.

func WithServer added in v0.1.4

func WithServer(servers ...AppServer) Option

WithServer adds servers to the application.

func WithShutdownHook added in v0.1.4

func WithShutdownHook(hooks ...func(ctx context.Context) error) Option

WithShutdownHook adds functions to be called during graceful shutdown.

type Var

type Var = mvar.Var // Var is a universal variable interface, like generics.

func NewVar

func NewVar(value interface{}, safe ...bool) *Var

Jump to

Keyboard shortcuts

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