sandwich_shop

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2021 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var OrderCtxKey = &contextKey{"order"}
View Source
var UserCtxKey = &contextKey{"user"}

Functions

func PlaceOrder

func PlaceOrder(w http.ResponseWriter, r *http.Request)

PlaceOrder takes the posted request and returns the sandwich value

func SetOrderCtx

func SetOrderCtx(next http.Handler) http.Handler

SetOrderCtx set the OrderContext based upon incoming request values

Types

type OrderConfig

type OrderConfig struct {
	Runtime    string    `yaml:"runtime"`
	Path       string    `yaml:"path"`
	Env        []*string `yaml:"env"`
	Auth       string    `yaml:"auth"`
	AuthHeader string    `yaml:"auth_header"`
}

OrderConfig represents the function configuration

type OrderContext

type OrderContext struct {
	TenantID string
	Order    models.Order
}

OrderContext hold values for the requested tenant and the order name

func OrderFromContext

func OrderFromContext(ctx context.Context) *OrderContext

OrderFromContext returns the stored order context

type Resolver

type Resolver struct {
}

Resolver struct

func (*Resolver) Query

func (r *Resolver) Query() shop.QueryResolver

Query is the resolver bound to the type Query

type User

type User struct {
	ID         string
	Authorized bool
}

User is a stand-in for our database backed user object

func UserFromContext

func UserFromContext(ctx context.Context) *User

UserFromContext finds the user from the context. REQUIRES Middleware to have run.

Jump to

Keyboard shortcuts

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