mins

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Config

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

Config returns an mcfg.Config instance.

func DB

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

DB returns a database instance from the default scope.

func Log

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

Log returns a logger instance from the default scope.

func Redis

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

Redis returns a Redis instance from the default scope.

func Server

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

Server returns an HTTP server instance from the default scope.

func TryDB added in v0.3.0

func TryDB(name ...string) (database *mdb.DB, err error)

TryDB returns a database instance or an initialization error. Unlike DB, it does not panic when configuration or connection setup fails.

func TryDBContext added in v0.3.0

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

TryDBContext returns a context-bound database instance or an initialization error.

func TryRedis added in v0.3.0

func TryRedis(name ...string) (client *mredis.Redis, err error)

TryRedis returns a Redis instance or an initialization error. Unlike Redis, it does not panic when configuration or client setup fails.

Types

type Scope added in v0.3.0

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

Scope owns framework instances for one application or test boundary. Package-level helpers use the default scope for backward compatibility.

func DefaultScope added in v0.3.0

func DefaultScope() *Scope

DefaultScope returns the process-wide scope used by package-level helpers.

func NewScope added in v0.3.0

func NewScope(config *mcfg.Config) *Scope

NewScope creates an isolated instance scope backed by config. The config must be non-nil so a scope never falls back to process-global configuration implicitly.

func (*Scope) Config added in v0.3.0

func (s *Scope) Config() *mcfg.Config

Config returns the configuration source owned by the scope.

func (*Scope) DB added in v0.3.0

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

DB returns a database instance owned by the scope.

func (*Scope) Log added in v0.3.0

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

Log returns a logger instance owned by the scope.

func (*Scope) Redis added in v0.3.0

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

Redis returns a Redis instance owned by the scope.

func (*Scope) Server added in v0.3.0

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

Server returns an HTTP server instance owned by the scope.

func (*Scope) TryDB added in v0.3.0

func (s *Scope) TryDB(name ...string) (database *mdb.DB, err error)

TryDB returns a scoped database instance or an initialization error.

func (*Scope) TryDBContext added in v0.3.0

func (s *Scope) TryDBContext(ctx context.Context, name ...string) (*mdb.DB, error)

TryDBContext returns a context-bound database instance owned by the scope.

func (*Scope) TryRedis added in v0.3.0

func (s *Scope) TryRedis(name ...string) (client *mredis.Redis, err error)

TryRedis returns a scoped Redis instance or an initialization error.

Jump to

Keyboard shortcuts

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