Documentation
¶
Overview ¶
Package data contains the definitions for the Soy data types.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultStructOptions = StructOptions{ LowerCamel: true, TimeFormat: time.RFC3339, }
Functions ¶
This section is empty.
Types ¶
type List ¶
type List []Value
type Map ¶
type Marshaler ¶
type Marshaler interface {
MarshalValue() Value
}
Marshaler is the interface implemented by entities that can marshal themselves into a data.Value.
type StructOptions ¶
type StructOptions struct {
LowerCamel bool // if true, convert field names to lowerCamel.
TimeFormat string // format string for time.Time. (if empty, use ISO-8601)
}
StructOptions provides flexibility in conversion of structs to soy's data.Map format.
func (StructOptions) Data ¶
func (c StructOptions) Data(obj interface{}) Map
type Value ¶
type Value interface {
// Truthy returns true according to the Soy definition of truthy and falsy values.
Truthy() bool
// String formats this value for display in a template.
String() string
// Type returns the Soy type of this object.
Type() Type
// Equals returns true if the two values are equal. Specifically, if:
// - They are comparable: they have the same Type, or they are Int and Float
// - (Primitives) They have the same value
// - (Lists, Maps) They are the same instance
// Uncomparable types and unequal values return false.
Equals(other Value) bool
}
Value represents a Soy data value, which may be one of the enumerated types.
func New ¶
func New(value interface{}) Value
New converts the given data into a soy data value, using DefaultStructOptions for structs.
func NewWith ¶
func NewWith(convert StructOptions, value interface{}) Value
NewWith converts the given data value soy data value, using the provided StructOptions for any structs encountered.
Click to show internal directories.
Click to hide internal directories.