Changes
1 changed files (+10/-0)
-
-
@@ -25,6 +25,9 @@// JSONItemUnmarshal can be set externally to populate a custom object based on its type var JSONItemUnmarshal JSONUnmarshalerFn = nil // NotEmptyChecker checks if an object is empty var NotEmptyChecker NotEmptyCheckerFn = NotEmpty // TyperFn is the type of the function which returns an Item struct instance // for a specific ActivityVocabularyType type TyperFn func(ActivityVocabularyType) (Item, error)
-
@@ -32,6 +35,9 @@// JSONUnmarshalerFn is the type of the function that will load the data from a fastjson.Value into an Item // that the current package doesn't know about. type JSONUnmarshalerFn func(ActivityVocabularyType, *fastjson.Value, Item) error // NotEmptyCheckerFn is the type of a function that checks if an object is empty type NotEmptyCheckerFn func(Item) bool func JSONGetID(val *fastjson.Value) ID { i := val.Get("id").GetStringBytes()
-
@@ -186,6 +192,7 @@ i, err := ItemTyperFunc(typ)if err != nil || IsNil(i) { return nil, nil } var empty = func(i Item) bool { return !NotEmptyChecker(i) } switch typ { case "":
-
@@ -257,6 +264,9 @@ err = JSONItemUnmarshal(typ, val, i)} if err != nil { return nil, err } if empty(i) { return nil, nil } return i, nil
-