appcontext

package
v0.0.0-...-fdfe12d Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppContext

type AppContext interface {
	DB() *pop.Connection
	Logger() *zap.Logger
	NewTransaction(func(appCtx AppContext) error) error
	Session() *auth.Session
}

AppContext should be the first argument passed to all stateless methods and contains all necessary config for the app

This is a separate package so that all parts of the app can import it without creating an import cycle

func NewAppContext

func NewAppContext(db *pop.Connection, logger *zap.Logger, session *auth.Session) AppContext

NewAppContext creates a new AppContext

func NewAppContextFromContext

func NewAppContextFromContext(ctx context.Context, appCtx AppContext) AppContext

NewAppContextFromContext creates a new AppContext taking context.Context into account and pulling some values from it

Jump to

Keyboard shortcuts

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