thermo

package module
v0.3.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 2, 2024 License: MIT Imports: 15 Imported by: 0

README

thermo

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Build

func Build(blueprint Blueprint) (*ember.App, error)

Build will build an ember app based on the provided blueprint.

func CSP added in v0.3.5

func CSP(baseURL string) serve.ContentPolicy

CSP returns a basic content security policy.

func Deconflict

func Deconflict(name string) string

Deconflict will return a model key that is conflict safe. It will use an titelized version of the key for conflicting keys.

func MustBuild

func MustBuild(blueprint Blueprint) *ember.App

MustBuild will call Build and panic on error.

func Title added in v0.2.2

func Title(name string) string

Title will convert a camel case name to a spaced title.

Types

type Action added in v0.3.0

type Action struct {
	Title      string     `json:"title"`
	Expression Expression `json:"expression"`
	Disabled   Expression `json:"disabled"`
}

Action describes a row action.

type Any

type Any = interface{}

Any describes an arbitrary value.

type Attribute

type Attribute struct {
	Name    string     `json:"name"`
	Kind    Kind       `json:"kind"`
	Type    Type       `json:"type,omitempty"`
	Inverse string     `json:"inverse,omitempty"` // belongs-to, has-many
	Default Any        `json:"default,omitempty"`
	Init    Expression `json:"init,omitempty"`
}

Attribute describes a static model attribute.

func Attributes

func Attributes(model coal.Model, only ...string) []Attribute

Attributes will return a list of attributes for the provided coal.Model.

type Backend

type Backend struct {
	BaseURL      string `json:"baseURL"`
	AuthPath     string `json:"authPath"`
	AuthScope    string `json:"authScope"`
	DataPath     string `json:"dataPath"`
	WatchPath    string `json:"watchPath"`
	UploadPath   string `json:"uploadPath"`
	DownloadPath string `json:"downloadPath"`
	ClientID     string `json:"clientID"`
	UserDataKey  string `json:"userDataKey"`
	UserModel    string `json:"userModel"`
	UserNameKey  string `json:"userNameKey"`
}

Backend describes the backend service.

type Blueprint

type Blueprint struct {
	Title   string  `json:"title"`
	Color   string  `json:"color"`
	Backend Backend `json:"backend"`
	Menus   []Menu  `json:"menus"`
	Models  []Model `json:"models"`
}

Blueprint configures a thermo application.

type Column

type Column struct {
	Title      string     `json:"title"`
	Key        string     `json:"key,omitempty"` // leave empty for model based expression
	Format     Format     `json:"format,omitempty"`
	Options    []Option   `json:"options,omitempty"`    // map
	LabelKey   string     `json:"labelKey,omitempty"`   // belongs-to, has-many
	Expression Expression `json:"expression,omitempty"` // expression
}

Column describes a table column.

func Columns

func Columns(model coal.Model, labelKeys LabelKeys, only ...string) []Column

Columns will return a list of columns for the provided coal.Model.

type Condition

type Condition string

Condition describes a filter condition.

const (
	ConditionBoolean Condition = "boolean"
	ConditionSelect  Condition = "select"
)

The available filter conditions.

type Control

type Control string

Control describes a form control.

const (
	ControlString    Control = "string"
	ControlText      Control = "text"
	ControlBoolean   Control = "boolean"
	ControlNumber    Control = "number"
	ControlDate      Control = "date"
	ControlStrings   Control = "strings"
	ControlSelect    Control = "select"
	ControlReference Control = "reference"
	ControlWell      Control = "well"
	ControlFile      Control = "file"
	ControlColor     Control = "color"
	ControlArray     Control = "array"
)

The available form controls.

type Expression

type Expression string

Expression describes a javascript expression. The current value can be accessed using `this`, the special variable `$` allows access to the context service.

func Constant added in v0.3.0

func Constant(value interface{}) Expression

Constant creates and expression that returns the provided constant value.

type Field

type Field struct {
	Label       string     `json:"label"`
	Key         string     `json:"key"`
	Hint        string     `json:"hint"`
	Control     Control    `json:"control"`
	Disabled    Expression `json:"disabled,omitempty"`
	Locked      bool       `json:"locked,omitempty"`
	Placeholder string     `json:"placeholder,omitempty"` // string, text, number, date, undefined
	Redacted    bool       `json:"redacted,omitempty"`    // string
	Min         float64    `json:"min,omitempty"`         // number
	Max         float64    `json:"max,omitempty"`         // number
	Step        float64    `json:"step,omitempty"`        // number
	Options     []Option   `json:"options,omitempty"`     // select
	Source      Expression `json:"source,omitempty"`      // reference
	Multiple    bool       `json:"multiple,omitempty"`    // reference
	LabelKey    string     `json:"labelKey,omitempty"`    // reference
	EmptyLabel  string     `json:"emptyLabel,omitempty"`  // reference
	AllowEmpty  bool       `json:"allowEmpty,omitempty"`  // reference
	AcceptMedia string     `json:"acceptMedia,omitempty"` // file
	ItemName    string     `json:"itemName,omitempty"`    // array
	ItemFields  []Field    `json:"itemFields,omitempty"`  // array
	ItemFactory Expression `json:"itemFactory,omitempty"` // array
}

Field describes a form field.

func Fields

func Fields(model coal.Model, labelKeys LabelKeys, only ...string) []Field

Fields will return a list of fields for the provided coal.Model.

type Filter

type Filter struct {
	Title     string    `json:"title"`
	Key       string    `json:"key"`
	Condition Condition `json:"condition"`
	Options   []Option  `json:"options"` // select
}

Filter describes a list filter.

type Format

type Format string

Format describes a column format.

const (
	FormatLiteral      Format = "literal"
	FormatBoolean      Format = "boolean"
	FormatMap          Format = "map"
	FormatAbsoluteDate Format = "absolute-date"
	FormatRelativeDate Format = "relative-date"
	FormatStrings      Format = "strings"
	FormatProgress     Format = "progress"
	FormatBelongsTo    Format = "belongs-to"
	FormatHasMany      Format = "has-many"
	FormatExpression   Format = "expression"
	FormatFile         Format = "file"
	FormatFiles        Format = "files"
	FormatColor        Format = "color"
)

The available column formats.

type Kind

type Kind string

Kind describes a field kind.

const (
	KindValue     Kind = "value"
	KindBelongsTo Kind = "belongs-to"
	KindHasMany   Kind = "has-many"
)

The available field kinds.

type LabelKeys added in v0.3.3

type LabelKeys map[coal.Model]string

LabelKeys is a mapping of models to label keys.

func (LabelKeys) Get added in v0.3.3

func (lk LabelKeys) Get(name string) string

Get will return the label key for the specified relationship type name.

type Menu struct {
	Title string     `json:"title"`
	Items []MenuItem `json:"items"`
}

Menu describes a menu.

type MenuItem struct {
	Title string `json:"title"`
	Model string `json:"model"`
}

MenuItem describes a menu item.

type Model

type Model struct {
	Name       string      `json:"name"`
	Singular   string      `json:"singular"`
	Plural     string      `json:"plural"`
	Watchable  bool        `json:"watchable"`
	Immediate  bool        `json:"immediate"`
	Creatable  bool        `json:"creatable"`
	Editable   bool        `json:"editable"`
	Deletable  bool        `json:"deletable"`
	Attributes []Attribute `json:"attributes"`
	Properties []Property  `json:"properties"`
	Orders     []Order     `json:"orders"`
	Filters    []Filter    `json:"filters"`
	Columns    []Column    `json:"columns"`
	Actions    []Action    `json:"actions"`
	Fields     []Field     `json:"fields"`
}

Model describes a model.

func Applications

func Applications(confidential bool) Model

Applications will return the model for managing flame.Application documents. If confidential is true an attribute and column is added for a "confidential" property that maps to "IsConfidential".

func Auto

func Auto(model coal.Model, name, singular, plural string, labelKeys LabelKeys, modifiers ...func(*Model)) Model

Auto will generate a Model definition for the provided coal.Model.

func Files

func Files() Model

Files will return the model for managing blaze.File documents.

func Jobs

func Jobs(live bool) Model

Jobs will return the model for managing axe.Model documents. If live is true it requires permission to watch documents.

func Tokens

func Tokens() Model

Tokens will return the model for managing flame.Token documents.

func Users

func Users() Model

Users will return the model for managing flame.User documents.

func Values

func Values(live bool) Model

Values will return the model for managing glut.Model documents. If watch is true it requires permission to watch documents.

type Option

type Option struct {
	Value string `json:"value"`
	Label string `json:"label"`
}

Option describes an option.

type Order

type Order struct {
	Title string `json:"title"`
	Name  string `json:"name"`
}

Order describes a sorting order.

type Property

type Property struct {
	Name string     `json:"name"`
	Keys []string   `json:"keys,omitempty"`
	Body Expression `json:"body,omitempty"`
}

Property describes a dynamic model property.

type Type

type Type string

Type describes a field type.

const (
	TypeString  Type = "string"
	TypeBoolean Type = "boolean"
	TypeNumber  Type = "number"
	TypeDate    Type = "date"
	TypeFile    Type = "file"
	TypeFiles   Type = "files"
	TypeStrings Type = "strings"
)

The available field types.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL