Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WriteBytes ¶
func WriteBytes(t Translator, v C) ([]byte, error)
WriteBytes uses the given Translator to turn a C into a byte slice
func WriteString ¶
func WriteString(t Translator, v C) (string, error)
WriteString uses the given Translator to turn a C into a string
Types ¶
type C ¶
type C map[string]interface{}
C represents an arbitrary block of JSON which base64-encoded and typically transmitted as an HTTP header. Access should normally be done through an instance of Interface, which this type implements.
func ReadBytes ¶
func ReadBytes(t Translator, v []byte) (C, error)
ReadBytes is like ReadString, but with a byte slice
func ReadString ¶
func ReadString(t Translator, v string) (C, error)
ReadString uses the supplied Translator to extract a C instance from an arbitrary string
type Compliance ¶
type Compliance int
const ( Full Compliance = iota Missing Invalid MissingFields )
func GetCompliance ¶
func GetCompliance(err error) Compliance
GetCompliance examines an error for Compliance information.
If err is nil, Full is returned If err implements Comply, the result of the Compliance method is returne Otherwise, Invalid is returned
func (Compliance) String ¶
func (c Compliance) String() string
type Comply ¶
type Comply interface {
Compliance() Compliance
}
type Error ¶
type Error struct { Err error C Compliance }
func (Error) Compliance ¶
func (e Error) Compliance() Compliance
type Interface ¶
type Interface interface { wrpmeta.Source // Get retrieves the raw value for a key, returning false if no such key exists Get(key string) (interface{}, bool) }
Interface represents a read-only view of a convey, and is the standard way to access convey information.
type Translator ¶
type Translator interface { // ReadFrom extracts base64-encoded JSON from the supplied reader and produces a convey map. // Any error in either base64 decoding or JSON unmarshaling results in an error. ReadFrom(io.Reader) (C, error) // WriteTo encodes the given convey map into its on-the-wire repesentation, which is base64-encoded // JSON. Any error in either base64 encoding or JSON marhsaling results in an error. WriteTo(io.Writer, C) error }
Translator provides translation between the on-the-wire representation of a convey map and its runtime representation. Instances of Translator are safe for concurrent usage.
func NewTranslator ¶
func NewTranslator(encoding *base64.Encoding) Translator
NewTranslator produces a Translator which uses the specified base64 encoding. If the encoding is nil, base64.StdEncoding is used.