Documentation ¶
Index ¶
- func FragmentConfigGetName() string
- func HeadConfigGetName() string
- func HxApiConfigGetName() string
- func HyperMediaConfigGetName() string
- func SetHeadersFromHxRequest(config *HxResponse, writer http.ResponseWriter)
- func SortCompositeErrors(errors []error, sortedKeys []string) []error
- func TemplateConfigGetName() string
- func TreeRendererConfigGetName() string
- type FieldConfig
- type FragmentConfig
- type FragmentRenderer
- type HeadConfig
- type HeadRenderer
- type HxApiConfig
- type HxApiRenderer
- func (pr *HxApiRenderer) ExecuteQuery(config *HxApiConfig) error
- func (pr *HxApiRenderer) ParseRequestData(config *HxApiConfig) error
- func (pr *HxApiRenderer) ParseTemplate(config *HxApiConfig) error
- func (pr *HxApiRenderer) Render(instance interface{}) (string, []error)
- func (r *HxApiRenderer) Types() []string
- func (pr *HxApiRenderer) ValidateRequestData(config *HxApiConfig) error
- type HxApiRendererInterface
- type HxDataContainer
- type HxFormData
- type HxQuery
- type HxQueryConfig
- type HxRequest
- type HxResponse
- type HyperMediaConfig
- type HyperMediaRenderer
- type ModelConfig
- type TemplateConfig
- type TemplateRenderer
- type TreeConfig
- type TreeRenderer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FragmentConfigGetName ¶
func FragmentConfigGetName() string
FragmentConfigGetName returns the HyperBricks type associated with the FragmentConfig.
func HeadConfigGetName ¶
func HeadConfigGetName() string
HeadConfigGetName returns the HyperBricks type associated with the HeadConfig.
func HxApiConfigGetName ¶
func HxApiConfigGetName() string
HxApiConfigGetName returns the HyperBricks type associated with the HxApiConfig.
func HyperMediaConfigGetName ¶
func HyperMediaConfigGetName() string
HyperMediaConfigGetName returns the HyperBricks type associated with the HyperMediaConfig.
func SetHeadersFromHxRequest ¶
func SetHeadersFromHxRequest(config *HxResponse, writer http.ResponseWriter)
func SortCompositeErrors ¶
func TemplateConfigGetName ¶
func TemplateConfigGetName() string
func TreeRendererConfigGetName ¶
func TreeRendererConfigGetName() string
Types ¶
type FieldConfig ¶
type FieldConfig struct { Type string `mapstructure:"type" description:"The type of the field (string, float64, etc.)"` // The type of the field (string, float64, etc.) Validate string `mapstructure:"validate" description:"List of fields that are required"` // List of fields that are required }
FieldConfig holds the configuration for each field in the model
type FragmentConfig ¶
type FragmentConfig struct { shared.Composite `mapstructure:",squash"` HxResponse `mapstructure:"response"` HxResponseWriter http.ResponseWriter `mapstructure:"hx_response"` ContentType string `mapstructure:"@type" category:"renderer" description:"HyperBricks type: PAGE" example:"{!{endpoint.hyperbricks}}"` Title string `mapstructure:"title" description:"The title of the endpoint" example:"{!{endpoint-title.hyperbricks}}"` Route string `` /* 129-byte string literal not displayed */ Section string `mapstructure:"section" description:"The section the endpoint belongs to" example:"{!{endpoint-section.hyperbricks}}"` Items map[string]interface{} `mapstructure:",remain"` BodyTag string `` /* 249-byte string literal not displayed */ Enclose string `mapstructure:"enclose" description:"Wrapping property for the endpoint" example:"{!{endpoint-wrap.hyperbricks}}"` Favicon string `mapstructure:"favicon" description:"Path to the favicon for the endpoint" example:"{!{endpoint-favicon.hyperbricks}}"` Template map[string]interface{} `` /* 133-byte string literal not displayed */ File string `mapstructure:"@file"` IsStatic bool `mapstructure:"isstatic"` Static string `mapstructure:"static" description:"Static file path associated with the endpoint" example:"{!{endpoint-static.hyperbricks}}"` Index int `` /* 194-byte string literal not displayed */ Meta map[string]string `` /* 135-byte string literal not displayed */ Doctype string `mapstructure:"doctype" description:"Doctype for the HTML document" example:"{!{endpoint-doctype.hyperbricks}}"` HtmlTag string `mapstructure:"htmltag" description:"The opening HTML tag with attributes" example:"{!{endpoint-htmltag.hyperbricks}}"` Head map[string]interface{} `` /* 126-byte string literal not displayed */ Css []string `mapstructure:"css" description:"CSS files associated with the endpoint" example:"{!{endpoint-css.hyperbricks}}"` Js []string `mapstructure:"js" description:"JavaScript files associated with the endpoint" example:"{!{endpoint-js.hyperbricks}}"` }
FragmentConfig represents configuration for a single endpoint.
func (*FragmentConfig) Validate ¶
func (endpoint *FragmentConfig) Validate() []error
Validate ensures that the endpoint has valid data.
type FragmentRenderer ¶
type FragmentRenderer struct {
renderer.CompositeRenderer
}
FragmentRenderer handles rendering of PAGE content.
func (*FragmentRenderer) Render ¶
func (pr *FragmentRenderer) Render(instance interface{}) (string, []error)
Render implements the RenderComponent interface.
func (*FragmentRenderer) Types ¶
func (r *FragmentRenderer) Types() []string
type HeadConfig ¶
type HeadConfig struct { shared.Composite `mapstructure:",squash"` MetaData map[string]string `mapstructure:"meta" description:"Metadata for the head section" example:"{!{head-metadata.hyperbricks}}"` Css []string `mapstructure:"css" description:"CSS files to include" example:"{!{head-css.hyperbricks}}"` Js []string `mapstructure:"js" description:"JavaScript files to include" example:"{!{head-js.hyperbricks}}"` }
HeadConfig represents the configuration for the head section.
func (*HeadConfig) Validate ¶
func (config *HeadConfig) Validate() []error
Validate ensures that the RENDER has valid data.
type HeadRenderer ¶
type HeadRenderer struct {
renderer.CompositeRenderer
}
HeadRenderer handles rendering of COA content.
func (*HeadRenderer) Render ¶
func (cr *HeadRenderer) Render(instance interface{}) (string, []error)
Render implements the RenderComponent interface for COA.
func (*HeadRenderer) Types ¶
func (r *HeadRenderer) Types() []string
type HxApiConfig ¶
type HxApiConfig struct { shared.Composite `mapstructure:",squash"` HxDataContainer HxRequest `mapstructure:",squash"` HxResponse `mapstructure:"response"` HxResponseWriter http.ResponseWriter `mapstructure:"hx_response"` Template map[string]interface{} `` /* 129-byte string literal not displayed */ Items map[string]interface{} `mapstructure:",remain"` Enclose string `mapstructure:"enclose" description:"Wrapping property for the hxapi" example:"{!{hxapi-wrap.hyperbricks}}"` IsStatic bool `mapstructure:"isstatic"` Static string `mapstructure:"static" description:"Static file path associated with the hxapi" example:"{!{hxapi-static.hyperbricks}}"` }
HxApiConfig represents configuration for a single hxapi.
func (*HxApiConfig) Validate ¶
func (hxapi *HxApiConfig) Validate() []error
Validate ensures that the hxapi has valid data.
type HxApiRenderer ¶
type HxApiRenderer struct {
renderer.CompositeRenderer
}
HxApiRenderer handles rendering of PAGE content.
func (*HxApiRenderer) ExecuteQuery ¶
func (pr *HxApiRenderer) ExecuteQuery(config *HxApiConfig) error
func (*HxApiRenderer) ParseRequestData ¶
func (pr *HxApiRenderer) ParseRequestData(config *HxApiConfig) error
func (*HxApiRenderer) ParseTemplate ¶
func (pr *HxApiRenderer) ParseTemplate(config *HxApiConfig) error
func (*HxApiRenderer) Render ¶
func (pr *HxApiRenderer) Render(instance interface{}) (string, []error)
Render implements the RenderComponent interface.
func (*HxApiRenderer) Types ¶
func (r *HxApiRenderer) Types() []string
func (*HxApiRenderer) ValidateRequestData ¶
func (pr *HxApiRenderer) ValidateRequestData(config *HxApiConfig) error
type HxApiRendererInterface ¶
type HxApiRendererInterface interface { shared.CompositeRenderer //middleware ParseRequestData(config *HxApiConfig) error ValidateRequestData(config *HxApiConfig) error ExecuteQuery(config *HxApiConfig) error ParseTemplate(config *HxApiConfig) error }
Add interface requirements
type HxDataContainer ¶
type HxDataContainer struct { Data HxFormData `mapstructure:"hx_data"` RowResult []map[string]interface{} SomeResultContainer map[string]interface{} R http.Request }
DataContainer holds the data for the update operation
type HxFormData ¶
type HxQueryConfig ¶
type HxQueryConfig struct { HxQueryCreate HxQuery `mapstructure:"create"` HxQueryReplace HxQuery `mapstructure:"replace"` HxQueryUpdate HxQuery `mapstructure:"update"` HxQueryRead HxQuery `mapstructure:"read"` HxQueryDelete HxQuery `mapstructure:"delete"` }
QueryConfig holds the dynamic query configuration
type HxRequest ¶
type HxRequest struct { HxFormData HxFormData `mapstructure:"hx_form_data"` HXQuery HxQueryConfig `mapstructure:"hx_query" description:"Middleware chain query"` HXDescription string `mapstructure:"hx_description" description:"HxRoute description"` HXModel ModelConfig `mapstructure:"hx_model" description:"A map[string]interface{} with field descriptions"` HXTable string `mapstructure:"hx_table" description:"The database table name"` HXDb string `mapstructure:"hx_db" description:"The database (a path to a sqlite3 database at this stage)"` HXTemplate string `` /* 142-byte string literal not displayed */ HXErrorTemplate string `mapstructure:"hx_error_template" description:"Template that is renderend send when an error occurs"` HxRoute string `mapstructure:"hx_route" description:"identifier for the hxapi" example:"{!{hxapi-route.hyperbricks}}"` HxMethod string `mapstructure:"hx_method"` HxBoosted string `mapstructure:"hx_boosted" description:"indicates that the request is via an element using hx_boost"` HxCurrentUrl string `mapstructure:"hx_current-url" description:"the current url of the browser"` HxHistoryRestore string `` /* 142-byte string literal not displayed */ HxPrompt string `mapstructure:"hx_prompt" description:"the user response to an hx_prompt"` HxRequestFlag string `mapstructure:"hx_request" description:"always true"` HxTarget string `mapstructure:"hx_target" description:"the id of the target element if it exists"` HxTriggerName string `mapstructure:"hx_trigger-name" description:"the name of the triggered element if it exists"` HxTrigger string `mapstructure:"hx_trigger" description:"the id of the triggered element if it exists"` }
type HxResponse ¶
type HxResponse struct { HxTemplateResult string // just for output of the parsed template HxLocation string `` /* 138-byte string literal not displayed */ HxPushedUrl string `mapstructure:"hx_push-url" header:"HX-Pushed-Url" description:"pushes a new url into the history stack"` HxRedirect string `mapstructure:"hx_redirect" header:"HX-Redirect" description:"can be used to do a client-side redirect to a new location"` HxRefresh string `` /* 127-byte string literal not displayed */ HxReplaceUrl string `mapstructure:"hx_replace-url" header:"HX-Replace-Url" description:"replaces the current url in the location bar"` HxReswap string `mapstructure:"hx_reswap" header:"HX-Reswap" description:"allows you to specify how the response will be swapped"` HxRetarget string `mapstructure:"hx_retarget" header:"HX-Retarget" description:"a css selector that updates the target of the content update"` HxReselect string `` /* 154-byte string literal not displayed */ HxTrigger string `mapstructure:"hx_trigger" header:"HX-Trigger" description:"allows you to trigger client-side events"` HxTriggerafterSettle string `` /* 149-byte string literal not displayed */ HxTriggerafterSwap string `` /* 143-byte string literal not displayed */ }
type HyperMediaConfig ¶
type HyperMediaConfig struct { shared.Composite `mapstructure:",squash"` ContentType string `mapstructure:"@type" category:"renderer" description:"HyperBricks type: PAGE" example:"{!{page.hyperbricks}}"` Title string `mapstructure:"title" description:"The title of the page" example:"{!{page-title.hyperbricks}}"` Route string `mapstructure:"route" description:"The route (URL-friendly identifier) for the page" example:"{!{page-route.hyperbricks}}"` Section string `mapstructure:"section" description:"The section the page belongs to" example:"{!{page-section.hyperbricks}}"` Items map[string]interface{} `mapstructure:",remain"` BodyTag string `` /* 241-byte string literal not displayed */ Enclose string `mapstructure:"enclose" description:"Wrapping property for the page" example:"{!{page-wrap.hyperbricks}}"` Favicon string `mapstructure:"favicon" description:"Path to the favicon for the page" example:"{!{page-favicon.hyperbricks}}"` Template map[string]interface{} `mapstructure:"template" description:"Template configurations for rendering the page" example:"{!{page-template.hyperbricks}}"` IsStatic bool `mapstructure:"isstatic"` Static string `mapstructure:"static" description:"Static file path associated with the page" example:"{!{page-static.hyperbricks}}"` Index int `` /* 186-byte string literal not displayed */ Meta map[string]string `` /* 127-byte string literal not displayed */ Doctype string `mapstructure:"doctype" description:"Doctype for the HTML document" example:"{!{page-doctype.hyperbricks}}"` HtmlTag string `mapstructure:"htmltag" description:"The opening HTML tag with attributes" example:"{!{page-htmltag.hyperbricks}}"` Head map[string]interface{} `mapstructure:"head" description:"Configurations for the head section of the page" example:"{!{page-head.hyperbricks}}"` Css []string `mapstructure:"css" description:"CSS files associated with the page" example:"{!{page-css.hyperbricks}}"` Js []string `mapstructure:"js" description:"JavaScript files associated with the page" example:"{!{page-js.hyperbricks}}"` }
HyperMediaConfig represents configuration for a single page.
func (*HyperMediaConfig) Validate ¶
func (page *HyperMediaConfig) Validate() []error
Validate ensures that the page has valid data.
type HyperMediaRenderer ¶
type HyperMediaRenderer struct {
renderer.CompositeRenderer
}
HyperMediaRenderer handles rendering of PAGE content.
func (*HyperMediaRenderer) Render ¶
func (pr *HyperMediaRenderer) Render(instance interface{}) (string, []error)
Render implements the RenderComponent interface.
func (*HyperMediaRenderer) Types ¶
func (r *HyperMediaRenderer) Types() []string
type ModelConfig ¶
type ModelConfig struct { Fields map[string]FieldConfig `mapstructure:"fields" description:"Fields contain a type (float64, int, string etc) and a required value"` // Map of fields with their configuration Name string `mapstructure:"name"` }
type TemplateConfig ¶
type TemplateConfig struct { shared.CompositeRendererConfig `mapstructure:",squash"` Template string `mapstructure:"template" description:"The template used for rendering" example:"{!{template-template.hyperbricks}}"` IsTemplate bool `` /* 137-byte string literal not displayed */ Values map[string]interface{} `mapstructure:"values" description:"Key-value pairs for template rendering" example:"{!{template-values.hyperbricks}}"` }
TemplateConfig represents the configuration for a TEMPLATE type.
func (*TemplateConfig) Validate ¶
func (head *TemplateConfig) Validate() []error
type TemplateRenderer ¶
type TemplateRenderer struct {
renderer.CompositeRenderer
}
func (*TemplateRenderer) Render ¶
func (tr *TemplateRenderer) Render(instance interface{}) (string, []error)
func (*TemplateRenderer) Types ¶
func (r *TemplateRenderer) Types() []string
type TreeConfig ¶
type TreeConfig struct { shared.CompositeRendererConfig `mapstructure:",squash"` Enclose string `mapstructure:"enclose" description:"Wrapping property for the tree" example:"{!{tree-wrap.hyperbricks}}"` }
ConcurentRenderConfig represents the configuration for a RENDER (Container of Assets) type.
func (*TreeConfig) Validate ¶
func (config *TreeConfig) Validate() []error
Validate ensures that the RENDER has valid data.
type TreeRenderer ¶
type TreeRenderer struct {
renderer.CompositeRenderer
}
Define a specific implementation of RenderComponent with a concrete error type. RENDER TEMPLATE PAGE HEAD
func (*TreeRenderer) Render ¶
func (r *TreeRenderer) Render(data interface{}) (string, []error)
Concurrent and Recursive Renderer and returns the result and errors. See render.go.md. This function is a blueprint function for all concurent rendering of pages, render and template objects
func (*TreeRenderer) Types ¶
func (r *TreeRenderer) Types() []string