internal

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2018 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var QliVerbose bool

QliVerbose is set to true to indicate that verbose logging should be enabled.

Functions

func Eval

func Eval(ctx context.Context, doc *enigma.Doc, args []string)

Eval builds a straight table hypercube based on the supplied argument, evaluates it and prints the result to system out.

func LogVerbose

func LogVerbose(message string)

LogVerbose prints the supplied message to system out if verbose logging is enabled.

func PrintField

func PrintField(ctx context.Context, doc *enigma.Doc, fieldName string)

PrintField prints the first few rows of a field to system out.

func RelativeToProject

func RelativeToProject(projectFile string, path string) string

RelativeToProject transforms a path to be relative to a base path of the project file

func Reload

func Reload(ctx context.Context, doc *enigma.Doc, global *enigma.Global, skipTransientLogs bool)

Reload reloads the app and prints the progress to system out. If true is supplied to skipTransientLogs the live ticking of table row counts is disabled (useful for testing).

func Save

func Save(ctx context.Context, doc *enigma.Doc, path string)

Save calls DoSave on the app and prints "Done" if it succeeded or "Save failed" to system out.

func SetScript

func SetScript(ctx context.Context, doc *enigma.Doc, scriptFilePath string)

SetScript loads the script file and sets it in the app.

func SetupConnections

func SetupConnections(ctx context.Context, doc *enigma.Doc, projectFilePath string, configFilePath string) error

SetupConnections reads all connections from both the project file path and the config file path and updates the list of connections in the app.

Types

type ConnectionConfigEntry

type ConnectionConfigEntry struct {
	Type     string
	Username string
	Password string
	Path     string
	Settings map[string]string
}

ConnectionConfigEntry defines the content of a connection in either the project config yml file or a connections yml file.

type ConnectionsConfigFile

type ConnectionsConfigFile struct {
	Connections map[string]ConnectionConfigEntry
}

ConnectionsConfigFile defines the content of a connections yml file.

func ReadConnectionsFile

func ReadConnectionsFile(path string) ConnectionsConfigFile

ReadConnectionsFile reads the connections config file from the supplied path.

type FieldMetadata

type FieldMetadata struct {
	// Name of the field.
	Name string `json:"name"`
	// No List of table names.
	SrcTables []string `json:"src_tables"`
	// If set to true, it means that the field is a system field. The default value is false.
	IsSystem bool `json:"is_system"`
	// If set to true, it means that the field is hidden. The default value is false.
	IsHidden bool `json:"is_hidden"`
	// If set to true, it means that the field is a semantic. The default value is false.
	IsSemantic bool `json:"is_semantic"`
	// If set to true, only distinct field values are shown. The default value is false.
	DistinctOnly bool `json:"distinct_only"`
	// Number of distinct field values.
	Cardinal int `json:"cardinal"`
	// Total number of field values.
	TotalCount int `json:"total_count"`
	// If set to true, it means that the field is locked. The default value is false.
	IsLocked bool `json:"is_locked"`
	// If set to true, it means that the field has one and only one selection (not 0 and not more than 1). If this property is set to true, the field cannot be cleared anymore and no more selections can be performed in that field. The default value is false.
	AlwaysOneSelected bool `json:"always_one_selected"`
	// Is set to true if the value is a numeric. The default value is false.
	IsNumeric bool `json:"is_numeric"`
	// Field comment.
	Comment string `json:"comment"`
	// No Gives information on a field. For example, it can return the type of the field. Examples: key, text, ASCII.
	Tags []string `json:"tags"`
	// Static RAM memory used in bytes.
	ByteSize int `json:"byte_size"`
}

FieldMetadata defines all available info about a a field

type FieldSourceTableInfo

type FieldSourceTableInfo struct {
	RowCount string
	KeyType  string
}

FieldSourceTableInfo defines row count and key type for a field

type Metadata

type Metadata struct {
	StaticByteSize int              `json:"static_byte_size,omitempty"`
	Fields         []*FieldMetadata `json:"fields"`
	Tables         []*TableMetadata `json:"tables"`
}

Metadata defines all available info from the metdata rest api.

func ReadMetadata

func ReadMetadata(url string) (*Metadata, error)

ReadMetadata fetches metadata from the rest api.

type ModelMetadata

type ModelMetadata struct {
	Tables                     []*enigma.TableRecord
	SourceKeys                 []*enigma.SourceKeyRecord
	Metadata                   *Metadata
	TableMetadataByName        map[string]*TableMetadata
	FieldMetadataByName        map[string]*FieldMetadata
	SystemTableLayout          *enigma.GenericObjectLayout
	FieldsInTable              map[string]string
	FieldNames                 []string
	TableNames                 []string
	FieldSourceTableInfoByName map[string][]FieldSourceTableInfo
	FieldInTableDataByNames    map[string]map[string]*enigma.FieldInTableData
	SampleContentByFieldName   map[string]string
}

ModelMetadata defines all available metadata around the data model.

func GetModelMetadata

func GetModelMetadata(ctx context.Context, doc *enigma.Doc, metaURL string, keyOnly bool) *ModelMetadata

GetModelMetadata retrives all available metadata about the app

type State

type State struct {
	Doc     *enigma.Doc
	Ctx     context.Context
	Global  *enigma.Global
	AppID   string
	MetaURL string
	Verbose bool
}

State contains all needed info about the current app including a go context to use when communicating with the engine.

func PrepareEngineState

func PrepareEngineState(ctx context.Context, engine string, sessionID string, appID string, ttl string) *State

PrepareEngineState makes sure that the app idenfied by the supplied parameters is created or opened or reconnected to depending on the state. The TTL feature is used to keep the app session loaded to improve performance.

type TableMetadata

type TableMetadata struct {
	// Name of the table.
	Name string `json:"name"`
	// If set to true, it means that the table is a system table. The default value is false.
	IsSystem bool `json:"is_system"`
	// If set to true, it means that the table is a semantic. The default value is false.
	IsSemantic bool `json:"is_semantic"`
	// If set to true, it means that the table is loose due to circular connection. The default value is false.
	IsLoose bool `json:"is_loose"`
	// of rows.
	NoOfRows int `json:"no_of_rows"`
	// of fields.
	NoOfFields int `json:"no_of_fields"`
	// of key fields.
	NoOfKeyFields int `json:"no_of_key_fields"`
	// Table comment.
	Comment string `json:"commen"`
	// RAM memory used in bytes.
	ByteSize int `json:"byte_size"`
}

TableMetadata defines all available info about a table.

Jump to

Keyboard shortcuts

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