Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FCoalgebra ¶
FCoalgebra is one JSON node builder. F-coalgeras accepting zero amount of childs are primitive JSONs (constructors) arbitrary F-coalgebra may constructs JSON with N childs passed as strings if it unable to do it, it should panic
type GenerationRules ¶
type GenerationRules map[uint][]FCoalgebra
GenerationRules is just a map of child count to F-coalgebras which accepts that count of childs you should care about arity of F-coalgebras
var ( // see example of default generation rules DefaultGenerationRules GenerationRules = map[uint][]FCoalgebra{ 0: {numberConstructor, stringConstructor, arrayConstructor}, 1: {fCoalgebraJSONA, fCoalgebraJSONB, arrayConstructor}, 2: {fCoalgebraJSONC, arrayConstructor}, 3: {arrayConstructor}, } // this rules do not generate collisions like 0 == "0" WithoutCollisionGenerationRules GenerationRules = map[uint][]FCoalgebra{ 0: {numberConstructor, arrayConstructor}, 1: {fCoalgebraJSONB, arrayConstructor}, 2: {fCoalgebraJSONC, arrayConstructor}, 3: {arrayConstructor}, } )
type JSONGenerator ¶
type JSONGenerator struct {
// contains filtered or unexported fields
}
func NewJSONGenerator ¶
func NewJSONGenerator(generationRules GenerationRules) *JSONGenerator
NewJSONGenerator creates JSONGenerator with generation rules if generationRules rules are nil, default will be used
Click to show internal directories.
Click to hide internal directories.