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 FetchTemplateBundle(templateSetChannel chan *TemplateSet)
- func FetchTemplateBundleWithSuppliedFunctionMap(templateSetChannel chan *TemplateSet, funcMap template.FuncMap)
- 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 RegisterStaticAssetsSearchPath(path string)
- func ServerRedirect(w http.ResponseWriter, r *http.Request, destinationURL string)
- func StaticTemplateBundleFileExists() bool
- func TemplateBundleHandler(ts *TemplateSet) http.Handler
- 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
- type TemplateBundle
- type TemplateSet
- func (t *TemplateSet) AddTemplateFile(name, filename string, templateType int8) error
- func (t *TemplateSet) Bundle() *TemplateBundle
- func (t *TemplateSet) GatherCogTemplates(cogTemplatePath string, prefixName string, templateFileExtension string)
- func (t *TemplateSet) GatherTemplates()
- func (t *TemplateSet) ImportTemplatesFromMap(templateMap map[string]string) error
- func (t *TemplateSet) MakeAllAssociations() error
- func (t *TemplateSet) Members() map[string]*Template
- func (t *TemplateSet) PersistTemplateBundleToDisk() error
- func (t *TemplateSet) PersistTemplateBundleToTemplateSetBuffer() error
- func (t *TemplateSet) Render(templateName string, params *RenderParams)
- func (t *TemplateSet) RestoreTemplateBundleFromDisk() error
- func (t *TemplateSet) RestoreTemplateBundleFromTemplateSetBuffer() error
Constants ¶
View Source
const ( ServerEnvironment = iota WebBrowserEnvironment )
View Source
const ( GoRuntime = iota JSRuntime )
View Source
const ( RouteWithParamsPattern = `/([^/]*)` RouteOnlyPrefixPattern = `/` RouteSuffixPattern = `/?$` )
View Source
const ( TemplateRegular = iota TemplatePartial TemplateLayout )
View Source
const ( PlacementAppendTo = iota PlacementReplaceInnerContents PlacementInsertBefore )
Variables ¶
View Source
var ( PrefixNamePartial = "partials/" PrefixNameLayout = "layouts/" TemplateFileExtension = ".tmpl" TemplateFilesPath = "./templates" UseStaticTemplateBundleFile = false UseTemplateBundleFromBuffer = false StaticTemplateBundleFilePath = "" 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 FetchTemplateBundle ¶
func FetchTemplateBundle(templateSetChannel chan *TemplateSet)
func FetchTemplateBundleWithSuppliedFunctionMap ¶
func FetchTemplateBundleWithSuppliedFunctionMap(templateSetChannel chan *TemplateSet, funcMap template.FuncMap)
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 RegisterStaticAssetsSearchPath ¶
func RegisterStaticAssetsSearchPath(path string)
func ServerRedirect ¶
func ServerRedirect(w http.ResponseWriter, r *http.Request, destinationURL string)
ServerRedirect performs a redirect when operating on the server-side.
func StaticTemplateBundleFileExists ¶
func StaticTemplateBundleFileExists() bool
func TemplateBundleHandler ¶
func TemplateBundleHandler(ts *TemplateSet) http.Handler
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 ¶
func (*Template) GetTemplateType ¶
func (*Template) NameWithPrefix ¶
func (*Template) Render ¶
func (t *Template) Render(params *RenderParams) error
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() *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(name, filename string, templateType int8) error
func (*TemplateSet) Bundle ¶
func (t *TemplateSet) Bundle() *TemplateBundle
func (*TemplateSet) GatherCogTemplates ¶
func (t *TemplateSet) GatherCogTemplates(cogTemplatePath string, prefixName string, templateFileExtension string)
func (*TemplateSet) GatherTemplates ¶
func (t *TemplateSet) GatherTemplates()
func (*TemplateSet) ImportTemplatesFromMap ¶
func (t *TemplateSet) ImportTemplatesFromMap(templateMap map[string]string) 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() error
func (*TemplateSet) PersistTemplateBundleToTemplateSetBuffer ¶
func (t *TemplateSet) PersistTemplateBundleToTemplateSetBuffer() error
func (*TemplateSet) Render ¶
func (t *TemplateSet) Render(templateName string, params *RenderParams)
func (*TemplateSet) RestoreTemplateBundleFromDisk ¶
func (t *TemplateSet) RestoreTemplateBundleFromDisk() error
func (*TemplateSet) RestoreTemplateBundleFromTemplateSetBuffer ¶
func (t *TemplateSet) RestoreTemplateBundleFromTemplateSetBuffer() error
Click to show internal directories.
Click to hide internal directories.