Documentation ¶
Overview ¶
Package twig implements the twig key-value data format.
Twig is a simple text key-value format. Keys and values are separated by NULL bytes (bytes of value 0). Keys and values may not contain a NULL byte. All other characters are allowed.
Keys have an additional constraint. Each key must contain a "name" and a "version" number. These describe the semantics of the data stored for that key, and the precise meaning is left to the user. The key and name are separated (in the binary format) by a delimiter, which is currently '/'.
The key name may not be empty.
In practice, twig keys look like (the final slash is the delimiter between key and version):
anexample/235 // name: anexample, version: 235 heres one with spaces/9 // name: heres one with spaces, version: 9 heres/one/with/slashes/9 // name: heres/one/with/slashes, version: 9
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Data ¶
Data represents a collection of twig key-value pairs. It provides methods for converting them to/from binary
func (*Data) Contains ¶
Contains checks whether or not a key exists in the data values by name and version
func (*Data) Get ¶
Get fetches a value from the value store by key name and version, and whether or not the key was in the values
func (*Data) MarshalBinary ¶
MarshalBinary converts this Data into twig binary form.
func (*Data) Set ¶
Set sets a twig key-version data entry. If the entry does not exist, it is created
func (*Data) UnmarshalBinary ¶
UnmarshalBinary populates a Data from raw binary in Twig format
type Key ¶
Key represents a key within the twig data
func FromString ¶
FromString converts a string into a Key struct by separating the name and version