thermo

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2021 License: MIT Imports: 10 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 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.

Types

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"`
	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"`
	ClientID  string `json:"clientID"`
}

Backend describes the backend service.

type Blueprint

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

Blueprint configures a thermo application.

type Column

type Column struct {
	Title  string `json:"title"`
	Key    string `json:"key"`
	Format Format `json:"format,omitempty"`
	Label  string `json:"label,omitempty"`
}

Column describes a table column.

func Columns

func Columns(model coal.Model, 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"
)

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"
	ControlSelect    Control = "select"
	ControlReference Control = "reference"
	ControlWell      Control = "well"
)

The available form controls.

type Expression

type Expression string

Expression describes a javascript expression.

type Field

type Field struct {
	Label       string     `json:"label"`
	Key         string     `json:"key"`
	Hint        string     `json:"hint"`
	Control     Control    `json:"control"`
	Placeholder string     `json:"placeholder,omitempty"`
	Redacted    bool       `json:"redacted,omitempty"`
	Min         float64    `json:"min,omitempty"`
	Max         float64    `json:"max,omitempty"`
	Step        float64    `json:"step,omitempty"`
	Options     []Option   `json:"options,omitempty"`
	Source      Expression `json:"source,omitempty"`
	Multiple    bool       `json:"multiple,omitempty"`
	LabelKey    string     `json:"labelKey,omitempty"`
	EmptyLabel  string     `json:"emptyLabel,omitempty"`
	AllowEmpty  bool       `json:"allowEmpty,omitempty"`
}

Field describes a form field.

func Fields

func Fields(model coal.Model, 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"`
}

Filter describes a list filter.

type Format

type Format string

Format describes a column format.

const (
	FormatLiteral      Format = "literal"
	FormatBoolean      Format = "boolean"
	FormatAbsoluteDate Format = "absolute-date"
	FormatRelativeDate Format = "relative-date"
	FormatProgress     Format = "progress"
	FormatBelongsTo    Format = "belongs-to"
	FormatHasMany      Format = "has-many"
)

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 Menu struct {
	Left  []MenuItem `json:"left"`
	Right []MenuItem `json:"right"`
}

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"`
	Title      string      `json:"title"`
	Watchable  bool        `json:"watchable"`
	Immediate  bool        `json:"immediate"`
	Attributes []Attribute `json:"attributes"`
	Properties []Property  `json:"properties"`
	Orders     []Order     `json:"orders"`
	Filters    []Filter    `json:"filters"`
	Columns    []Column    `json:"columns"`
	Fields     []Field     `json:"fields"`
}

Model describes a model.

func Applications

func Applications() Model

Applications will return the model for managing flame.Application documents.

func Auto

func Auto(model coal.Model, name, title string) 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 Modify

func Modify(model Model, fn func(*Model)) Model

Modify is a helper to modify a model and return it.

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"
)

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