groudon

package module
v2.3.1 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2021 License: GPL-3.0 Imports: 8 Imported by: 12

Documentation

Index

Constants

View Source
const (
	UUID_PATTERN       = `[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}`
	UUID_ONLY_PATTERN  = `^` + UUID_PATTERN + `$`
	EMAIL_PATTERN      = "[^@]+@[^@]+"
	EMAIL_ONLY_PATTERN = `^` + EMAIL_PATTERN + `$`
)

Variables

View Source
var (
	ErrInvalidTyping = fmt.Errorf("json body types do not match expected")
	ErrNilBody       = fmt.Errorf("body reader is nil")
)

Functions

func AddCodeResponse

func AddCodeResponse(code int, body map[string]interface{})

func AddHandler

func AddHandler(method, route string, handlerFunc func(*http.Request) (int, map[string]interface{}, error))

func AddMiddleware

func AddMiddleware(method, route string, handlerFunc func(*http.Request) (*http.Request, bool, int, map[string]interface{}, error))

func AllowOrigin added in v2.1.0

func AllowOrigin(origin string)

func Connect

func Connect(route string, handler func(*http.Request) (int, map[string]interface{}, error))

func Delete

func Delete(route string, handler func(*http.Request) (int, map[string]interface{}, error))

func Get

func Get(route string, handler func(*http.Request) (int, map[string]interface{}, error))
func Head(route string, handler func(*http.Request) (int, map[string]interface{}, error))

func OptionalBool

func OptionalBool(it interface{}) (ok bool, _ error)

func OptionalNumber

func OptionalNumber(it interface{}) (ok bool, _ error)

func OptionalString

func OptionalString(it interface{}) (ok bool, _ error)

func Options

func Options(route string, handler func(*http.Request) (int, map[string]interface{}, error))

func Patch

func Patch(route string, handler func(*http.Request) (int, map[string]interface{}, error))

func Post

func Post(route string, handler func(*http.Request) (int, map[string]interface{}, error))

func Put

func Put(route string, handler func(*http.Request) (int, map[string]interface{}, error))

func Route

func Route(writer http.ResponseWriter, request *http.Request)

func SerializeBody

func SerializeBody(reader io.Reader, target Fillable) (internal, external error)

func Trace

func Trace(route string, handler func(*http.Request) (int, map[string]interface{}, error))

func ValidBool

func ValidBool(it interface{}) (ok bool, _ error)

func ValidEmail

func ValidEmail(it interface{}) (ok bool, _ error)

func ValidNumber

func ValidNumber(it interface{}) (ok bool, _ error)

func ValidString

func ValidString(it interface{}) (ok bool, _ error)

func ValidStringSlice

func ValidStringSlice(it interface{}) (ok bool, _ error)

func ValidUUID

func ValidUUID(it interface{}) (ok bool, _ error)

Types

type Fillable

type Fillable interface {
	Validators() map[string]func(interface{}) (bool, error)
	Defaults() map[string]interface{}
}

type FuncHandler

type FuncHandler func(*http.Request) (int, map[string]interface{}, error)

type FuncMiddleware

type FuncMiddleware func(*http.Request) (*http.Request, bool, int, map[string]interface{}, error)

type Handler

type Handler struct {
	Func   FuncHandler
	Method string
	Route  *regexp.Regexp
}

type Middleware

type Middleware struct {
	Func   FuncMiddleware
	Method string
	Route  *regexp.Regexp
}

Jump to

Keyboard shortcuts

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