json

package
v10.0.37 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 6, 2020 License: MIT Imports: 12 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloneMap

func CloneMap(kv map[string]interface{}) map[string]interface{}

CloneMap makes a copy of map

func CreateObject

func CreateObject(object Object, kv map[string]interface{}, mapping map[string][]string) error

CreateObject will create a new model object from kv

func Deserialize

func Deserialize(r io.Reader, dser Deserializer) error

Deserialize will return a function which will Deserialize in a flexible way the JSON in reader

func DottedFind

func DottedFind(key string, o map[string]interface{}) (interface{}, error)

DottedFind will attempt to look for a dotted key such as a.b.c in {"a":{"b":{"c": true}}}

func IsJSONPathNil

func IsJSONPathNil(val interface{}) bool

IsJSONPathNil is the value is nil

func IsJSONPathNotFound

func IsJSONPathNotFound(err error) bool

IsJSONPathNotFound returns true if the error is a not found type error

func JoinTable

func JoinTable(dir string, fromtable string, frompath string, totable string, topath string, kv map[string]interface{}) (map[string]map[string]interface{}, error)

JoinTable will join 2 tables from dir into a map of joined maps

func ReadFile

func ReadFile(f string, out interface{}) error

ReadFile Tries to open a file from the file system and read it into an object

func RegisterAction

func RegisterAction(name string, action Action)

RegisterAction will register a new action

func StreamToMap

func StreamToMap(fp string, keypath string, results map[string]map[string]interface{}, insert bool) error

StreamToMap will stream a file into results

func Stringify

func Stringify(v interface{}, opts ...interface{}) string

Stringify will return a JSON formatted string. pass an optional second argument to pretty print

Types

type Action

type Action func(args ...interface{}) (interface{}, error)

Action is the signature for handling registered actions

type Deserializer

type Deserializer func(line json.RawMessage) error

Deserializer is a callback which will take a json RawMessage for processing

type Object

type Object interface {
	FromMap(kv map[string]interface{})
}

Object is a schema model object interface

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL