Documentation ¶
Index ¶
- Variables
- func DeleteApp(ctx context.Context, engine string, appID string, ttl string, ...)
- func Eval(ctx context.Context, doc *enigma.Doc, args []string)
- func FatalError(fatalMessage ...interface{})
- func FormatBytes(bytes int) string
- func LogVerbose(message string)
- func PrintField(ctx context.Context, doc *enigma.Doc, fieldName string)
- func RelativeToProject(projectFile string, path string) string
- func Reload(ctx context.Context, doc *enigma.Doc, global *enigma.Global, silent bool, ...)
- func Save(ctx context.Context, doc *enigma.Doc, path string)
- func SetScript(ctx context.Context, doc *enigma.Doc, scriptFilePath string)
- func SetupConnections(ctx context.Context, doc *enigma.Doc, separateConnectionsFile string, ...) error
- func SetupEntities(ctx context.Context, doc *enigma.Doc, projectFile string, ...)
- func TidyUpEngineURL(engine string) string
- type ConnectionConfigEntry
- type ConnectionsConfigFile
- type EntitiesConfigFile
- type FieldModel
- type FieldSourceTableInfo
- type ModelMetadata
- type RestFieldMetadata
- type RestMetadata
- type RestTableMetadata
- type State
- type TableModel
Constants ¶
This section is empty.
Variables ¶
var QliVerbose bool
QliVerbose is set to true to indicate that verbose logging should be enabled.
Functions ¶
func Eval ¶
Eval builds a straight table hypercube based on the supplied argument, evaluates it and prints the result to system out.
func FatalError ¶ added in v0.0.3
func FatalError(fatalMessage ...interface{})
FatalError prints the supplied message and exists the process with code 1
func FormatBytes ¶ added in v0.0.3
FormatBytes takes a byte size integer and returns a string formatted with kilo, mega, giga prefixes.
func LogVerbose ¶
func LogVerbose(message string)
LogVerbose prints the supplied message to system out if verbose logging is enabled.
func PrintField ¶
PrintField prints the first few rows of a field to system out.
func RelativeToProject ¶
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, silent bool, 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 ¶
Save calls DoSave on the app and prints "Done" if it succeeded or "Save failed" to system out.
func SetupConnections ¶
func SetupConnections(ctx context.Context, doc *enigma.Doc, separateConnectionsFile string, projectConfigFilePath 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.
func SetupEntities ¶ added in v0.1.0
func SetupEntities(ctx context.Context, doc *enigma.Doc, projectFile string, entitiesPathsOnCommandLine string, entityType string)
SetupEntities reads all generic entities of the specified type from both the project file path and the config file path and updates the list of entities in the app.
func TidyUpEngineURL ¶ added in v0.1.0
TidyUpEngineURL tidies up an engine url fragment and returns a complete url.
Types ¶
type ConnectionConfigEntry ¶
type ConnectionConfigEntry struct { Type string Username string Password string ConnectionString 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 EntitiesConfigFile ¶ added in v0.1.0
EntitiesConfigFile defines a file that contains the different entities yaml string arrays.
func ReadEntitiesFile ¶ added in v0.1.0
func ReadEntitiesFile(path string) EntitiesConfigFile
ReadEntitiesFile reads the entity config file from the supplied path.
type FieldModel ¶ added in v0.0.3
type FieldModel struct { *enigma.FieldDescription RestMetadata *RestFieldMetadata //Sparse array with information about the source tables. FieldInTable []*enigma.FieldInTableData }
FieldModel represents one field in the data model. It contains information from both the QIX and Rest apis. It also contains an array (with compatible ordering with the main Table model ordering) with field per source table info.
func (*FieldModel) MemUsage ¶ added in v0.0.3
func (f *FieldModel) MemUsage() string
MemUsage returns the memory usage of the field.
type FieldSourceTableInfo ¶
FieldSourceTableInfo defines row count and key type for a field
type ModelMetadata ¶
type ModelMetadata struct { Tables []*TableModel Fields []*FieldModel SourceKeys []*enigma.SourceKeyRecord RestMetadata *RestMetadata RestTableMetadataByName map[string]*RestTableMetadata RestFieldMetadataByName map[string]*RestFieldMetadata FieldsInTableTexts map[string]string 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, headers http.Header, keyOnly bool) *ModelMetadata
GetModelMetadata retrives all available metadata about the app
func (*ModelMetadata) MemUsage ¶ added in v0.0.3
func (m *ModelMetadata) MemUsage() string
MemUsage returns the static memory usage of the whole data model if that information is available, "N/A" otherwise.
type RestFieldMetadata ¶ added in v0.0.3
type RestFieldMetadata 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"` }
RestFieldMetadata defines all available info about a a field
type RestMetadata ¶ added in v0.0.3
type RestMetadata struct { StaticByteSize int `json:"static_byte_size,omitempty"` Fields []*RestFieldMetadata `json:"fields"` Tables []*RestTableMetadata `json:"tables"` }
RestMetadata defines all available info from the metdata rest api.
func ReadRestMetadata ¶ added in v0.0.3
func ReadRestMetadata(url string, headers http.Header) (*RestMetadata, error)
ReadRestMetadata fetches metadata from the rest api.
type RestTableMetadata ¶ added in v0.0.3
type RestTableMetadata 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"` }
RestTableMetadata defines all available info about a table.
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, appID string, ttl string, headers http.Header, createAppIfMissing bool) *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 TableModel ¶ added in v0.0.3
type TableModel struct { *enigma.TableRecord RestMetadata *RestTableMetadata }
TableModel represents one table in the data model. It contains information from both the QIX and Rest apis
func (*TableModel) MemUsage ¶ added in v0.0.3
func (t *TableModel) MemUsage() string
MemUsage returns the memory usage by the table if that information is available, "N/A" otherwise.