http

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2023 License: MIT Imports: 4 Imported by: 20

Documentation

Index

Constants

View Source
const DefaultKey = "__tenant"

Variables

This section is empty.

Functions

func KeyOrDefault

func KeyOrDefault(key string) string

func Middleware

func Middleware(ts saas.TenantStore, options ...Option) func(next http.Handler) http.Handler

Types

type CookieTenantResolveContrib

type CookieTenantResolveContrib struct {
	// contains filtered or unexported fields
}

func NewCookieTenantResolveContrib

func NewCookieTenantResolveContrib(key string, r *http.Request) *CookieTenantResolveContrib

func (*CookieTenantResolveContrib) Name

func (*CookieTenantResolveContrib) Resolve

func (h *CookieTenantResolveContrib) Resolve(ctx *saas.Context) error

type DomainTenantResolveContrib

type DomainTenantResolveContrib struct {
	// contains filtered or unexported fields
}

func NewDomainTenantResolveContrib

func NewDomainTenantResolveContrib(f string, r *http.Request) *DomainTenantResolveContrib

func (*DomainTenantResolveContrib) Name

func (*DomainTenantResolveContrib) Resolve

func (h *DomainTenantResolveContrib) Resolve(ctx *saas.Context) error

type ErrorFormatter

type ErrorFormatter func(w http.ResponseWriter, err error)
var (
	DefaultErrorFormatter ErrorFormatter = func(w http.ResponseWriter, err error) {
		if err == saas.ErrTenantNotFound {

			http.Error(w, "Not Found", 404)
		} else {
			http.Error(w, err.Error(), 500)
		}
	}
)

type FormTenantResolveContrib

type FormTenantResolveContrib struct {
	// contains filtered or unexported fields
}

func NewFormTenantResolveContrib

func NewFormTenantResolveContrib(key string, r *http.Request) *FormTenantResolveContrib

func (*FormTenantResolveContrib) Name

func (h *FormTenantResolveContrib) Name() string

func (*FormTenantResolveContrib) Resolve

func (h *FormTenantResolveContrib) Resolve(ctx *saas.Context) error

type HeaderTenantResolveContrib

type HeaderTenantResolveContrib struct {
	// contains filtered or unexported fields
}

func NewHeaderTenantResolveContrib

func NewHeaderTenantResolveContrib(key string, r *http.Request) *HeaderTenantResolveContrib

func (*HeaderTenantResolveContrib) Name

func (*HeaderTenantResolveContrib) Resolve

func (h *HeaderTenantResolveContrib) Resolve(ctx *saas.Context) error

type Option

type Option func(*option)

func WithErrorFormatter

func WithErrorFormatter(e ErrorFormatter) Option

func WithMultiTenancyOption

func WithMultiTenancyOption(opt *WebMultiTenancyOption) Option

func WithResolveOption

func WithResolveOption(opt ...saas.ResolveOption) Option

type QueryTenantResolveContrib

type QueryTenantResolveContrib struct {
	// contains filtered or unexported fields
}

func NewQueryTenantResolveContrib

func NewQueryTenantResolveContrib(key string, r *http.Request) *QueryTenantResolveContrib

func (*QueryTenantResolveContrib) Name

func (*QueryTenantResolveContrib) Resolve

func (h *QueryTenantResolveContrib) Resolve(ctx *saas.Context) error

type WebMultiTenancyOption

type WebMultiTenancyOption struct {
	TenantKey    string
	DomainFormat string
}

func NewDefaultWebMultiTenancyOption

func NewDefaultWebMultiTenancyOption() *WebMultiTenancyOption

func NewWebMultiTenancyOption

func NewWebMultiTenancyOption(key string, domainFormat string) *WebMultiTenancyOption

Jump to

Keyboard shortcuts

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