controller

package
v0.0.0-...-82e7740 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2019 License: MIT Imports: 22 Imported by: 6

README

web-controller GoDoc

controller library for Go

Installation

go get gopkg.in/goyy/goyy.v0/web/controller

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApiAdd

func ApiAdd(project, module string) string

ApiAdd gets the api path with the name add.

func ApiBox

func ApiBox(project, module string) string

ApiBox gets the api path with the name box.

func ApiBy

func ApiBy(project, module, name string) string

ApiBy gets api path by name.

func ApiDisable

func ApiDisable(project, module string) string

ApiDisable gets the api path with the name disable.

func ApiEdit

func ApiEdit(project, module string) string

ApiEdit gets the api path with the name edit.

func ApiExport

func ApiExport(project, module string) string

ApiExport gets the api path with the name export.

func ApiIndex

func ApiIndex(project, module string) string

ApiIndex gets the api path with the name index.

func ApiModule

func ApiModule(project, module string) string

ApiModule gets the api path from project and module.

func ApiSave

func ApiSave(project, module string) string

ApiSave gets the api path with the name save.

func ApiShow

func ApiShow(project, module string) string

ApiShow gets the api path with the name show.

func ApiTree

func ApiTree(project, module string) string

ApiTree gets the api path with the name tree.

func PathAdd

func PathAdd(project, module string) string

PathAdd gets the path with the name add.

func PathBox

func PathBox(project, module string) string

PathBox gets the path with the name box.

func PathBy

func PathBy(project, module, name string) string

PathBy gets path by name.

func PathDisable

func PathDisable(project, module string) string

PathDisable gets the path with the name disable.

func PathEdit

func PathEdit(project, module string) string

PathEdit gets the path with the name edit.

func PathExport

func PathExport(project, module string) string

PathExport gets the path with the name export.

func PathIndex

func PathIndex(project, module string) string

PathIndex gets the path with the name index.

func PathModule

func PathModule(project, module string) string

PathModule gets the path from project and module.

func PathSave

func PathSave(project, module string) string

PathSave gets the path with the name save.

func PathShow

func PathShow(project, module string) string

PathShow gets the path with the name show.

func PathTree

func PathTree(project, module string) string

PathTree gets the path with the name tree.

func Permit

func Permit(id string, profiles ...string) *xtype.Permission

Permit gets permission by id and profiles.

func PermitAdd

func PermitAdd(project, module string, profiles ...string) *xtype.Permission

PermitAdd obtain the add type permission from the profiles.

func PermitBy

func PermitBy(project, module, name string, profiles ...string) *xtype.Permission

PermitBy gets permission by name and profiles.

func PermitDisable

func PermitDisable(project, module string, profiles ...string) *xtype.Permission

PermitDisable obtain the disable type permission from the profiles.

func PermitEdit

func PermitEdit(project, module string, profiles ...string) *xtype.Permission

PermitEdit obtain the edit type permission from the profiles.

func PermitExport

func PermitExport(project, module string, profiles ...string) *xtype.Permission

PermitExport obtain the export type permission from the profiles.

func PermitView

func PermitView(project, module string, profiles ...string) *xtype.Permission

PermitView obtain the view type permission from the profiles.

func SetLocale

func SetLocale(locale string)

SetLocale set the i18n locale.

func SetPriority

func SetPriority(value int)

SetPriority set the priority of the logger.

func TmplBy

func TmplBy(project, module, name string) string

TmplBy gets template by name.

func TmplDefault

func TmplDefault(project, module string) string

TmplDefault gets the template with the default name.

func TmplForm

func TmplForm(project, module string) string

TmplForm gets the template with the name form.

func TmplIndex

func TmplIndex(project, module string) string

TmplIndex gets the template with the name index.

func TmplList

func TmplList(project, module string) string

TmplList gets the template with the name list.

Types

type Controller

type Controller struct {
	Settings
	Mgr service.Service
	// contains filtered or unexported fields
}

Controller controller.Controller.

func (*Controller) Add

func (me *Controller) Add(c xhttp.Context)

Add the form page for adding is displayed.

func (*Controller) Box

func (me *Controller) Box(c xhttp.Context)

Box gets a list of box types and converts them to JSON.

func (*Controller) Disable

func (me *Controller) Disable(c xhttp.Context)

Disable tsed to delete the records corresponding to the form, but do not automatically commit the transaction.

func (*Controller) DisableAndTx

func (me *Controller) DisableAndTx(c xhttp.Context)

DisableAndTx used to delete the record corresponding to the form, but automatically commit the transaction.

func (*Controller) Edit

func (me *Controller) Edit(c xhttp.Context)

Edit the form page for editing is displayed.

func (*Controller) Error

func (me *Controller) Error(c xhttp.Context, err error)

func (*Controller) ErrorJSON

func (me *Controller) ErrorJSON(c xhttp.Context, err error)

ErrorJSON error to JSON.

func (*Controller) Export

func (me *Controller) Export(c xhttp.Context, mgr service.Service, pre func(c xhttp.Context) error, post func(c xhttp.Context, r entity.Interfaces) error) (out entity.Interfaces, err error)

func (*Controller) Fault

func (me *Controller) Fault(c xhttp.Context, state string, data interface{}) map[string]interface{}

Fault constructs a http.ResponseWriter parameter of the failure type.

func (*Controller) FaultMessage

func (me *Controller) FaultMessage(c xhttp.Context, msg, state string) map[string]interface{}

FaultMessage constructs a http.ResponseWriter parameter of the failure type.

func (*Controller) FaultMsg

func (me *Controller) FaultMsg(c xhttp.Context, msg, state string, data interface{}) map[string]interface{}

FaultMsg constructs a http.ResponseWriter parameter of the failure type.

func (*Controller) FaultResult

func (me *Controller) FaultResult(c xhttp.Context, state string, r *result.Result) map[string]interface{}

FaultResult constructs a http.ResponseWriter parameter of the failure type.

func (*Controller) FaultStatus

func (me *Controller) FaultStatus(c xhttp.Context, code int, state string, data interface{}) map[string]interface{}

FaultStatus constructs a http.ResponseWriter parameter of the failure type.

func (*Controller) FaultStatusMsg

func (me *Controller) FaultStatusMsg(c xhttp.Context, code int, msg, state string, data interface{}) map[string]interface{}

FaultStatusMsg constructs a http.ResponseWriter parameter of the failure type.

func (*Controller) FaultStatusMsgToken

func (me *Controller) FaultStatusMsgToken(c xhttp.Context, code int, msg, token, state string, data interface{}) map[string]interface{}

FaultStatusMsgToken constructs a http.ResponseWriter parameter of the failure type.

func (*Controller) FaultToken

func (me *Controller) FaultToken(c xhttp.Context, token, state string, data interface{}) map[string]interface{}

FaultToken constructs a http.ResponseWriter parameter of the failure type.

func (*Controller) Index

func (me *Controller) Index(c xhttp.Context)

Index displays the list of pages.

func (*Controller) Page

func (me *Controller) Page(c xhttp.Context, mgr service.Service) (out *result.Page, err error)

func (*Controller) PathAdd

func (me *Controller) PathAdd() string

PathAdd gets the path with the name add.

func (*Controller) PathBox

func (me *Controller) PathBox() string

PathBox gets the path with the name box.

func (*Controller) PathBy

func (me *Controller) PathBy(name string) string

PathBy gets path by name.

func (*Controller) PathDisable

func (me *Controller) PathDisable() string

PathDisable gets the path with the name disable.

func (*Controller) PathEdit

func (me *Controller) PathEdit() string

PathEdit gets the path with the name edit.

func (*Controller) PathIndex

func (me *Controller) PathIndex() string

PathIndex gets the path with the name index.

func (*Controller) PathSave

func (me *Controller) PathSave() string

PathSave gets the path with the name save.

func (*Controller) PathShow

func (me *Controller) PathShow() string

PathShow gets the path with the name show.

func (*Controller) PathTree

func (me *Controller) PathTree() string

PathTree gets the path with the name tree.

func (*Controller) Permit

func (me *Controller) Permit(id string, profiles ...string) *xtype.Permission

Permit gets permission by id and profiles.

func (*Controller) PermitAdd

func (me *Controller) PermitAdd(profiles ...string) *xtype.Permission

PermitAdd obtain the add type permission from the profiles.

func (*Controller) PermitBy

func (me *Controller) PermitBy(name string, profiles ...string) *xtype.Permission

PermitBy gets permission by name and profiles.

func (*Controller) PermitDisable

func (me *Controller) PermitDisable(profiles ...string) *xtype.Permission

PermitDisable obtain the disable type permission from the profiles.

func (*Controller) PermitEdit

func (me *Controller) PermitEdit(profiles ...string) *xtype.Permission

PermitEdit obtain the edit type permission from the profiles.

func (*Controller) PermitView

func (me *Controller) PermitView(profiles ...string) *xtype.Permission

PermitView obtain the view type permission from the profiles.

func (*Controller) Result

func (me *Controller) Result(c xhttp.Context, r result.Http) map[string]interface{}

Result build the http.ResponseWriter parameters.

func (*Controller) Save

func (me *Controller) Save(c xhttp.Context)

Save used to save the form, but do not automatically commit the transaction.

func (*Controller) SaveAndTx

func (me *Controller) SaveAndTx(c xhttp.Context)

SaveAndTx used to save the form, but automatically commit the transaction.

func (*Controller) SetSqlOfExport

func (me *Controller) SetSqlOfExport(sql string)

func (*Controller) SetSqlOfIndex

func (me *Controller) SetSqlOfIndex(sql string)

func (*Controller) Show

func (me *Controller) Show(c xhttp.Context)

Show displays a non-editable form page.

func (*Controller) Success

func (me *Controller) Success(c xhttp.Context, state string, data interface{}) map[string]interface{}

Success constructs a http.ResponseWriter parameter of the successful type.

func (*Controller) SuccessMessage

func (me *Controller) SuccessMessage(c xhttp.Context, msg, state string) map[string]interface{}

SuccessMessage constructs a http.ResponseWriter parameter of the successful type.

func (*Controller) SuccessMsg

func (me *Controller) SuccessMsg(c xhttp.Context, msg, state string, data interface{}) map[string]interface{}

SuccessMsg constructs a http.ResponseWriter parameter of the successful type.

func (*Controller) SuccessResult

func (me *Controller) SuccessResult(c xhttp.Context, state string, r *result.Result) map[string]interface{}

SuccessResult constructs a http.ResponseWriter parameter of the successful type.

func (*Controller) SuccessStatus

func (me *Controller) SuccessStatus(c xhttp.Context, code int, state string, data interface{}) map[string]interface{}

SuccessStatus constructs a http.ResponseWriter parameter of the successful type.

func (*Controller) SuccessStatusMsg

func (me *Controller) SuccessStatusMsg(c xhttp.Context, code int, msg, state string, data interface{}) map[string]interface{}

SuccessStatusMsg constructs a http.ResponseWriter parameter of the successful type.

func (*Controller) SuccessStatusMsgToken

func (me *Controller) SuccessStatusMsgToken(c xhttp.Context, code int, msg, token, state string, data interface{}) map[string]interface{}

SuccessStatusMsgToken constructs a http.ResponseWriter parameter of the successful type.

func (*Controller) SuccessToken

func (me *Controller) SuccessToken(c xhttp.Context, token, state string, data interface{}) map[string]interface{}

SuccessToken constructs a http.ResponseWriter parameter of the successful type.

func (*Controller) TmplBy

func (me *Controller) TmplBy(name string) string

TmplBy gets template by name.

func (*Controller) TmplDefault

func (me *Controller) TmplDefault() string

TmplDefault gets the template with the default name.

func (*Controller) TmplForm

func (me *Controller) TmplForm() string

TmplForm gets the template with the name form.

func (*Controller) TmplIndex

func (me *Controller) TmplIndex() string

TmplIndex gets the template with the name index.

func (*Controller) TmplList

func (me *Controller) TmplList() string

TmplList gets the template with the name list.

type JSONController

type JSONController struct {
	Settings
	Mgr service.Service
	// contains filtered or unexported fields
}

JSONController controller.JSONController.

func (*JSONController) Add

func (me *JSONController) Add(c xhttp.Context)

Add gets the form data for the JSON type.

func (*JSONController) ApiAdd

func (me *JSONController) ApiAdd() string

ApiAdd gets the api path with the name add.

func (*JSONController) ApiBox

func (me *JSONController) ApiBox() string

ApiBox gets the api path with the name box.

func (*JSONController) ApiBy

func (me *JSONController) ApiBy(name string) string

ApiBy gets api path by name.

func (*JSONController) ApiDisable

func (me *JSONController) ApiDisable() string

ApiDisable gets the api path with the name disable.

func (*JSONController) ApiEdit

func (me *JSONController) ApiEdit() string

ApiEdit gets the api path with the name edit.

func (*JSONController) ApiExport

func (me *JSONController) ApiExport() string

ApiExport gets the api path with the name export.

func (*JSONController) ApiIndex

func (me *JSONController) ApiIndex() string

ApiIndex gets the api path with the name index.

func (*JSONController) ApiSave

func (me *JSONController) ApiSave() string

ApiSave gets the api path with the name save.

func (*JSONController) ApiShow

func (me *JSONController) ApiShow() string

ApiShow gets the api path with the name show.

func (*JSONController) ApiTree

func (me *JSONController) ApiTree() string

ApiTree gets the api path with the name tree.

func (*JSONController) Box

func (me *JSONController) Box(c xhttp.Context)

Box gets a list of box types and converts them to JSON.

func (*JSONController) Disable

func (me *JSONController) Disable(c xhttp.Context)

Disable delete the data, but does not automatically commit the transaction.

func (*JSONController) DisableAndTx

func (me *JSONController) DisableAndTx(c xhttp.Context)

DisableAndTx delete the data, but automatically commits the transaction.

func (*JSONController) Edit

func (me *JSONController) Edit(c xhttp.Context)

Edit gets the form data for the JSON type.

func (*JSONController) Error

func (me *JSONController) Error(c xhttp.Context, err error)

func (*JSONController) Export

func (me *JSONController) Export(c xhttp.Context)

Export export for the excel.

func (*JSONController) Fault

func (me *JSONController) Fault(c xhttp.Context, data interface{}) result.Http

Fault constructs a http.ResponseWriter parameter of the failure type.

func (*JSONController) FaultLogin

func (me *JSONController) FaultLogin(c xhttp.Context) result.Http

FaultLogin constructs a http.ResponseWriter parameter of the failure type.

func (*JSONController) FaultMessage

func (me *JSONController) FaultMessage(c xhttp.Context, msg string) result.Http

FaultMessage constructs a http.ResponseWriter parameter of the failure type.

func (*JSONController) FaultMsg

func (me *JSONController) FaultMsg(c xhttp.Context, msg string, data interface{}) result.Http

FaultMsg constructs a http.ResponseWriter parameter of the failure type.

func (*JSONController) FaultResult

func (me *JSONController) FaultResult(c xhttp.Context, r *result.Result) result.Http

FaultResult constructs a http.ResponseWriter parameter of the failure type.

func (*JSONController) FaultState

func (me *JSONController) FaultState(c xhttp.Context, state string, data interface{}) result.Http

FaultState constructs a http.ResponseWriter parameter of the failure type.

func (*JSONController) FaultStatus

func (me *JSONController) FaultStatus(c xhttp.Context, code int, data interface{}) result.Http

FaultStatus constructs a http.ResponseWriter parameter of the failure type.

func (*JSONController) FaultStatusMsg

func (me *JSONController) FaultStatusMsg(c xhttp.Context, code int, msg string, data interface{}) result.Http

FaultStatusMsg constructs a http.ResponseWriter parameter of the failure type.

func (*JSONController) FaultStatusMsgToken

func (me *JSONController) FaultStatusMsgToken(c xhttp.Context, code int, msg, token string, data interface{}) result.Http

FaultStatusMsgToken constructs a http.ResponseWriter parameter of the failure type.

func (*JSONController) FaultToken

func (me *JSONController) FaultToken(c xhttp.Context, token string, data interface{}) result.Http

FaultToken constructs a http.ResponseWriter parameter of the failure type.

func (*JSONController) Index

func (me *JSONController) Index(c xhttp.Context)

Index gets the list data for the JSON type.

func (*JSONController) Page

func (me *JSONController) Page(c xhttp.Context, mgr service.Service) (out *result.Page, err error)

func (*JSONController) Permit

func (me *JSONController) Permit(id string, profiles ...string) *xtype.Permission

Permit gets permission by id and profiles.

func (*JSONController) PermitAdd

func (me *JSONController) PermitAdd(profiles ...string) *xtype.Permission

PermitAdd obtain the add type permission from the profiles.

func (*JSONController) PermitBy

func (me *JSONController) PermitBy(name string, profiles ...string) *xtype.Permission

PermitBy gets permission by name and profiles.

func (*JSONController) PermitDisable

func (me *JSONController) PermitDisable(profiles ...string) *xtype.Permission

PermitDisable obtain the disable type permission from the profiles.

func (*JSONController) PermitEdit

func (me *JSONController) PermitEdit(profiles ...string) *xtype.Permission

PermitEdit obtain the edit type permission from the profiles.

func (*JSONController) PermitExport

func (me *JSONController) PermitExport(profiles ...string) *xtype.Permission

PermitExport obtain the export type permission from the profiles.

func (*JSONController) PermitView

func (me *JSONController) PermitView(profiles ...string) *xtype.Permission

PermitView obtain the view type permission from the profiles.

func (*JSONController) Save

func (me *JSONController) Save(c xhttp.Context)

Save saves the data, but does not automatically commit the transaction.

func (*JSONController) SaveAndTx

func (me *JSONController) SaveAndTx(c xhttp.Context)

SaveAndTx saves the data, but automatically commits the transaction.

func (*JSONController) SetSqlOfExport

func (me *JSONController) SetSqlOfExport(sql string)

func (*JSONController) SetSqlOfIndex

func (me *JSONController) SetSqlOfIndex(sql string)

func (*JSONController) Show

func (me *JSONController) Show(c xhttp.Context)

Show gets the form data for the JSON type.

func (*JSONController) Success

func (me *JSONController) Success(c xhttp.Context, data interface{}) result.Http

Success constructs a http.ResponseWriter parameter of the successful type.

func (*JSONController) SuccessMessage

func (me *JSONController) SuccessMessage(c xhttp.Context, msg string) result.Http

SuccessMessage constructs a http.ResponseWriter parameter of the successful type.

func (*JSONController) SuccessMsg

func (me *JSONController) SuccessMsg(c xhttp.Context, msg string, data interface{}) result.Http

SuccessMsg constructs a http.ResponseWriter parameter of the successful type.

func (*JSONController) SuccessResult

func (me *JSONController) SuccessResult(c xhttp.Context, r *result.Result) result.Http

SuccessResult constructs a http.ResponseWriter parameter of the successful type.

func (*JSONController) SuccessState

func (me *JSONController) SuccessState(c xhttp.Context, state string, data interface{}) result.Http

SuccessState constructs a http.ResponseWriter parameter of the successful type.

func (*JSONController) SuccessStatus

func (me *JSONController) SuccessStatus(c xhttp.Context, code int, data interface{}) result.Http

SuccessStatus constructs a http.ResponseWriter parameter of the successful type.

func (*JSONController) SuccessStatusMsg

func (me *JSONController) SuccessStatusMsg(c xhttp.Context, code int, msg string, data interface{}) result.Http

SuccessStatusMsg constructs a http.ResponseWriter parameter of the successful type.

func (*JSONController) SuccessStatusMsgToken

func (me *JSONController) SuccessStatusMsgToken(c xhttp.Context, code int, msg, token string, data interface{}) result.Http

SuccessStatusMsgToken constructs a http.ResponseWriter parameter of the successful type.

func (*JSONController) SuccessToken

func (me *JSONController) SuccessToken(c xhttp.Context, token string, data interface{}) result.Http

SuccessToken constructs a http.ResponseWriter parameter of the successful type.

type JSONTreeController

type JSONTreeController struct {
	JSONController
	// contains filtered or unexported fields
}

JSONTreeController controller.JSONTreeController.

func (*JSONTreeController) Breadcrumb

func (me *JSONTreeController) Breadcrumb(c xhttp.Context, mgr service.Service) ([]xtype.Box, error)

func (*JSONTreeController) Disable

func (me *JSONTreeController) Disable(c xhttp.Context)

Disable delete the data, but does not automatically commit the transaction.

func (*JSONTreeController) DisableAndTx

func (me *JSONTreeController) DisableAndTx(c xhttp.Context)

DisableAndTx delete the data, but automatically commits the transaction.

func (*JSONTreeController) Index

func (me *JSONTreeController) Index(c xhttp.Context)

Index gets the list data for the JSON type.

func (*JSONTreeController) Page

func (me *JSONTreeController) Page(c xhttp.Context, mgr service.Service) (out *result.Page, err error)

func (*JSONTreeController) Save

func (me *JSONTreeController) Save(c xhttp.Context)

Save saves the data, but does not automatically commit the transaction.

func (*JSONTreeController) SaveAndTx

func (me *JSONTreeController) SaveAndTx(c xhttp.Context)

SaveAndTx saves the data, but automatically commits the transaction.

func (*JSONTreeController) SetSqlOfExport

func (me *JSONTreeController) SetSqlOfExport(sql string)

func (*JSONTreeController) SetSqlOfIndex

func (me *JSONTreeController) SetSqlOfIndex(sql string)

func (*JSONTreeController) Tree

func (me *JSONTreeController) Tree(c xhttp.Context)

Tree gets a list of tree types and converts them to JSON.

type PreError

type PreError struct {
	Code    int
	Message string
}

PreError controller.PreError.

func (*PreError) Error

func (me *PreError) Error() string

type Settings

type Settings struct {
	Project string
	Module  string
	Title   string
	Sifts   string
}

Settings controller.Settings.

type TreeController

type TreeController struct {
	Controller
	// contains filtered or unexported fields
}

TreeController controller.TreeController.

func (*TreeController) Breadcrumb

func (me *TreeController) Breadcrumb(c xhttp.Context, mgr service.Service) ([]xtype.Box, error)

func (*TreeController) Disable

func (me *TreeController) Disable(c xhttp.Context)

Disable tsed to delete the records corresponding to the form, but do not automatically commit the transaction.

func (*TreeController) DisableAndTx

func (me *TreeController) DisableAndTx(c xhttp.Context)

DisableAndTx used to delete the record corresponding to the form, but automatically commit the transaction.

func (*TreeController) Export

func (me *TreeController) Export(c xhttp.Context, mgr service.Service, pre func(c xhttp.Context) error, post func(c xhttp.Context, r entity.Interfaces) error) (out entity.Interfaces, err error)

func (*TreeController) Index

func (me *TreeController) Index(c xhttp.Context)

Index displays the list of pages.

func (*TreeController) Page

func (me *TreeController) Page(c xhttp.Context, mgr service.Service) (out *result.Page, err error)

func (*TreeController) Save

func (me *TreeController) Save(c xhttp.Context)

Save used to save the form, but do not automatically commit the transaction.

func (*TreeController) SaveAndTx

func (me *TreeController) SaveAndTx(c xhttp.Context)

SaveAndTx used to save the form, but automatically commit the transaction.

func (*TreeController) SetSqlOfExport

func (me *TreeController) SetSqlOfExport(sql string)

func (*TreeController) SetSqlOfIndex

func (me *TreeController) SetSqlOfIndex(sql string)

func (*TreeController) Tree

func (me *TreeController) Tree(c xhttp.Context)

Tree gets a list of tree types and converts them to JSON.

Jump to

Keyboard shortcuts

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