Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultRegister = NewRegistry()
DefaultRegister is a Registry which used as default in this package.
Functions ¶
Types ¶
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
Decoder provides LTSV doc decoding.
func NewDecoderWithRegistry ¶
NewDecoderWithRegistry creates a new decoder with Registry.
type Doc ¶
type Doc interface {
Marshaler
Unmarshaler
}
Doc defines required functions for LTSV marshal/unmarshal-able type.
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
Encoder encodes Marshalers as LTSV lines.
func NewEncoder ¶
NewEncoder cerates a new Encoder using io.Writer.
func NewEncoderWithRegistry ¶
NewEncoderWithRegistry creates a new Encoder with Registry.
type LabelValue ¶
type LabelValue struct {
Label string
Value interface{}
}
LabelValue is a pair of label and value.
func NewLabelValue ¶
func NewLabelValue(label string, value interface{}) *LabelValue
NewLabelValue creates a labeled value.
func (LabelValue) ValueString ¶
func (v LabelValue) ValueString() string
ValueString get a string representation of value.
type Proxy ¶ added in v0.9.1
type Proxy struct {
// contains filtered or unexported fields
}
Proxy represents a proxy for Values.
func (*Proxy) Get ¶ added in v0.9.1
func (p *Proxy) Get(label string) *ProxyValue
Get returns a proxy for a value at first.
func (*Proxy) Opt ¶ added in v0.9.1
func (p *Proxy) Opt(label string) *ProxyValue
Opt return a proxy for a value without error propagation.
type ProxyValue ¶ added in v0.9.1
type ProxyValue struct {
// contains filtered or unexported fields
}
Proxy represents a proxy for LabelValue.
func (*ProxyValue) Error ¶ added in v0.9.1
func (pv *ProxyValue) Error() error
Error gets a last occurred error.
func (*ProxyValue) Int32 ¶ added in v0.9.1
func (pv *ProxyValue) Int32() int32
Int32 returns a int32 value.
func (*ProxyValue) Int64 ¶ added in v0.9.1
func (pv *ProxyValue) Int64() int64
Int64 returns a int64 value.
func (*ProxyValue) String ¶ added in v0.9.1
func (pv *ProxyValue) String() string
String returns a string value.
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader reads LTSV values.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry is a regisry of LTSV marshal/unmarshal-able types.
type Unmarshaler ¶
Unmarshaler defines LTSV marshaler
func DecodeAll ¶
func DecodeAll(b []byte) ([]Unmarshaler, error)
DecodeAll decodes all unmarshalers from []byte.
type Values ¶
type Values []*LabelValue
Values is an array of LabelValue
func NewValues ¶
func NewValues(args ...interface{}) Values
NewValues creates a Values with capacity.