methodfunc

package
v8.4.5+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2017 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FuncInfo

type FuncInfo struct {
	// Name is the map function name.
	Name string
	// Trailing is not empty when the Name contains
	// characters after the titled method, i.e
	// if Name = Get -> empty
	// if Name = GetLogin -> Login
	// if Name = GetUserPost -> UserPost
	Trailing string

	// The Type of the method, includes the receivers.
	Type reflect.Type

	// Index is the index of this function inside the controller type.
	Index int
	// HTTPMethod is the original http method that this
	// function should be registered to and serve.
	// i.e "GET","POST","PUT"...
	HTTPMethod string
}

FuncInfo is part of the `TController`, it contains the index for a specific http method, taken from user's controller struct.

type MethodFunc

type MethodFunc struct {
	FuncInfo
	// MethodCall fires the actual handler.
	// The "ctx" is the current context, helps us to get any path parameter's values.
	//
	// The "f" is the controller's function which is responsible
	// for that request for this http method.
	// That function can accept one parameter.
	//
	// The default callers (and the only one for now)
	// are pre-calculated by the framework.
	MethodCall func(ctx context.Context, f reflect.Value)
	RelPath    string
}

MethodFunc the handler function.

func Resolve

func Resolve(typ reflect.Type) (methodFuncs []MethodFunc)

Resolve returns all the method funcs necessary information and actions to perform the request.

Jump to

Keyboard shortcuts

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