model

package
v1.5.10 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2021 License: BSD-3-Clause Imports: 4 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionFunc

type ActionFunc func(
	session sessionModel.Session,
) (
	responseObject interface{},
	responseError error,
)

ActionFunc defines the action function to be called for route processing logic

type MiddlewareFunc

type MiddlewareFunc mux.MiddlewareFunc

MiddlewareFunc warps around mux.MiddlewareFunc, which receives an http.Handler and returns another http.Handler. Typically, the returned handler is a closure which does something with the http.ResponseWriter and http.Request passed to it, and then calls the handler passed as parameter to the MiddlewareFunc.

type ParameterType

type ParameterType string

ParameterType defines the type specification of a route parameter

const (
	ParameterTypeAnything ParameterType = `.*`
	ParameterTypeString   ParameterType = `\w+`
	ParameterTypeInteger  ParameterType = `\d+`
	ParameterTypeUUID     ParameterType = `[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}`
	ParameterTypeDate     ParameterType = `\d{4}-\d{2}-\d{2}`
	ParameterTypeTime     ParameterType = `\d{2}:\d{2}:\d{2}(?:\.\d+)?`
	ParameterTypeDateTime ParameterType = ParameterTypeDate + `T` + ParameterTypeTime + `(?:Z|[+-]\d{2}:\d{2})`
	ParameterTypeBoolean  ParameterType = `(?i)(?:true|false)`
	ParameterTypeFloat    ParameterType = `\d+(?:\.\d+)?`
)

These are constants for parameter types and their corresponding replacement RegExp statements

func (*ParameterType) Evaludate added in v1.2.5

func (pt *ParameterType) Evaludate(value string) (bool, error)

Evaludate evaluates the given value against the parameter type's defined regex expression and returns whether or not the regex matches

type Route

type Route struct {
	Endpoint   string
	Method     string
	Path       string
	Parameters map[string]ParameterType
	Queries    map[string]ParameterType
	ActionFunc ActionFunc
}

Route holds the registration information of a dynamic route hosting

type Static

type Static struct {
	Name       string
	PathPrefix string
	Handler    http.Handler
}

Static holds the registration information of a static content hosting

Jump to

Keyboard shortcuts

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