memoir

package module
v0.0.0-...-6cf76c5 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2018 License: MIT Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	KindDocument      ComponentKind = 1
	KindNameValueList               = 2
	KindKeyValues                   = 3
	KindLabel                       = 4
	KindDataView                    = 5
	KindComponents                  = 6
)
View Source
const (
	NullValue     ValueType = 0
	IntValue                = 1
	UIntValue               = 2
	StringValue             = 3
	BytesValue              = 4
	TimeValue               = 5
	DurationValue           = 6
	BooleanValue            = 7
	JsonValue               = 8
	XmlValue                = 9
)

Variables

This section is empty.

Functions

func Format

func Format(w io.Writer, v interface{})

func Print

func Print(v interface{})

Types

type Component

type Component interface {
	GetKind() ComponentKind
}

func ToComponent

func ToComponent(def interface{}) Component

func ToComponents

func ToComponents(def ...interface{}) []Component

type ComponentKind

type ComponentKind int

type DocumentType

type DocumentType int
const (
	DocHttpTranslate DocumentType = 0
)

func (DocumentType) String

func (m DocumentType) String() string

type Encoding

type Encoding interface {
	Type() ValueType
	Encode(v interface{}) ([]byte, error)
	Decode(bytes []byte, v interface{}) error
}

type Formatter

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

func (Formatter) Line

func (m Formatter) Line(format string, v ...interface{})

func (Formatter) Next

func (m Formatter) Next() Formatter

func (Formatter) Write

func (m Formatter) Write(p []byte) (n int, err error)

type KeyValue

type KeyValue map[string]interface{}

type NameValue

type NameValue struct {
	Value *UIValue
	Name  string
}

func NewNamedValue

func NewNamedValue(name string, value interface{}) *NameValue

type NameValueList

type NameValueList struct {
	Kind  ComponentKind
	Name  string
	Items []*NameValue
}

func NewNameValueList

func NewNameValueList(name string) *NameValueList

func (*NameValueList) Append

func (m *NameValueList) Append(name string, value interface{})

func (*NameValueList) Component

func (m *NameValueList) Component() Component

func (*NameValueList) GetKind

func (m *NameValueList) GetKind() ComponentKind

func (*NameValueList) GetName

func (m *NameValueList) GetName() string

type UI

type UI interface {
	UI() Component
}

type UIComponents

type UIComponents []Component

func (UIComponents) GetKind

func (m UIComponents) GetKind() ComponentKind

type UIDataView

type UIDataView struct {
	Kind  ComponentKind
	Name  string
	Value *UIValue
}

func DataView

func DataView(v interface{}) *UIDataView

func (*UIDataView) Component

func (m *UIDataView) Component() Component

func (*UIDataView) GetKind

func (m *UIDataView) GetKind() ComponentKind

func (*UIDataView) GetName

func (m *UIDataView) GetName() string

type UIDocument

type UIDocument struct {
	Kind       ComponentKind
	Name       string
	Type       DocumentType
	Components []Component
}

func NewDocument

func NewDocument(doc DocumentType, name string, v ...interface{}) *UIDocument

func (*UIDocument) Add

func (m *UIDocument) Add(components ...Component) *UIDocument

func (*UIDocument) Component

func (m *UIDocument) Component() Component

func (*UIDocument) GetKind

func (m *UIDocument) GetKind() ComponentKind

func (*UIDocument) GetName

func (m *UIDocument) GetName() string

func (*UIDocument) JSON

func (m *UIDocument) JSON() ([]byte, error)

type UIKeyValue

type UIKeyValue struct {
	Kind  ComponentKind
	Items map[string]*UIValue
}

func NewKeyValues

func NewKeyValues(values KeyValue) *UIKeyValue

func (*UIKeyValue) Component

func (m *UIKeyValue) Component() Component

func (*UIKeyValue) GetKind

func (m *UIKeyValue) GetKind() ComponentKind

func (*UIKeyValue) Set

func (m *UIKeyValue) Set(key string, v interface{})

type UILabel

type UILabel struct {
	Kind       ComponentKind
	Name       string
	Title      string
	Components []Component
}

func Label

func Label(name string, v ...interface{}) *UILabel

func (*UILabel) Component

func (m *UILabel) Component() Component

func (*UILabel) GetKind

func (m *UILabel) GetKind() ComponentKind

func (*UILabel) GetName

func (m *UILabel) GetName() string

type UIValue

type UIValue struct {
	Type  ValueType
	Value interface{}
}

func NewValue

func NewValue(value interface{}) *UIValue

func NewValueByBytes

func NewValueByBytes(bytes []byte) (value *UIValue)

func (*UIValue) Simple

func (m *UIValue) Simple() interface{}

func (*UIValue) String

func (m *UIValue) String() string

func (*UIValue) View

func (m *UIValue) View() string

type ValueType

type ValueType int

type Valued

type Valued interface {
	GetValue() *UIValue
}

type Writer

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

func NewWriter

func NewWriter(w io.Writer) Writer

func (Writer) Next

func (m Writer) Next() Writer

func (Writer) Write

func (m Writer) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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