card

package module
Version: v0.0.0-...-6868862 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2020 License: MIT Imports: 11 Imported by: 0

README

Card

Go Report Card

Symbolic Expression Data Storage Card

Documentation

Overview

mae.earth/pkg/card/card.go * mae 12016

mae.earth/pkg/card/compound.go * mae 12016

mae.earth/pkg/card/primitives.go * mae 12016

Index

Constants

View Source
const (
	UPID = 4 /* Unique Project IDentifier */
	PID  = 4 /* Process IDentifier */
)
View Source
const (
	NameCard       = Name("card")
	NameAttributes = Name("A") //Name("attributes")
	NameAttribute  = Name("a") //Name("attribute")
	NameCompound   = Name("C")
)
View Source
const (
	DataCard   = Type("data")
	FilterCard = Type("filter")
	ViewCard   = Type("view")
)
View Source
const (
	NameByte            = Name("uint8")
	NameNumber          = Name("int")
	NameString          = Name("string")
	NameDelimitedString = Name("delimited-string")
	NameBoolean         = Name("boolean")
	NameReal            = Name("real")
	NameDatetime        = Name("datetime")
)
View Source
const DefaultReal = Real(0.0)
View Source
const PartDelimiter string = "@"

Variables

View Source
var (
	ErrRootIsNil     = fmt.Errorf("Root is nil")
	ErrRootIsInvalid = fmt.Errorf("Root is Invalid")
	ErrInvalidValue  = fmt.Errorf("Value is invalid")
	ErrCardIsInvalid = fmt.Errorf("Card is invalid")
)
View Source
var (
	EmptyDatetime = Datetime(time.Now())
)

Functions

func Compact

func Compact(root *cell.Cell) string

func DeregisterUserParser

func DeregisterUserParser(name string) bool

DeregisterUserParser

func Fuzz

func Fuzz(data []byte) int

see https://github.com/dvyukov/go-fuzz

func Output

func Output(card *Card) (string, error)

func RegisterUserParser

func RegisterUserParser(name string, p UserParser) bool

RegisterUserParser

func S

func S(h cell.Stringer) *cell.Cell

func Strip

func Strip(s string) string

Types

type Attributer

type Attributer interface {
	Sexpr() *cell.Cell
	String() string
	Name() Name
	Copy() Attributer
	Update(interface{}) Attributer
	Blank() Attributer
	Equal(Attributer) bool
}

type Boolean

type Boolean bool

Boolean

func ParseBoolean

func ParseBoolean(root *cell.Cell) (Boolean, error)

func (Boolean) Blank

func (b Boolean) Blank() Attributer

func (Boolean) Copy

func (b Boolean) Copy() Attributer

func (Boolean) Equal

func (b Boolean) Equal(other Attributer) bool

func (Boolean) Name

func (b Boolean) Name() Name

func (Boolean) Sexpr

func (b Boolean) Sexpr() *cell.Cell

func (Boolean) String

func (b Boolean) String() string

func (Boolean) Update

func (b Boolean) Update(u interface{}) Attributer

type Byte

type Byte byte

byte

func ParseByte

func ParseByte(root *cell.Cell) (Byte, error)

func (Byte) Blank

func (b Byte) Blank() Attributer

func (Byte) Copy

func (b Byte) Copy() Attributer

func (Byte) Equal

func (b Byte) Equal(other Attributer) bool

func (Byte) Name

func (b Byte) Name() Name

func (Byte) Sexpr

func (b Byte) Sexpr() *cell.Cell

func (Byte) String

func (b Byte) String() string

func (Byte) Update

func (b Byte) Update(u interface{}) Attributer

type Card

type Card struct {
	Identifier
	Type
	Version int
	Created time.Time

	Attributes map[string]Attributer
}

func Clone

func Clone(c *Card) (*Card, error)

func CloneBlank

func CloneBlank(c *Card) (*Card, error)

func New

func New(id Identifier) (*Card, error)

func Parse

func Parse(f string) (*Card, error)

func (*Card) Get

func (c *Card) Get(key string) Attributer

func (*Card) IsData

func (c *Card) IsData() bool

func (*Card) Names

func (c *Card) Names() []string

func (*Card) Set

func (c *Card) Set(key string, val Attributer) *Card

func (*Card) SetAsData

func (c *Card) SetAsData() *Card

func (*Card) SetAsFilter

func (c *Card) SetAsFilter() *Card

func (*Card) SetAsView

func (c *Card) SetAsView() *Card

func (*Card) Sexpr

func (c *Card) Sexpr() *cell.Cell

func (*Card) String

func (c *Card) String() string

type Compound

type Compound struct {
	Label      string
	Attributes []Attributer
}

func NewCompound

func NewCompound() *Compound

func ParseCompound

func ParseCompound(root *cell.Cell) (*Compound, error)

func (*Compound) Add

func (c *Compound) Add(val Attributer) *Compound

func (Compound) Blank

func (c Compound) Blank() Attributer

func (Compound) Copy

func (c Compound) Copy() Attributer

func (Compound) Equal

func (c Compound) Equal(other Attributer) bool

func (Compound) Name

func (c Compound) Name() Name

func (Compound) Sexpr

func (c Compound) Sexpr() *cell.Cell

func (Compound) String

func (c Compound) String() string

func (Compound) Update

func (c Compound) Update(interface{}) Attributer

type Datetime

type Datetime time.Time

Datetime

func DatetimeNow

func DatetimeNow() Datetime

func ParseDatetime

func ParseDatetime(root *cell.Cell) (Datetime, error)

func (Datetime) Blank

func (dt Datetime) Blank() Attributer

func (Datetime) Copy

func (dt Datetime) Copy() Attributer

func (Datetime) Equal

func (dt Datetime) Equal(other Attributer) bool

func (Datetime) Name

func (dt Datetime) Name() Name

func (Datetime) Sexpr

func (dt Datetime) Sexpr() *cell.Cell

func (Datetime) String

func (dt Datetime) String() string

func (Datetime) Update

func (dt Datetime) Update(u interface{}) Attributer

type DelimitedString

type DelimitedString struct {
	Delimiter string /* default ',' */
	Content   string
}

func ParseDelimitedString

func ParseDelimitedString(root *cell.Cell) (DelimitedString, error)

func (DelimitedString) Blank

func (s DelimitedString) Blank() Attributer

func (DelimitedString) Copy

func (s DelimitedString) Copy() Attributer

func (DelimitedString) Delimit

func (s DelimitedString) Delimit() []string

func (DelimitedString) Equal

func (s DelimitedString) Equal(other Attributer) bool

func (DelimitedString) Name

func (s DelimitedString) Name() Name

func (DelimitedString) Sexpr

func (ds DelimitedString) Sexpr() *cell.Cell

func (DelimitedString) String

func (s DelimitedString) String() string

func (DelimitedString) Update

func (s DelimitedString) Update(u interface{}) Attributer

type Identifier

type Identifier string

func Generate

func Generate(size uint) (Identifier, error)

Generate

func (Identifier) IsInvalid

func (id Identifier) IsInvalid() bool

func (Identifier) String

func (id Identifier) String() string

func (Identifier) Sum

func (id Identifier) Sum() uint

type Literal

type Literal string

func (Literal) String

func (l Literal) String() string

type Name

type Name string

func (Name) String

func (n Name) String() string

type Number

type Number int

number

func ParseNumber

func ParseNumber(root *cell.Cell) (Number, error)

func (Number) Blank

func (n Number) Blank() Attributer

func (Number) Copy

func (n Number) Copy() Attributer

func (Number) Equal

func (n Number) Equal(other Attributer) bool

func (Number) Name

func (n Number) Name() Name

func (Number) Sexpr

func (n Number) Sexpr() *cell.Cell

func (Number) String

func (n Number) String() string

func (Number) Update

func (n Number) Update(u interface{}) Attributer

type Part

type Part struct {
	Name       string
	Attributes map[string]Attributer
	Children   map[string]*Part
}

func NewPart

func NewPart(name string) *Part

func Partition

func Partition(card *Card) (*Part, error)

Go through the attributes of a card and partition into logical parts based on * the attributes name - pretty much like a file in a path

func (*Part) AddAttribute

func (p *Part) AddAttribute(key string, attr Attributer) *Part

func (*Part) GetAttribute

func (p *Part) GetAttribute(key string) Attributer

func (*Part) String

func (p *Part) String() string

type Plain

type Plain string

func (Plain) String

func (s Plain) String() string

type Real

type Real float64

real

func ParseReal

func ParseReal(root *cell.Cell) (Real, error)

func (Real) Blank

func (r Real) Blank() Attributer

func (Real) Copy

func (r Real) Copy() Attributer

func (Real) Equal

func (r Real) Equal(other Attributer) bool

func (Real) Name

func (r Real) Name() Name

func (Real) Parse

func (r Real) Parse(root *cell.Cell) (Real, error)

func (Real) Sexpr

func (r Real) Sexpr() *cell.Cell

func (Real) String

func (r Real) String() string

func (Real) Update

func (r Real) Update(u interface{}) Attributer

type String

type String string

String

func ParseString

func ParseString(root *cell.Cell) (String, error)

func (String) Blank

func (s String) Blank() Attributer

func (String) Copy

func (s String) Copy() Attributer

func (String) Equal

func (s String) Equal(other Attributer) bool

func (String) Name

func (s String) Name() Name

func (String) Sexpr

func (s String) Sexpr() *cell.Cell

func (String) String

func (s String) String() string

func (String) Update

func (s String) Update(u interface{}) Attributer

type Sumer

type Sumer interface {
	Sum() uint
}

type Type

type Type string

func (Type) String

func (t Type) String() string

type UserParser

type UserParser interface {
	Parse(root *cell.Cell) (Attributer, error)
}

Directories

Path Synopsis
mae.earth/pkg/card/html/html.go * mae 012018
mae.earth/pkg/card/html/html.go * mae 012018

Jump to

Keyboard shortcuts

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