Documentation ¶
Index ¶
- Variables
- func GetDoc(traveler gdbi.Traveler, namespace string) map[string]interface{}
- func GetJSONPath(path string) string
- func GetNamespace(path string) string
- func RenderTraveler(traveler gdbi.Traveler, template interface{}) interface{}
- func SelectTravelerFields(t gdbi.Traveler, keys ...string) gdbi.Traveler
- func TravelerPathExists(traveler gdbi.Traveler, path string) bool
- func TravelerPathLookup(traveler gdbi.Traveler, path string) interface{}
- func TravelerSetValue(traveler gdbi.Traveler, path string, val interface{}) error
Constants ¶
This section is empty.
Variables ¶
var Current = "__current__"
Current represents the 'current' traveler namespace
Functions ¶
func GetDoc ¶
GetDoc returns the document referenced by the provided namespace.
Example for a traveler containing:
{ "current": {...}, "marks": { "gene": { "gid": 1, "label": "gene", "data": { "symbol": { "ensembl": "ENSG00000012048", "hgnc": 1100, "entrez": 672 } } } } } }
GetDoc(traveler, "gene") returns:
{ "gid": 1, "label": "gene", "data": { "symbol": { "ensembl": "ENSG00000012048", "hgnc": 1100, "entrez": 672 } } }
func GetJSONPath ¶
GetJSONPath strips the namespace from the path and returns the valid Json path within the document referenced by the namespace
Example: GetJSONPath("gene.symbol.ensembl") returns "$.data.symbol.ensembl"
func GetNamespace ¶
GetNamespace returns the namespace of the provided path
Example: GetNamespace("$gene.symbol.ensembl") returns "gene"
func RenderTraveler ¶
RenderTraveler takes a template and fills in the values using the data structure
func SelectTravelerFields ¶
SelectTravelerFields returns a new copy of the traveler with only the selected fields
func TravelerPathExists ¶
TravelerPathExists returns true if the field exists in the given Traveler
func TravelerPathLookup ¶
TravelerPathLookup gets the value of a field in the given Traveler
Example for a traveler containing:
{ "current": {...}, "marks": { "gene": { "gid": 1, "label": "gene", "data": { "symbol": { "ensembl": "ENSG00000012048", "hgnc": 1100, "entrez": 672 } } } } } }
TravelerPathLookup(travler, "$gene.symbol.ensembl") returns "ENSG00000012048"
Types ¶
This section is empty.