model

package
v0.0.0-...-c13ee6f Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Header          ParamType = "header"
	Query                     = "query"
	BodyFormEncoded           = "body_form_encoded"
)

Variables

View Source
var ErrUnauthorizedRequest = &MyError{Message: "unauthorized request"}

Functions

This section is empty.

Types

type AccessToken

type AccessToken struct {
	ParamType ParamType `dynamo:"param_type"`
	Key       string    `dynamo:"key"`
	Value     string    `dynamo:"value"`
}

type AccessTokens

type AccessTokens struct {
	Tokens []AccessToken `dynamo:"tokens"`
}

func (AccessTokens) AddTokensToRequest

func (ats AccessTokens) AddTokensToRequest(r *http.Request) error

type Field

type Field struct {
	// Template is a gateway path
	Template URITemplate
	// Path is a  destination api path
	Path          URITemplate
	ForwardSchema string
	// Num represents the recent number of api calls.
	Num int
	// Max represents the maximum api call limit if Max's type is int.
	// If it is "-", the number of the api calls has no limit.
	Max interface{}
}

type FieldResult

type FieldResult struct {
	Field        Field
	ForwardURL   string
	TemplatePath string
}

type Fields

type Fields []Field

func (Fields) CheckAPILimit

func (f Fields) CheckAPILimit(path string) error

func (Fields) LookupTemplate

func (f Fields) LookupTemplate(path string) (*FieldResult, error)

type MyError

type MyError struct {
	Message string `json:"message"`
}

func (*MyError) Error

func (err *MyError) Error() string

type NotSupportedParamType

type NotSupportedParamType string

func (NotSupportedParamType) Error

func (nsp NotSupportedParamType) Error() string

type ParamType

type ParamType string

type URITemplate

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

func NewURITemplate

func NewURITemplate(path string) URITemplate

func (*URITemplate) AllocateParameter

func (u *URITemplate) AllocateParameter(m map[string]string) error

func (*URITemplate) JoinPath

func (u *URITemplate) JoinPath() string

func (*URITemplate) Match

func (u *URITemplate) Match(t URITemplate) (map[string]string, bool)

Jump to

Keyboard shortcuts

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