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" description:"HTMX response header configuration." example:"{!{fragment-response.hyperbricks}}"`
MetaDocDescription string `` /* 222-byte string literal not displayed */
HxResponseWriter http.ResponseWriter `mapstructure:"hx_response" exclude:"true"`
Title string `mapstructure:"title" description:"The title of the fragment" example:"{!{fragment-title.hyperbricks}}"`
Route string `` /* 129-byte string literal not displayed */
Section string `mapstructure:"section" description:"The section the fragment belongs to" example:"{!{fragment-section.hyperbricks}}"`
Items map[string]interface{} `mapstructure:",remain"`
Enclose string `` /* 131-byte string literal not displayed */
Template map[string]interface{} `` /* 133-byte string literal not displayed */
File string `mapstructure:"@file" exclude:"true"`
IsStatic bool `mapstructure:"isstatic" exclude:"true"`
Static string `mapstructure:"static" description:"Static file path associated with the fragment" example:"{!{fragment-static.hyperbricks}}"`
Index int `` /* 194-byte string literal not displayed */
}
FragmentConfig represents configuration for a single fragment.
func (*FragmentConfig) Validate ¶
func (fragment *FragmentConfig) Validate() []error
Validate ensures that the fragment 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"`
Title string `mapstructure:"title" description:"The title of the hypermedia document" example:"{!{head-title.hyperbricks}}"`
Favicon string `mapstructure:"favicon" description:"Path to the favicon for the hypermedia document" example:"{!{head-favicon.hyperbricks}}"`
MetaData map[string]string `mapstructure:"meta" description:"Metadata for the head section" example:"{!{head-meta.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"`
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-enclose.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 `` /* 139-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"`
MetaDocDescription string `mapstructure:"@doc" description:"HYPERMEDIA description" example:"{!{hypermedia-@doc.hyperbricks}}"`
Title string `mapstructure:"title" description:"The title of the hypermedia site" example:"{!{hypermedia-title.hyperbricks}}"`
Route string `` /* 133-byte string literal not displayed */
Section string `` /* 177-byte string literal not displayed */
Items map[string]interface{} `mapstructure:",remain"`
BodyTag string `` /* 257-byte string literal not displayed */
Enclose string `` /* 127-byte string literal not displayed */
Favicon string `mapstructure:"favicon" description:"Path to the favicon for the hypermedia" example:"{!{hypermedia-favicon.hyperbricks}}"`
Template map[string]interface{} `` /* 177-byte string literal not displayed */
IsStatic bool `mapstructure:"isstatic" exclude:"true"`
Static string `` /* 179-byte string literal not displayed */
Index int `` /* 216-byte string literal not displayed */
Doctype string `mapstructure:"doctype" description:"Alternative Doctype for the HTML document" example:"{!{hypermedia-doctype.hyperbricks}}"`
HtmlTag string `mapstructure:"htmltag" description:"The opening HTML tag with attributes" example:"{!{hypermedia-htmltag.hyperbricks}}"`
Head map[string]interface{} `` /* 130-byte string literal not displayed */
}
HyperMediaConfig represents configuration hypermedia.
func (*HyperMediaConfig) Validate ¶
func (hm *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.Composite `mapstructure:",squash"`
MetaDocDescription string `mapstructure:"@doc" description:"TEMPLATE description" example:"{!{template-@doc.hyperbricks}}"`
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}}"`
Enclose string `` /* 132-byte string literal not displayed */
}
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.Composite `mapstructure:",squash"`
MetaDocDescription string `` /* 170-byte string literal not displayed */
Enclose string `mapstructure:"enclose" description:"Wrapping property for the tree" example:"{!{tree-enclose.hyperbricks}}"`
}
TreeConfig
func (*TreeConfig) Validate ¶
func (config *TreeConfig) Validate() []error
type TreeRenderer ¶
type TreeRenderer struct {
renderer.CompositeRenderer
}
func (*TreeRenderer) Render ¶
func (r *TreeRenderer) Render(data interface{}) (string, []error)
Concurrent and Recursive Renderer and returns the result and errors. This function is a blueprint function for all concurent rendering of pages, render and template objects
func (*TreeRenderer) Types ¶
func (r *TreeRenderer) Types() []string