generator

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MetaKeys = []MetaKey{
	"_isSubplotObj",
	"_isLinkedToArray",
	"_arrayAttrRegexps",
	"_deprecated",
	"description",
	"role",
	"editType",
	"impliedEdits",
}

Functions

func UnmarshalRole

func UnmarshalRole(obj json.RawMessage, role *Role) error

Types

type Attribute

type Attribute struct {
	Role        Role   `json:"role,omitempty"`
	Description string `json:"description,omitempty"`
	EditType    string `json:"editType,omitempty"`

	ValType ValType       `json:"valType,omitempty"`
	Values  []interface{} `json:"values,omitempty"`
	Flags   []string      `json:"flags,omitempty"`
	Extras  []interface{} `json:"extras,omitempty"`
	Dflt    interface{}   `json:"dflt,omitempty"`
	Min     json.Number   `json:"min,omitempty"`
	Max     json.Number   `json:"max,omitempty"`
	ArrayOK bool          `json:"arrayOk,omitempty"`
	Anim    bool          `json:"anim,omitempty"`

	Name       string                `json:"-"`
	Attributes map[string]*Attribute `json:"-"`
	Items      map[string]*Attribute `json:"-"`
	Parent     *Attribute            `json:"-"`
}

func (*Attribute) String

func (attr *Attribute) String() string

type ConfigAttributes

type ConfigAttributes struct {
	Names map[string]*Attribute `json:"-"`
}

func (*ConfigAttributes) UnmarshalJSON

func (attr *ConfigAttributes) UnmarshalJSON(b []byte) error

type Creator

type Creator interface {
	Create(name string) (io.WriteCloser, error)
}

Creator provices the functionality to create a file

type Defs

type Defs struct {
	ValObjects map[string]*ValObject `json:"valObjects,omitempty"`
	MetaKeys   []string              `json:"meta_keys,omitempty"`
}

type Layout

type Layout struct {
	LayoutAttributes LayoutAttributes `json:"layoutAttributes,omitempty"`
}

type LayoutAttributes

type LayoutAttributes struct {
	Names map[string]*Attribute `json:"-"`
}

func (*LayoutAttributes) UnmarshalJSON

func (attr *LayoutAttributes) UnmarshalJSON(b []byte) error

type Meta

type Meta struct {
	Description string `json:"description,omitempty"`
}

type MetaKey

type MetaKey string

type Renderer

type Renderer struct {
	// contains filtered or unexported fields
}

Renderer handles the process to render a Root to a Creator interface

func NewRenderer

func NewRenderer(fs Creator, root *Root) (*Renderer, error)

NewRenderer initializes a renderer

func (*Renderer) CreateConfig

func (r *Renderer) CreateConfig(dir string) error

CreateConfig creates the config file in the given director

func (*Renderer) CreateLayout

func (r *Renderer) CreateLayout(dir string) error

CreateLayout creates the layout file in the given directory

func (*Renderer) CreateTrace

func (r *Renderer) CreateTrace(dir string, name string) error

CreateTrace creates a file with the content of a trace by name

func (*Renderer) CreateTraces

func (r *Renderer) CreateTraces(dir string) error

CreateTraces creates all traces in the given directory

func (*Renderer) CreateUnmarshal

func (r *Renderer) CreateUnmarshal(dir string) error

CreateUnmarshal creates the unmarshal file on the given directory

func (*Renderer) WriteConfig

func (r *Renderer) WriteConfig(w io.Writer) error

WriteConfig writes config to the given writer

func (*Renderer) WriteLayout

func (r *Renderer) WriteLayout(w io.Writer) error

WriteLayout writes layout to the given writer

func (*Renderer) WriteTrace

func (r *Renderer) WriteTrace(traceName string, w io.Writer) error

WriteTrace writes a trace by name to a writer

func (*Renderer) WriteUnmarshal

func (r *Renderer) WriteUnmarshal(w io.Writer) error

WriteUnmarshal writes unmarshal to the given writer

type Role

type Role string
const (
	RoleObject Role = "object"
	RoleInfo   Role = "info"
	RoleStyle  Role = "style"
	RoleData   Role = "data"
)

type Root

type Root struct {
	SHA1     string  `json:"sha1,omitempty"`
	Modified bool    `json:"modified,omitempty"`
	Schema   *Schema `json:"schema,omitempty"`
}

Root represents the root of the plotly schema It is basically the struct representation of the json schema content

func LoadSchema

func LoadSchema(r io.Reader) (*Root, error)

LoadSchema loads the plotly schema file

type Schema

type Schema struct {
	Defs   *Defs  `json:"defs,omitempty"`
	Traces Traces `json:"traces,omitempty"`
	Layout Layout `json:"layout,omitempty"`
	// Transforms *Transforms `json:"transforms,omitempty"`
	// Frames     *Frames     `json:"frames,omitempty"`
	// Animation  *Animation  `json:"animation,omitempty"`
	Config *ConfigAttributes `json:"config,omitempty"`
}

type Trace

type Trace struct {
	Meta *Meta `json:"meta,omitempty"`
	// Categories []string   `json:"categories,omitempty"`
	Animatable       bool             `json:"animatable,omitempty"`
	Type             string           `json:"type,omitempty"`
	Attributes       TraceAttributes  `json:"attributes,omitempty"`
	LayoutAttributes LayoutAttributes `json:"layoutAttributes,omitempty"`
}

type TraceAttributes

type TraceAttributes struct {
	Type  string                `json:"type"`
	Names map[string]*Attribute `json:"-"`
}

func (*TraceAttributes) Sorted

func (attr *TraceAttributes) Sorted() []string

func (*TraceAttributes) UnmarshalJSON

func (attr *TraceAttributes) UnmarshalJSON(b []byte) error

type Traces

type Traces map[string]*Trace

type ValObject

type ValObject struct {
	Description  string   `json:"description,omitempty"`
	RequiredOpts []string `json:"requiredOpts,omitempty"`
	OtherOpts    []string `json:"otherOpts,omitempty"`
}

type ValType

type ValType string
const (
	ValTypeDataArray  ValType = "data_array"
	ValTypeEnum       ValType = "enumerated"
	ValTypeBoolean    ValType = "boolean"
	ValTypeNumber     ValType = "number"
	ValTypeInteger    ValType = "integer"
	ValTypeString     ValType = "string"
	ValTypeColor      ValType = "color"
	ValTypeColorlist  ValType = "colorlist"
	ValTypeColorscale ValType = "colorscale"
	ValTypeAngle      ValType = "angle"
	ValTypeSubplotID  ValType = "subplotid"
	ValTypeFlagList   ValType = "flaglist"
	ValTypeAny        ValType = "any"
	ValTypeInfoArray  ValType = "info_array"
)

Directories

Path Synopsis
cmd
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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