Documentation
¶
Index ¶
- Constants
- func ApplyTo(j Json, obj interface{}) bool
- func DecodeString(s string) string
- func GetBool(v Value) (bool, bool)
- func GetFloat(v Value) (float64, bool)
- func GetInt(v Value) (int64, bool)
- func GetLength(a *Array) int
- func GetNull(v Value) bool
- func GetString(v Value) (string, bool)
- func SetRComp(rComp io.Reader)
- type Array
- type Bool
- type Field
- type Fields
- type Float
- type Integer
- type Json
- type JsonVal
- type Maker
- func (m *Maker) BuildArray()
- func (m *Maker) BuildField(name string)
- func (m *Maker) BuildObject()
- func (m *Maker) GetJson() Json
- func (m *Maker) PushBoolean(b bool)
- func (m *Maker) PushField(f *Field)
- func (m *Maker) PushFloat(f float64)
- func (m *Maker) PushInteger(n int64)
- func (m *Maker) PushJson(j Json)
- func (m *Maker) PushNull()
- func (m *Maker) PushString(s string)
- func (m *Maker) PushValue(v Value)
- func (m *Maker) Roll(n int)
- func (m *Maker) RollD(n int)
- func (m *Maker) StartArray()
- func (m *Maker) StartObject()
- func (m *Maker) Swap()
- type Null
- type Object
- type ReadSeekCloser
- type String
- type Value
- type Values
Constants ¶
const ( ObjectKind = iota ArrayKind )
const ( JsonKind = iota StringKind IntegerKind FloatKind BoolKind NullKind )
Variables ¶
This section is empty.
Functions ¶
func ApplyTo ¶
ApplyTo modifies obj according to j; warning: obj must be a pointer to a global, exported and modifiable record variable of its module, and only its exported and modifiable fields are taken into account; in obj, records must not be extended (i.e. their static types must match their dynamic types), but pointers to arrays, if their lengths are not already correct, are allocated with the same length as in j, provided that their BaseTyp is in {(Meta) boolTyp, sCharTyp, charTyp, byteTyp, sIntTyp, intTyp, sRealTyp, realTyp, longTyp, recTyp} (in particular, no pointers; if you want pointers, replace them by records with a pointer field).
func DecodeString ¶
Types ¶
type Json ¶
type Json interface { JKind() int GetObject() *Object GetArray() *Array // 'GetString' returns a formatted string for reading GetString() string // 'GetFlatString' returns a compact string GetFlatString() string // 'Write' writes 'GetString()' to 'w' Write(w io.Writer) // 'WriteFlat' writes 'GetFlatString' to 'w' WriteFlat(w io.Writer) }
A Json may be an 'Object' or an 'Array'
func BuildJsonFrom ¶
func BuildJsonFrom(obj interface{}) Json
BuildJsonFrom builds and returns a Json describing obj; warning: obj must be nil or a pointer to a global exported struct variable of its package, and only its exported fields are taken into account
type Maker ¶
type Maker struct {
// contains filtered or unexported fields
}
A 'Maker' builds Json by stack manipulation
func (*Maker) BuildArray ¶
func (m *Maker) BuildArray()
BuildArray builds a json array from all the values stacked from the last StartArray call and stacks it
func (*Maker) BuildField ¶
BuildField builds the json object field whose name is name and whose value is the last element on the stack and replaces this element with the built field
func (*Maker) BuildObject ¶
func (m *Maker) BuildObject()
BuildObject builds a json object from all the fields stacked from the last StartObject call and stacks it
func (*Maker) PushBoolean ¶
PushBoolean pushes the boolean b on the stack
func (*Maker) PushInteger ¶
PushInteger pushes the integer n on the stack
func (*Maker) PushString ¶
PushString pushes the string s on the stack
type ReadSeekCloser ¶
type ReadSeekCloser interface { io.ReadCloser io.Seeker }
Directories
¶
Path | Synopsis |
---|---|
The package json is an implementation of the JSON language This package must be imported for its side effects when the JSON compiler is stored in "util/json/static" (file "compVar.go", variable "compiler")
|
The package json is an implementation of the JSON language This package must be imported for its side effects when the JSON compiler is stored in "util/json/static" (file "compVar.go", variable "compiler") |