context

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2019 License: MIT Imports: 11 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAssetStore

func GetAssetStore(ctx context.Context) assetstores.Store

GetAssetStore reads the asset store from the context.

func GetClaims

func GetClaims(ctx context.Context) *claims.JWTClaims

GetClaims reads the claims contained within the JWT token stored in the context.

func GetClaimsAsMap

func GetClaimsAsMap(ctx context.Context) map[string]interface{}

GetClaimsAsMap reads the claims contained with the JWT token stored in the context, as a map.

func GetConfig

func GetConfig(ctx context.Context) *conf.Configuration

GetConfig reads the tenant configuration from the context.

func GetCoupons

func GetCoupons(ctx context.Context) coupons.Cache

GetCoupons reads the coupon cache from the context.

func GetDB added in v1.7.2

func GetDB(ctx context.Context) *gorm.DB

GetDB reads the database from the context.

func GetInstance

func GetInstance(ctx context.Context) *models.Instance

GetInstance reads the instance id from the context.

func GetInstanceID

func GetInstanceID(ctx context.Context) string

GetInstanceID reads the instance id from the context.

func GetMailer

func GetMailer(ctx context.Context) mailer.Mailer

GetMailer reads the mailer from the context.

func GetOrderID

func GetOrderID(ctx context.Context) string

GetOrderID reads the order ID from the context.

func GetPaymentProviders

func GetPaymentProviders(ctx context.Context) map[string]payments.Provider

GetPaymentProviders reads the payment providers from the context

func GetRequestID

func GetRequestID(ctx context.Context) string

GetRequestID reads the request ID from the context.

func GetToken

func GetToken(ctx context.Context) *jwt.Token

GetToken reads the JWT token from the context.

func GetUser

func GetUser(ctx context.Context) *models.User

GetUser reads the user from the context.

func GetUserID

func GetUserID(ctx context.Context) string

GetUserID reads the user ID from the context.

func IsAdmin

func IsAdmin(ctx context.Context) bool

IsAdmin reads the admin flag from the context.

func WithAdminFlag

func WithAdminFlag(ctx context.Context, isAdmin bool) context.Context

WithAdminFlag adds a flag indicating admin status to the context.

func WithAssetStore

func WithAssetStore(ctx context.Context, store assetstores.Store) context.Context

WithAssetStore adds the asset store to the context.

func WithConfig

func WithConfig(ctx context.Context, config *conf.Configuration) context.Context

WithConfig adds the tenant configuration to the context.

func WithCoupons

func WithCoupons(ctx context.Context, config *conf.Configuration) (context.Context, error)

WithCoupons adds the coupon cache to the context based on the site URL.

func WithDB added in v1.7.2

func WithDB(ctx context.Context, db *gorm.DB) context.Context

WithDB adds the database to the context.

func WithInstance

func WithInstance(ctx context.Context, i *models.Instance) context.Context

WithInstance adds the instance id to the context.

func WithInstanceID

func WithInstanceID(ctx context.Context, id string) context.Context

WithInstanceID adds the instance id to the context.

func WithMailer

func WithMailer(ctx context.Context, mailer mailer.Mailer) context.Context

WithMailer adds the mailer to the context.

func WithOrderID

func WithOrderID(ctx context.Context, orderID string) context.Context

WithOrderID adds the order ID to the context.

func WithPaymentProviders

func WithPaymentProviders(ctx context.Context, provs map[string]payments.Provider) context.Context

WithPaymentProviders adds the payment providers to the context.

func WithRequestID

func WithRequestID(ctx context.Context, id string) context.Context

WithRequestID adds the provided request ID to the context.

func WithToken

func WithToken(ctx context.Context, token *jwt.Token) context.Context

WithToken adds the JWT token to the context.

func WithUser

func WithUser(ctx context.Context, user *models.User) context.Context

WithUser adds the user to the context.

func WithUserID

func WithUserID(ctx context.Context, userID string) context.Context

WithUserID adds the user ID to the context.

Types

This section is empty.

Jump to

Keyboard shortcuts

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