parser

package
v0.0.0-...-4e66a53 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2018 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsSlicePtr

func IsSlicePtr(i interface{}) (isptr bool)

func ParseSFJSON

func ParseSFJSON(msg []byte, out interface{}) error

ParseSFJSON allows a slice of the expected json type to be passed in that will be populated with a object(s) parsed out of msg. The motivation for this is that SFDC returns a single object (e.g. {}) when only one object matches the query, but an array of objects (e.g. [{}, {}, ...]) when multiple objects match the query. Instead of requiring client code to know that SFDC returns different types based on number of results, allow clients to always pass in a slice.

Summary of parsing results given out object types:

single json object, out *slice -> *[T1]
json array of objects, out *slice -> *[T1, T2, ...]
single json object, out struct -> T
json array of objects, out slice -> error

Types

This section is empty.

Jump to

Keyboard shortcuts

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