Documentation ¶
Overview ¶
Package san is a SAN (https://astrocorp.net/san) parser and manipulation library.
Index ¶
Constants ¶
const (
// Version is the san's parser version
Version = "0.5.1"
)
Variables ¶
This section is empty.
Functions ¶
func Load ¶ added in v0.2.0
Load is a sortcut for Readfile + Unmarshal use it like: err = san.Load("myfile.san", &myStruct)
func Marshal ¶
Marshal returns the SAN encoding of sata. Behavior is similar to the Go json encoder, except that there is no concept of a Marshaler interface or MarshalSAN function for sub-structs, and currently only definite types can be marshaled (i.e. no `interface{}`). The following struct annotations are supported:
san:"Field" Overrides the field's name to output. omitempty When set, empty values and groups are not emitted.
Note that pointers are automatically assigned the "omitempty" option, as SAN explicitly does not handle null values (saying instead the label should be dropped). Tree structural types and corresponding marshal types:
*Tree (*)struct, (*)map[string]interface{} []*Tree (*)[](*)struct, (*)[](*)map[string]interface{} []interface{} (as interface{}) (*)[]primitive, (*)[]([]interface{}) interface{} (*)primitive
Tree primitive types and corresponding marshal types:
uint64 uint, uint8-uint64, pointers to same int64 int, int8-uint64, pointers to same float64 float32, float64, pointers to same string string, pointers to same bool bool, pointers to same
Types ¶
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
Decoder reads and decodes SAN values from an input stream.
type Marshaler ¶
Marshaler is the interface implemented by types that can marshal themselves into valid SAN.
type Unmarshaler ¶ added in v0.4.5
Unmarshaler is the interface implemented by types that can unmarshal a SAN description of themselves. The input can be assumed to be a valid encoding of a SAN value. UnmarshalSAN must copy the SAN data if it wishes to retain the data after returning.