ctx

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAPIKeyFromParam

func GetAPIKeyFromParam(c *fiber.Ctx) *models.APIKey

GetAPIKeyFromParam returns the api key specified in the url

func GetAuth

func GetAuth(c *fiber.Ctx) *auth.Helper

GetAuth returns the auth key used to make the request If the request is not authenticated this function panics

func GetDbConn

func GetDbConn(c *fiber.Ctx) db.Connection

GetDbConn returns the database connection

func GetKey

func GetKey(c *fiber.Ctx) *models.APIKey

GetKey returns the api key used to make the request

func GetLogger

func GetLogger(c *fiber.Ctx) *log.Entry

GetLogger returns the global logger

func GetProfile

func GetProfile(c *fiber.Ctx) *models.Profile

GetProfile returns a profile (probably based on the profile id specified in the url)

func GetRequestID

func GetRequestID(c *fiber.Ctx) primitive.ObjectID

GetRequestID returns the request id We bind this to every request so we can debug things more easily in the case of many requests

func ResetMatcherProfilesCache

func ResetMatcherProfilesCache(ctx context.Context) context.Context

ResetMatcherProfilesCache sets the profiles cache to an empty object

func SetAPIKeyFromParam

func SetAPIKeyFromParam(ctx context.Context, value *models.APIKey) context.Context

SetAPIKeyFromParam sets an api key based on the route

func SetAuth

func SetAuth(ctx context.Context, value *auth.Helper) context.Context

SetAuth sets the auth key used to make the request

func SetDbConn

func SetDbConn(ctx context.Context, value db.Connection) context.Context

SetDbConn sets the database connection

func SetKey

func SetKey(ctx context.Context, value *models.APIKey) context.Context

SetKey sets the api key used to make the request

func SetLogger

func SetLogger(ctx context.Context, value *log.Entry) context.Context

SetLogger sets the logger used in the request

func SetProfile

func SetProfile(ctx context.Context, value *models.Profile) context.Context

SetProfile sets a profile

func SetRequestID

func SetRequestID(ctx context.Context, value primitive.ObjectID) context.Context

SetRequestID sets the request id

Types

type MatcherProfilesCache

type MatcherProfilesCache struct {
	InsertionTime time.Time
	Profiles      []*models.Profile
}

MatcherProfilesCache contains the matcher profiles cache

func GetMatcherProfilesCache

func GetMatcherProfilesCache(c *fiber.Ctx) *MatcherProfilesCache

GetMatcherProfilesCache returns the cached profiles used by the matcher

Jump to

Keyboard shortcuts

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