reqctx

package
v0.0.0-...-1d59f67 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GraphQLMiddleware

func GraphQLMiddleware(next http.Handler) http.Handler

GraphQLMiddleware: Adds things to context that are needed for serving requests

func ToResolverContext

func ToResolverContext(ctx context.Context, opts ...ReqContextOption) context.Context

ToResolverContext: decorates a context with items needed for the GraphQL api.

Types

type ContextKey

type ContextKey string
const (
	CurrentUser  ContextKey = "CurrentUser"
	AccountsApi  ContextKey = "AccountsApi"
	DatabasePool ContextKey = "DatabasePool"
)

type PlatformStuff

type PlatformStuff struct {
	Pool   connection.Pool
	NewApi api.AccountsApiFactory
}

func GetPlatformStuff

func GetPlatformStuff(ctx context.Context) PlatformStuff

type ReqContextOption

type ReqContextOption func(ctx context.Context) context.Context

func WithAccountsApi

func WithAccountsApi(factory api.AccountsApiFactory) ReqContextOption

WithAccountsApi: sets a custom AccountsApiFactory. The factory alloows the calling function to control the txn semantics of the database connection.

func WithDatabasePool

func WithDatabasePool(pool connection.Pool) ReqContextOption

WithDatabasePool: sets a custom DatabasePool.

Jump to

Keyboard shortcuts

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