Documentation
¶
Index ¶
- func Config(name ...string) *mcfg.Config
- func DB(name ...string) *mdb.DB
- func Log(name ...string) *mlog.Logger
- func Redis(name ...string) *mredis.Redis
- func Server(name ...string) *mhttp.Server
- func TryDB(name ...string) (database *mdb.DB, err error)
- func TryDBContext(ctx context.Context, name ...string) (*mdb.DB, error)
- func TryRedis(name ...string) (client *mredis.Redis, err error)
- type Scope
- func (s *Scope) Config() *mcfg.Config
- func (s *Scope) DB(name ...string) *mdb.DB
- func (s *Scope) Log(name ...string) *mlog.Logger
- func (s *Scope) Redis(name ...string) *mredis.Redis
- func (s *Scope) Server(name ...string) *mhttp.Server
- func (s *Scope) TryDB(name ...string) (database *mdb.DB, err error)
- func (s *Scope) TryDBContext(ctx context.Context, name ...string) (*mdb.DB, error)
- func (s *Scope) TryRedis(name ...string) (client *mredis.Redis, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TryDB ¶ added in v0.3.0
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
TryDBContext returns a context-bound database instance or an initialization error.
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
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) TryDB ¶ added in v0.3.0
TryDB returns a scoped database instance or an initialization error.
func (*Scope) TryDBContext ¶ added in v0.3.0
TryDBContext returns a context-bound database instance owned by the scope.