contracts

package
v1.1.14 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 License: BSD-3-Clause Imports: 9 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileServer

type FileServer interface {
	Path() string
	Prefix() string
}

type HTMLer added in v0.0.8

type HTMLer interface {
	HTML() []byte
}

type InputScanner added in v1.0.0

type InputScanner interface {
	ScanInput(data []byte) error
}

type InputSource

type InputSource interface {
	Get(key string) []byte
	File(key string) (UploadFile, error)
	GetValue(key ...string) InputValue
}

InputSource is general input source

type InputValue

type InputValue []byte

func (InputValue) Each

func (i InputValue) Each(h JsonHandler) error

func (InputValue) GetBool

func (i InputValue) GetBool() (bool, error)

func (InputValue) GetFloat

func (i InputValue) GetFloat() (float64, error)

func (InputValue) GetInt

func (i InputValue) GetInt() (int64, error)

func (InputValue) GetString

func (i InputValue) GetString() string

func (InputValue) GetUInt

func (i InputValue) GetUInt() (uint64, error)

func (InputValue) GetValue

func (i InputValue) GetValue(key string) (InputValue, jsonparser.ValueType, error)

func (InputValue) Unmarshal

func (i InputValue) Unmarshal(v interface{}) error

type JsonHandler

type JsonHandler func(value InputValue, dataType jsonparser.ValueType)

type RequestContract

type RequestContract interface {
	InputSource
	WithContainer
	WithRouteName
	WithPathInfo
	Context() context.Context
	Params() map[string][]byte
	Param(key string) string
	ParamBytes(key string) []byte
	ParamInt64(key string) (int64, error)
	ParamUint64(key string) (uint64, error)
	ParamInt(key string) (int, error)
	SetParams(params map[string][]byte)
	SetParamsSlice(paramsSlice [][]byte)
	ParamsSlice() [][]byte
	Accepts() []byte
	ExceptsJson() bool
	RequestWithJson() bool
	IsXmlHttpRequest() bool
	GetMethod() string
	GetInt64(key string) (int64, error)
	GetUint64(key string) (uint64, error)
	GetString(key string) string
	GetInt(key string) (int, error)
	GetClientIp() string
	RemoteAddr() string
	GetContent() []byte
	Unmarshal(to interface{}) error
	GetSignature() []byte
	Header(key string) []byte
	HeaderString(key string) string
	SetHeader(key string, value []byte) RequestContract
	SetHeaderString(key, value string) RequestContract
	Authorization() []byte
	BearerToken() ([]byte, error)
	ToString() string
}

RequestContract is interface of http request

type ResponseContract

type ResponseContract interface {
	Content() []byte
	Headers() map[string]string
	SetHeader(key string, value string) ResponseContract
	SetHeaders(headers map[string]string) ResponseContract
	Header(header string) string
	StatusCode() int
	SetStatusCode(code int) ResponseContract
	Handled() bool
}

type TemplateResponseContract

type TemplateResponseContract interface {
	Template() *template.Template
	TemplateData() interface{}
}

type UploadFile

type UploadFile interface {
	Save(dist string) error
	Open() (multipart.File, error)
	Close() error
	Filename() string
}

type WithContainer added in v0.0.10

type WithContainer interface {
	SetContainer(ioc container.Interface)
	GetContainer() container.Interface
}

type WithContentType added in v0.0.8

type WithContentType interface {
	ContentType() string
}

type WithHeaders

type WithHeaders interface {
	Headers() map[string]string
}

type WithPathInfo added in v1.1.2

type WithPathInfo interface {
	GetURL() *url.URL
	GetPathBytes() []byte
	GetUri() []byte
}

type WithRequestCookies added in v1.1.3

type WithRequestCookies interface {
	CookieByte(key string) []byte
}

type WithResponseCode added in v0.0.17

type WithResponseCode interface {
	ResponseCode() int
}

type WithResponseCookies added in v1.1.3

type WithResponseCookies interface {
	Cookies() []*http.Cookie
	SetCookie(cookie *http.Cookie)
	ClearCookies()
}

type WithRouteName added in v1.0.0

type WithRouteName interface {
	SetRouteName(name string)
	GetRouteName() string
}

type WithStatusCode

type WithStatusCode interface {
	StatusCode() int
}

Jump to

Keyboard shortcuts

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