think

package
v0.3.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Html

func Html(s string) *context.Response

Text Create a new HTTP Response with HTML data

func Json

func Json(v interface{}) *context.Response

Json Create a new HTTP Response with JSON data

func Response

func Response(v interface{}) *context.Response

func Text

func Text(s string) *context.Response

Text Create a new HTTP Response with TEXT data

Types

type Application

type Application struct {
	Env    string
	Debug  bool
	Logger *log.Logger
	// contains filtered or unexported fields
}

Application the ThinkGo Application

func NewApplication

func NewApplication() *Application

NewApplication returns a new ThinkGo Application

func (*Application) GetRoute

func (a *Application) GetRoute() *router.Route

GetRoute Get the router of the application

func (*Application) GetView

func (a *Application) GetView() *view.View

GetView Get the view of the application

func (*Application) RegisterRoute

func (a *Application) RegisterRoute(r *router.Route)

RegisterRoute Register Route for Application

func (*Application) RegisterView

func (a *Application) RegisterView(v *view.View)

RegisterView Register View for Application

type Closure

type Closure func(req *context.Request) interface{}

Closure Anonymous function, Used in Middleware Handler

type Handler

type Handler interface {
	Process(request *context.Request, next Closure) interface{}
}

Handler Middleware Handler interface

func NewRecoverHandler

func NewRecoverHandler(app *Application) Handler

NewRecoverHandler The default NewRecoverHandler

func NewRouteHandler

func NewRouteHandler(app *Application) Handler

NewRouteHandler The default RouteHandler

func NewSessionHandler

func NewSessionHandler(app *Application) Handler

SessionHandler The default SessionHandler

type HandlerFunc

type HandlerFunc func(app *Application) Handler

HandlerFunc Handle the application.

type RecoverHandler

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

func (*RecoverHandler) Process

func (h *RecoverHandler) Process(req *context.Request, next Closure) (result interface{})

Process Process the request to a router and return the response.

type Req

type Req = context.Request

type Res

type Res = context.Response

type Route

type Route = router.Route

type RouteHandler

type RouteHandler struct {
	Route *router.Route
}

func (*RouteHandler) Process

func (h *RouteHandler) Process(request *context.Request, next Closure) interface{}

Process Process the request to a router and return the response.

type SessionHandler

type SessionHandler struct {
	Manager *session.Manager
	// contains filtered or unexported fields
}

func (*SessionHandler) Process

func (h *SessionHandler) Process(req *context.Request, next Closure) interface{}

Jump to

Keyboard shortcuts

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