reports

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2019 License: GPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EventsLogged uint64

EventsLogged records the number of events logged

Functions

func CloseQuery added in v0.1.2

func CloseQuery(queryID uint64) (string, error)

CloseQuery closes the query now

func GetData

func GetData(queryID uint64) (string, error)

GetData returns the data for the provided QueryID

func LogEvent

func LogEvent(event Event) error

LogEvent adds an event to the eventQueue for later logging

func Shutdown

func Shutdown()

Shutdown stops the reports service

func Startup

func Startup()

Startup starts the reports service

Types

type Event

type Event struct {
	// Name - A human readable name for this event. (ie "session_new" is a new session event)
	Name string
	// Table - the DB table that this event modifies (or nil)
	Table string
	// SQLOp - the SQL operation needed to serialize the event to the DB
	// 1 - INSERT // 2 - UPDATE
	SQLOp int
	// The columns in the DB this inserts for INSERTS or qualifies if matches for UPDATES
	Columns map[string]interface{}
	// The columns to modify for UPDATE events
	ModifiedColumns map[string]interface{}
}

Event stores an arbitrary event

func CreateEvent

func CreateEvent(name string, table string, sqlOp int, columns map[string]interface{}, modifiedColumns map[string]interface{}) Event

CreateEvent creates an Event

type Query

type Query struct {
	ID   uint64
	Rows *sql.Rows
}

Query holds the results of a database query operation

func CreateQuery

func CreateQuery(reportEntryStr string) (*Query, error)

CreateQuery submits a database query and returns the results

type QueryCategoriesOptions added in v0.1.2

type QueryCategoriesOptions struct {
	GroupColumn         string `json:"groupColumn"`
	AggregationFunction string `json:"aggregationFunction"`
	AggregationValue    string `json:"aggregationValue"`
	Limit               int    `json:"limit"`
	OrderByColumn       int    `json:"orderByColumn"`
	OrderAsc            bool   `json:"orderAsc"`
}

QueryCategoriesOptions stores the query options for CATEGORY type reports

type QuerySeriesOptions added in v0.1.2

type QuerySeriesOptions struct {
	Columns             []string `json:"columns"`
	TimeIntervalSeconds int      `json:"timeIntervalSeconds"`
}

QuerySeriesOptions stores the query options for SERIES type reports

type QueryTextOptions added in v0.1.2

type QueryTextOptions struct {
	Columns []string `json:"columns"`
}

QueryTextOptions stores the query options for TEXT type reports

type ReportColumnDisambiguation added in v0.1.2

type ReportColumnDisambiguation struct {
	ColumnName    string `json:"columnName"`
	NewColumnName string `json:"newColumnName"`
}

ReportColumnDisambiguation remove and ambigious column names (used for joins)

type ReportCondition added in v0.1.2

type ReportCondition struct {
	Column   string      `json:"column"`
	Operator string      `json:"operator"`
	Value    interface{} `json:"value"`
}

ReportCondition holds a SQL reporting condition (ie client = 1.2.3.4)

type ReportEntry added in v0.1.2

type ReportEntry struct {
	UniqueID             string                       `json:"uniqueId"`
	Name                 string                       `json:"name"`
	Category             string                       `json:"category"`
	Description          string                       `json:"description"`
	DisplayOrder         int                          `json:"displayOrder"`
	ReadOnly             bool                         `json:"readOnly"`
	Type                 string                       `json:"type"`
	Table                string                       `json:"table"`
	Conditions           []ReportCondition            `json:"conditions"`
	ColumnDisambiguation []ReportColumnDisambiguation `json:"columnDisambiguation"`
	UserConditions       []ReportCondition            `json:"userConditions"`
	QueryCategories      QueryCategoriesOptions       `json:"queryCategories"`
	QueryText            QueryTextOptions             `json:"queryText"`
	QuerySeries          QuerySeriesOptions           `json:"querySeries"`
}

ReportEntry is a report entry as defined in the JSON schema

Jump to

Keyboard shortcuts

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