goring

package module
v0.0.1-alpha Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2020 License: GPL-2.0 Imports: 13 Imported by: 0

README

GORING

Introduction

A simple and lightweight MVC framework, and the use of native HTTP framework

Documentation

Index

Constants

View Source
const (
	PathPattern = iota
	UrlVarPattern
)

Variables

This section is empty.

Functions

func ConfigStatic

func ConfigStatic(pattern, prefix string, cache bool, suffixes ...string)

func ConfigView

func ConfigView(prefix, suffix string, cache bool)

func DefaultHandler

func DefaultHandler(handler Handler)

func FilterAfter

func FilterAfter(pattern string, filterHandler FilterHandler)

func FilterBefore

func FilterBefore(pattern string, filterHandler FilterHandler)

func Interceptor

func Interceptor(pattern string, interceptorHandler InterceptorHandler)

func RequestNotSupportedHandler

func RequestNotSupportedHandler(handler Handler)

func Route

func Route(pattern string, handler Handler)

func RouteDelete

func RouteDelete(pattern string, handler Handler)

func RouteGet

func RouteGet(pattern string, handler Handler)

func RoutePatch

func RoutePatch(pattern string, handler Handler)

func RoutePost

func RoutePost(pattern string, handler Handler)

func RoutePut

func RoutePut(pattern string, handler Handler)

func Run

func Run(option *ServerOption)

func RunWithFunc

func RunWithFunc(option *ServerOption, cFunc func())

func StaticDefaultHandler

func StaticDefaultHandler(staticHandler StaticHandler)

func WebRoot

func WebRoot(path string)

Types

type Context

type Context struct {
	Request       *http.Request
	RequestURI    string
	RequestURL    string
	RequestMethod string
	Writer        http.ResponseWriter
	Header        http.Header
	Cookies       map[string][]*http.Cookie
	Multipart     map[string][]*multipart.FileHeader
	Parameters    map[string][]string
}

func (*Context) GetParameter

func (context *Context) GetParameter(name, defaultValue string) string

func (*Context) GetParameters

func (context *Context) GetParameters(name string, defaultValue []string) []string

func (*Context) Handled

func (context *Context) Handled() *HandlerResult

func (*Context) RenderBinary

func (context *Context) RenderBinary(buffer []byte)

func (*Context) RenderImage

func (context *Context) RenderImage(buffer []byte)

func (*Context) RenderJSON

func (context *Context) RenderJSON(data interface{})

func (*Context) RenderText

func (context *Context) RenderText(text string)

func (*Context) RenderView

func (context *Context) RenderView(name string)

type FilterContext

type FilterContext struct {
	Request       *http.Request
	RequestURI    string
	RequestMethod string
	Header        http.Header
	Cookies       map[string][]*http.Cookie
	Parameters    map[string][]string
}

type FilterHandler

type FilterHandler func(FilterContext)

type Handler

type Handler func(context Context)

type HandlerResult

type HandlerResult struct {
	Handled bool
}

type InterceptorContext

type InterceptorContext struct {
	Context
}

type InterceptorHandler

type InterceptorHandler func(InterceptorContext) *HandlerResult

type InterceptorRouteMap

type InterceptorRouteMap map[string]interceptorRoute

type ServerOption

type ServerOption struct {
	Host               string
	Port               int
	TLS                bool
	TLSCertFile        string
	TLSKeyFile         string
	Multipart          bool
	MultipartMaxSize   int
	AutoParseForm      bool
	AutoParseMultipart bool
	StaticEnable       bool
	ViewEnable         bool
	FilterEnable       bool
	InterceptorEnable  bool
}

type StaticHandler

type StaticHandler func(context Context, resourcePath string) *HandlerResult

type StaticMap

type StaticMap map[string]*[]byte

type StaticSuffixMap

type StaticSuffixMap map[string]string

Jump to

Keyboard shortcuts

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