Documentation ¶
Overview ¶
Package isokit provides common isomorphic functionality intended to be used in an Isomorphic Go web application.
Index ¶
- Constants
- Variables
- func BundleStaticAssets()
- func ClientRedirect(destinationURL string)
- func FormValue(fp *FormParams, key string) string
- func GopherjsScriptHandler(webAppRoot string) http.Handler
- func GopherjsScriptMapHandler(webAppRoot string) http.Handler
- func OperatingEnvironment() int
- func OperatingRuntime() int
- func Redirect(params *RedirectParams) error
- func ServerRedirect(w http.ResponseWriter, r *http.Request, destinationURL string)
- type BasicForm
- func (c *BasicForm) ClearErrors()
- func (c *BasicForm) DisplayErrors()
- func (c *BasicForm) Errors() map[string]string
- func (c *BasicForm) Fields() map[string]string
- func (c *BasicForm) FormParams() *FormParams
- func (c *BasicForm) GetFieldValue(key string) string
- func (c *BasicForm) PopulateFields()
- func (c *BasicForm) PrefillFields() []string
- func (c *BasicForm) RegenerateErrors()
- func (c *BasicForm) SetError(key string, message string)
- func (c *BasicForm) SetErrors(errors map[string]string)
- func (c *BasicForm) SetFields(fields map[string]string)
- func (c *BasicForm) SetFormParams(formParams *FormParams)
- func (c *BasicForm) SetPrefillFields(prefillFields []string)
- type Form
- type FormParams
- type Handler
- type HandlerFunc
- type OperatingDetails
- type RedirectParams
- type RenderParams
- type Route
- type RouteVarsKey
- type Router
- type Template
- func (t *Template) GetTemplateType() TemplateType
- func (t *Template) NameWithNamespace() string
- func (t *Template) NameWithPrefix() string
- func (t *Template) Render(params *RenderParams) error
- func (t *Template) RenderSimple(params interface{}) ([]byte, error)
- func (t *Template) RenderTemplateOnClient(params *RenderParams)
- func (t *Template) RenderTemplateOnServer(params *RenderParams)
- type TemplateBundle
- type TemplateSet
- func (t *TemplateSet) AddTemplateFile(namespace string, templateType TemplateType, templateName string, ...) error
- func (t *TemplateSet) Bundle(namespace string) (*TemplateBundle, error)
- func (t *TemplateSet) GatherTemplatesFromPackrBox(namespace string, box *packr.Box, path string) error
- func (t *TemplateSet) GatherTemplatesFromPath(namespace string, templatesPath string) error
- func (t *TemplateSet) GetTemplateBundleBinary() []byte
- func (t *TemplateSet) ImportTemplatesFromMap(namespace string, bundle *TemplateBundle) error
- func (t *TemplateSet) MakeAllAssociations() error
- func (t *TemplateSet) Members() map[string]*Template
- func (t *TemplateSet) PersistTemplateBundleToDisk(bundlePath string) error
- func (t *TemplateSet) Render(templateURI string, params *RenderParams) error
- func (t *TemplateSet) RenderSimple(templateURI string, params interface{}) ([]byte, error)
- func (t *TemplateSet) RestoreTemplateBundleFromBinary(bundle []byte) error
- func (t *TemplateSet) RestoreTemplateBundleFromDisk(bundlePath string) error
- type TemplateType
Constants ¶
View Source
const ( ServerEnvironment = iota WebBrowserEnvironment )
View Source
const ( GoRuntime = iota JSRuntime )
View Source
const ( RouteWithParamsPattern = `/([^/]*)` RouteOnlyPrefixPattern = `/` RouteSuffixPattern = `/?$` )
View Source
const ( PlacementAppendTo = iota PlacementReplaceInnerContents PlacementInsertBefore )
Variables ¶
View Source
var ( PrefixNamePartial = "partials/" PrefixNameLayout = "layouts/" PrefixNameView = "views/" PrefixNameComponent = "components/" PrefixNameDialog = "dialogs/" PrefixNameForm = "forms/" TemplateFileExtension = ".tmpl" ShouldBundleStaticAssets = true )
View Source
var CogStaticAssetsSearchPaths []string
View Source
var ShouldMinifyStaticAssets bool
View Source
var StaticAssetsPath string
View Source
var (
WebAppRoot = ""
)
Functions ¶
func BundleStaticAssets ¶
func BundleStaticAssets()
func ClientRedirect ¶
func ClientRedirect(destinationURL string)
ClientRedirect performs a redirect when operating on the client-side.
func FormValue ¶
func FormValue(fp *FormParams, key string) string
func GopherjsScriptHandler ¶
func OperatingEnvironment ¶
func OperatingEnvironment() int
func OperatingRuntime ¶
func OperatingRuntime() int
func Redirect ¶
func Redirect(params *RedirectParams) error
func ServerRedirect ¶
func ServerRedirect(w http.ResponseWriter, r *http.Request, destinationURL string)
ServerRedirect performs a redirect when operating on the server-side.
Types ¶
type BasicForm ¶
type BasicForm struct {
// contains filtered or unexported fields
}
func (*BasicForm) ClearErrors ¶
func (c *BasicForm) ClearErrors()
func (*BasicForm) DisplayErrors ¶
func (c *BasicForm) DisplayErrors()
func (*BasicForm) FormParams ¶
func (c *BasicForm) FormParams() *FormParams
func (*BasicForm) GetFieldValue ¶
func (*BasicForm) PopulateFields ¶
func (c *BasicForm) PopulateFields()
func (*BasicForm) PrefillFields ¶
func (*BasicForm) RegenerateErrors ¶
func (c *BasicForm) RegenerateErrors()
func (*BasicForm) SetFormParams ¶
func (c *BasicForm) SetFormParams(formParams *FormParams)
func (*BasicForm) SetPrefillFields ¶
type FormParams ¶
type FormParams struct { FormElement *dom.HTMLFormElement ResponseWriter http.ResponseWriter Request *http.Request UseFormFieldsForValidation bool FormFields map[string]string }
type HandlerFunc ¶
func (HandlerFunc) ServeRoute ¶
func (f HandlerFunc) ServeRoute(ctx context.Context)
type OperatingDetails ¶
type RedirectParams ¶
type RedirectParams struct { ResponseWriter http.ResponseWriter Request *http.Request URL string }
type RenderParams ¶
type Route ¶
type Route struct {
// contains filtered or unexported fields
}
func NewRoute ¶
func NewRoute(path string, handler HandlerFunc) *Route
type RouteVarsKey ¶
type RouteVarsKey string
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
func (*Router) HandleFunc ¶
func (r *Router) HandleFunc(path string, handler HandlerFunc) *Route
func (*Router) RegisterLinks ¶
type Template ¶
type Template struct { *template.Template Namespace string // contains filtered or unexported fields }
func (*Template) GetTemplateType ¶
func (t *Template) GetTemplateType() TemplateType
func (*Template) NameWithNamespace ¶
func (*Template) NameWithPrefix ¶
func (*Template) Render ¶
func (t *Template) Render(params *RenderParams) error
func (*Template) RenderSimple ¶
func (*Template) RenderTemplateOnClient ¶
func (t *Template) RenderTemplateOnClient(params *RenderParams)
func (*Template) RenderTemplateOnServer ¶
func (t *Template) RenderTemplateOnServer(params *RenderParams)
type TemplateBundle ¶
type TemplateBundle struct {
// contains filtered or unexported fields
}
func NewTemplateBundle ¶
func NewTemplateBundle(namespace string) *TemplateBundle
func (*TemplateBundle) Items ¶
func (t *TemplateBundle) Items() map[string]string
type TemplateSet ¶
type TemplateSet struct { Funcs template.FuncMap TemplateFilesPath string // contains filtered or unexported fields }
func NewTemplateSet ¶
func NewTemplateSet() *TemplateSet
func (*TemplateSet) AddTemplateFile ¶
func (t *TemplateSet) AddTemplateFile(namespace string, templateType TemplateType, templateName string, filename string) error
func (*TemplateSet) Bundle ¶
func (t *TemplateSet) Bundle(namespace string) (*TemplateBundle, error)
func (*TemplateSet) GatherTemplatesFromPackrBox ¶
func (*TemplateSet) GatherTemplatesFromPath ¶
func (t *TemplateSet) GatherTemplatesFromPath(namespace string, templatesPath string) error
func (*TemplateSet) GetTemplateBundleBinary ¶
func (t *TemplateSet) GetTemplateBundleBinary() []byte
func (*TemplateSet) ImportTemplatesFromMap ¶
func (t *TemplateSet) ImportTemplatesFromMap(namespace string, bundle *TemplateBundle) error
func (*TemplateSet) MakeAllAssociations ¶
func (t *TemplateSet) MakeAllAssociations() error
func (*TemplateSet) Members ¶
func (t *TemplateSet) Members() map[string]*Template
func (*TemplateSet) PersistTemplateBundleToDisk ¶
func (t *TemplateSet) PersistTemplateBundleToDisk(bundlePath string) error
func (*TemplateSet) Render ¶
func (t *TemplateSet) Render(templateURI string, params *RenderParams) error
func (*TemplateSet) RenderSimple ¶
func (t *TemplateSet) RenderSimple(templateURI string, params interface{}) ([]byte, error)
func (*TemplateSet) RestoreTemplateBundleFromBinary ¶
func (t *TemplateSet) RestoreTemplateBundleFromBinary(bundle []byte) error
func (*TemplateSet) RestoreTemplateBundleFromDisk ¶
func (t *TemplateSet) RestoreTemplateBundleFromDisk(bundlePath string) error
type TemplateType ¶
type TemplateType = int8
const ( TemplateRegular TemplateType = 0x00 TemplatePartial TemplateType = 0x01 TemplateView TemplateType = 0x02 TemplateComponent TemplateType = 0x03 TemplateDialog TemplateType = 0x04 TemplateForm TemplateType = 0x05 TemplateLayout TemplateType = 0x06 )
Click to show internal directories.
Click to hide internal directories.