Skip to content
This repository has been archived by the owner on Aug 9, 2018. It is now read-only.

Commit

Permalink
Fixup reader interface
Browse files Browse the repository at this point in the history
  • Loading branch information
mildred committed Jan 22, 2016
1 parent 8ca058f commit 1c37932
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion reader/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const (
TokenKey
TokenArray
TokenIndex
TokenValuePart
TokenValue
TokenEndNode
TokenEndArray
Expand All @@ -31,6 +32,8 @@ func TokenName(tok ReaderToken) string {
return "TokenArray"
case TokenIndex:
return "TokenIndex"
case TokenValuePart:
return "TokenValuePart"
case TokenValue:
return "TokenValue"
case TokenEndNode:
Expand Down Expand Up @@ -89,7 +92,7 @@ type NodeReader interface {
// f({"items"}, TokenEndArray, nil)
// f({}, TokenKey, "count")
// f({"count"}, TokenValue, 3)
// f({}, TokenEndNode, nil)
// f({}, TokenEndNode, nil)
//
// Iteration order for maps is fixed by the order of the pairs in memory.
//
Expand All @@ -104,5 +107,16 @@ type NodeReader interface {
// Returning any other error will abort the read process and the error will be
// passed as a return value of the Read() function.
//
// When the value to read is too large, the value can be transmitted in
// chunks. The chunks are all introduced by the TokenValuePart until the last
// chunk which is introduced by TokenValue
//
// Allowed value types are:
//
// - for numbers: int, int64, uint64, *"math/big".Int, float32, float64
// - for strings: string, []byte
// - for booleans: bool
// - for null: nil
//
Read(f ReadFun) error
}

0 comments on commit 1c37932

Please sign in to comment.