mxgo

package module
v0.0.0-...-0eef387 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2014 License: Apache-2.0 Imports: 16 Imported by: 3

README

MxGo

Another Golang fullstack web framework

Documentation

Index

Constants

View Source
const (
	MxGoVersion    = "0.0.1"
	MxGoServerName = "MxGo"
	MxGoImportPath = "github.com/menghx/mxgo"
)
View Source
const (
	FILTER_BEFORE_ACTION = iota
	FILTER_AFTER_ACTION
)

Variables

View Source
var (
	AppCfg = app.Cfg
)

Functions

func AddFilter

func AddFilter(filter ...Filter)

func EnableAdmin

func EnableAdmin(enabled bool)

func PathExist

func PathExist(name string) bool

func Router

func Router(uriPattern string, ctrl ControllerInterface, funcName string)

func Run

func Run()

func SecurityVerify

func SecurityVerify(request *httplib.Request, response *httplib.Response) bool

func WatchDoTask

func WatchDoTask(callback func(filePath string, event *fsnotify.FileEvent), filePaths ...string)

Types

type Action

type Action struct {
	CtrlName ControllerInterface
	FuncName string
}

func ErrorAction

func ErrorAction(errorCode int, errorMsg string) Action

func NewAction

func NewAction(ctrlName ControllerInterface, funcName string) Action

func (*Action) Execute

func (action *Action) Execute(mxGo *MxGoApp)

type AdminController

type AdminController struct {
	Controller
}

type BaseResult

type BaseResult struct {
	Request  *httplib.Request
	Response *httplib.Response
	Data     interface{}
}

type Controller

type Controller struct {
	Request  *httplib.Request
	Response *httplib.Response
	Data     interface{}
}

func (*Controller) Forward

func (ctrl *Controller) Forward() Result

func (*Controller) Json

func (ctrl *Controller) Json() Result

func (*Controller) Plain

func (ctrl *Controller) Plain() Result

func (*Controller) Redirect

func (ctrl *Controller) Redirect() Result

func (*Controller) Static

func (ctrl *Controller) Static() Result

func (*Controller) Template

func (ctrl *Controller) Template() Result

func (*Controller) XML

func (ctrl *Controller) XML() Result

type ControllerInterface

type ControllerInterface interface {
	Json() Result
	XML() Result
	Template() Result
	Redirect() Result
	Forward() Result
	Plain() Result
	Static() Result
}

type Cotter

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

func NewCotter

func NewCotter() *Cotter

type ErrorController

type ErrorController struct {
	Controller
}

func (ErrorController) Handle

func (errc ErrorController) Handle(errorCode string) Result

type Filter

type Filter interface {
	Execute(ctrl *Controller)
}

type FilterManager

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

func NewFilterManager

func NewFilterManager() *FilterManager

func (*FilterManager) AddFilter

func (fm *FilterManager) AddFilter(filters ...Filter)

func (*FilterManager) AfterAction

func (fm *FilterManager) AfterAction(ctrl *Controller)

func (*FilterManager) BeforeAction

func (fm *FilterManager) BeforeAction(ctrl *Controller)

type ForwardResult

type ForwardResult struct {
	*BaseResult
}

func (ForwardResult) Render

func (result ForwardResult) Render() error

type JSONResult

type JSONResult struct {
	*BaseResult
}

func (JSONResult) Render

func (result JSONResult) Render() error

type Model

type Model struct {
}

type MxGoApp

type MxGoApp struct {
	AppName string
	AppHome string

	StaticUri string
	Cfg       *config.Config
	Rm        *RouterManager
	Fm        *FilterManager
	// contains filtered or unexported fields
}

func NewMxGoApp

func NewMxGoApp() *MxGoApp

func (*MxGoApp) EnableAdmin

func (mxGo *MxGoApp) EnableAdmin(enable bool)

func (*MxGoApp) Run

func (mxGo *MxGoApp) Run()

func (*MxGoApp) ServeHTTP

func (mxGo *MxGoApp) ServeHTTP(rw http.ResponseWriter, req *http.Request)

type MxLogger

type MxLogger struct {
}

func NewMxLogger

func NewMxLogger() *MxLogger

func (MxLogger) Debug

func (mxLog MxLogger) Debug(strs ...interface{})

func (MxLogger) Error

func (mxLog MxLogger) Error(strs ...interface{})

func (MxLogger) Info

func (mxLog MxLogger) Info(strs ...interface{})

func (MxLogger) Trace

func (mxLog MxLogger) Trace(strs ...interface{})

type PlainResult

type PlainResult struct {
	*BaseResult
}

func (PlainResult) Render

func (result PlainResult) Render() error

type RedirectResult

type RedirectResult struct {
	*BaseResult
}

func (RedirectResult) Render

func (result RedirectResult) Render() error

type Result

type Result interface {
	Render() error
}

type RouterManager

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

func NewRouterManager

func NewRouterManager() *RouterManager

func (*RouterManager) FindAction

func (rm *RouterManager) FindAction(request *httplib.Request, response *httplib.Response) *Action

func (*RouterManager) Router

func (rm *RouterManager) Router(uriPattern string, ctrl ControllerInterface, funcName string)

type StaticController

type StaticController struct {
	Controller
}

func (StaticController) Handle

func (ctrl StaticController) Handle() Result

type StaticResult

type StaticResult struct {
	*BaseResult
}

func (StaticResult) Render

func (result StaticResult) Render() error

type TemplateResult

type TemplateResult struct {
	*BaseResult
	// contains filtered or unexported fields
}

func (TemplateResult) Render

func (result TemplateResult) Render() error

type XMLResult

type XMLResult struct {
	*BaseResult
}

func (XMLResult) Render

func (result XMLResult) Render() error

Directories

Path Synopsis
module
orm

Jump to

Keyboard shortcuts

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