Documentation ¶
Index ¶
- Variables
- func DeleteViewDefinition(id string) error
- func GenerateViewConfigSpecJson(v ViewConfig) map[string]interface{}
- func RegisterView(name string, creator RegisteredView)
- func SaveViewDefinition(definition ViewDefinition) error
- func SetViewCommonConfig(config *ViewCommonConfig)
- func TemplateRefresh(v View)
- func ValidateViewConfig(v ViewConfig) error
- type BaseView
- func (v *BaseView) Init()
- func (v *BaseView) SetTemplate(t *compCommon.Template)
- func (v *BaseView) SetTemplateValue(t compCommon.Template)
- func (v *BaseView) Stop()
- func (v *BaseView) Template() *compCommon.Template
- func (v *BaseView) TemplateData() map[string]interface{}
- func (v *BaseView) TemplateString() string
- type FieldMetadata
- type RegisteredView
- type StructMetadata
- type TagMetadata
- type View
- type ViewCommonConfig
- type ViewConfig
- type ViewConfigFieldSpec
- type ViewDefinition
- type ViewDefinitionRaw
Constants ¶
This section is empty.
Variables ¶
var ( CommonConfig = &ViewCommonConfig{} RegisteredViews = map[string]RegisteredView{} )
Functions ¶
func DeleteViewDefinition ¶
DeleteViewDefinition delete a given view def by id from the store
func GenerateViewConfigSpecJson ¶
func GenerateViewConfigSpecJson(v ViewConfig) map[string]interface{}
func RegisterView ¶
func RegisterView(name string, creator RegisteredView)
func SaveViewDefinition ¶
func SaveViewDefinition(definition ViewDefinition) error
SaveViewDefinition saves a view definition to the store
func SetViewCommonConfig ¶
func SetViewCommonConfig(config *ViewCommonConfig)
func TemplateRefresh ¶
func TemplateRefresh(v View)
TemplateRefresh static function to generate a View's template
func ValidateViewConfig ¶
func ValidateViewConfig(v ViewConfig) error
ValidateViewConfig takes a ViewConfig and using the rules defined by "spec" field tags, it validates the configuration
Types ¶
type BaseView ¶
type BaseView struct {
// contains filtered or unexported fields
}
func (*BaseView) SetTemplate ¶
func (v *BaseView) SetTemplate(t *compCommon.Template)
func (*BaseView) SetTemplateValue ¶
func (v *BaseView) SetTemplateValue(t compCommon.Template)
func (*BaseView) Template ¶
func (v *BaseView) Template() *compCommon.Template
func (*BaseView) TemplateData ¶
func (*BaseView) TemplateString ¶
type FieldMetadata ¶
type FieldMetadata struct { FieldName string Tags []TagMetadata Type reflect.Type Kind reflect.Kind Value interface{} }
FieldMetadata the individual key/value pairs defined on a specific field
type RegisteredView ¶
type RegisteredView struct { NewConfig func() ViewConfig NewView func(ViewConfig) (View, error) }
RegisteredView set of generic functions to a create a given View's config and the View itself
type StructMetadata ¶
type StructMetadata struct { TypeName string Fields []FieldMetadata }
StructMetadata the tag metadata related to a specific struct and tag name
type TagMetadata ¶
TagMetadata key/value pair of a tag
type View ¶
type View interface { Init() Template() *compCommon.Template SetTemplate(*compCommon.Template) SetTemplateValue(compCommon.Template) TemplateString() string TemplateData() map[string]interface{} Stop() }
View a structure to describe a layout of components at a given time
type ViewCommonConfig ¶
type ViewCommonConfig struct { MatrixRows int MatrixCols int ImageDir string CacheDir string DefaultImageSizeX int DefaultImageSizeY int DefaultFontSize int DefaultFontColor string DefaultFontStyle string DefaultFontType string Store *store.Store }
ViewCommonConfig a set of global application configuration useful for rendering Views
type ViewConfig ¶
type ViewConfig interface{}
ViewConfig type alias to hold raw config definition for a View
type ViewConfigFieldSpec ¶
type ViewDefinition ¶
type ViewDefinition struct { Id string `json:"id" spec:"label='View Definition ID',required='true'"` Name string `json:"name" spec:"label='View Definition Name',required='true'"` Type string `json:"type" spec:"label='View Type',required='true'"` Config ViewConfig `json:"config" spec:"label='View Config',required='true'"` }
ViewDefinition what defines a View? The Type of View it is and the View's configuration
func GetAllViewDefinitions ¶
func GetAllViewDefinitions() ([]ViewDefinition, error)
GetAllViewDefinitions retrieves all saved view definitions from the store
func GetViewDefinition ¶
func GetViewDefinition(id string) (ViewDefinition, error)
GetViewConfig retrieves a view definition from the store by name
type ViewDefinitionRaw ¶
type ViewDefinitionRaw struct { Id string `json:"id"` Name string `json:"name"` Type string `json:"type"` Config json.RawMessage `json:"config"` }
ViewDefinitionRaw similar to ViewDefinition, but Config is json.RawMessage ([]byte)