Documentation
¶
Index ¶
- func CopyPresentValues(source, target map[string]interface{}, keys []string)
- func CreateRelations(source *Source, entry map[string]interface{}, unique map[string]bool, ...)
- func IntSliceContains(slice []int, val int) bool
- func InterfaceSliceContains(slice []interface{}, val interface{}) bool
- func ResultsContain(results []map[string]interface{}, entry map[string]interface{}, ...) bool
- func StringSliceContains(slice []string, val string) bool
- type Node
- type Processor
- type ProcessorPlugin
- type Relation
- type Source
- type SourcePlugin
- type Stats
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CopyPresentValues ¶
* Go through the list "keys" and copy "source" maps's values, * if such exist, into the "target". * * To be able to copy a field value of the internal child maps - * it's possible to specify a dot in a key name, function will split the * name by dots and try to find the expected internal map and it's field value. * * Example: * * The source: { * "x": 10, * "y": { * "z": "hello" * }, * "n.m": "world" * } * * Keys to copy: * * x - will copy the value "10" * y.z - will copy the value "hello" * n.m - will copy the value "world", as there is no internal map "n"
func CreateRelations ¶
func CreateRelations(source *Source, entry map[string]interface{}, unique map[string]bool, counter *int, mx *sync.Mutex, results *[]map[string]interface{})
* Create relations from a data source response's single entry
func IntSliceContains ¶
* Check whether the slice contains the given integer
func InterfaceSliceContains ¶
func InterfaceSliceContains(slice []interface{}, val interface{}) bool
* Check whether the slice contains the given interface
func ResultsContain ¶
func ResultsContain(results []map[string]interface{}, entry map[string]interface{}, relation *Relation) bool
* Check whether current entry is identical to any of * the already collected unique results. * * This returns to the user only unique entries from a data source. * If single relation's From.ID == To.ID, but even one attribute is different - * JavaScript-side will get both entries and merge their attributes
func StringSliceContains ¶
* Check whether the slice contains the given string
Types ¶
type Node ¶
type Node struct { ID string `yaml:"id"` Group string `yaml:"group"` Search string `yaml:"search"` Attributes []string `yaml:"attributes"` VarTypes []*struct { Regex string `yaml:"regex"` RegexCompiled *regexp.Regexp `yaml:"-"` Group string `yaml:"group"` Search string `yaml:"search"` Label string `yaml:"label"` } `yaml:"varTypes"` }
type ProcessorPlugin ¶
type ProcessorPlugin interface { // Return instance configuration Conf() *Processor // Set specific parameters for the instance, // establish connection, etc. Setup(*Processor) error // Process data source's received data in a background Process([]map[string]interface{}) ([]map[string]interface{}, error) // Stop the processor when the core service stops, // gracefully disconnect if needed Stop() error }
* Plugin interface to be implemented by the processor plugins
type Source ¶
type Source struct { Name string `yaml:"name"` Label string `yaml:"label"` Icon string `yaml:"icon"` Plugin string `yaml:"plugin"` InGlobal bool `yaml:"inGlobal"` IncludeDatetime bool `yaml:"includeDatetime"` SupportsSQL bool `yaml:"supportsSQL"` Timeout time.Duration `yaml:"timeout"` Access map[string]string `yaml:"access"` QueryFields []string `yaml:"queryFields"` IncludeFields []string `yaml:"includeFields"` StatsFields []string `yaml:"statsFields"` ReplaceFields map[string]string `yaml:"replaceFields"` Relations []*Relation `yaml:"relations"` }
type SourcePlugin ¶
type SourcePlugin interface { // Return data source instance configuration Conf() *Source // Set specific parameters for the data source instance, // establish connection, etc. Setup(*Source, int) error // Get a list of all known data source's fields // for the Web GUI autocomplete Fields() ([]string, error) // Execute the given query. // Returns results, statistics, debug info & error Search(*sqlparser.Select) ([]map[string]interface{}, map[string]interface{}, map[string]interface{}, error) // Stop the collector when the core service stops, // gracefully disconnect from the data source if needed Stop() error }
* Plugin interface to be implemented by the data source plugins
type Stats ¶
type Stats struct { Fields map[string]*sortedmap.SortedMap // contains filtered or unexported fields }
* Structure to contain statistics data * if some data source has too many entries to return * (above the preconfigured limit)
func (*Stats) ToJSON ¶
* Convert sorted-map object to the native map, * converted to the JSON later, * so the Web GUI can draw interactive charts. * * Receives a data source name
func (*Stats) Update ¶
* Update statistics of the received entries from some data source. * When the amount of returned entries becomes too large * users will receive the statistics info instead of the graph relations data. * * Receives: * entry - single entry from a data source * key - statistics chart field to update, * one entry increases the value by 1