modulecontext

package
v0.184.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

Variables

This section is empty.

Functions

func ContextWithDBProvider

func ContextWithDBProvider(ctx context.Context, provider *DBProvider) context.Context

Types

type DBProvider

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

DBProvider takes in DSNs and holds a *sql.DB for each this allows us to: - pool db connections, rather than initializing anew each time - validate DSNs at startup, rather than returning errors or panicking at Database.Get()

func DBProviderFromContext

func DBProviderFromContext(ctx context.Context) *DBProvider

func NewDBProvider

func NewDBProvider() *DBProvider

func (*DBProvider) Add

func (d *DBProvider) Add(name string, dbType DBType, dsn string) error

func (*DBProvider) Get

func (d *DBProvider) Get(name string) (*sql.DB, error)

type DBType

type DBType int32

func (DBType) String

func (x DBType) String() string

type ModuleContext

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

ModuleContext holds the context needed for a module, including configs, secrets and DSNs

func NewFromProto

func NewFromProto(ctx context.Context, moduleName string, response *ftlv1.ModuleContextResponse) (*ModuleContext, error)

func (*ModuleContext) ApplyToContext

func (m *ModuleContext) ApplyToContext(ctx context.Context) context.Context

ApplyToContext sets up the context so that configurations, secrets and DSNs can be retreived Each of these components have accessors to get a manager back from the context

Jump to

Keyboard shortcuts

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