Documentation ¶
Index ¶
- func EnsureSessionData(ctx context.Context, source *SessionDataSource, client db_common.Client) error
- func LoadResourceNames(workspacePath string) (*modconfig.WorkspaceResources, error)
- type SessionDataSource
- type Workspace
- func (w *Workspace) CheckRequiredPluginsInstalled() error
- func (w *Workspace) Close()
- func (w *Workspace) GetChildControls() []*modconfig.Control
- func (w *Workspace) GetControl(controlName string) (*modconfig.Control, bool)
- func (w *Workspace) GetControlMap() map[string]*modconfig.Control
- func (w *Workspace) GetMod(modName string) *modconfig.Mod
- func (w *Workspace) GetQueriesFromArgs(args []string) ([]string, *modconfig.WorkspaceResourceMaps, error)
- func (w *Workspace) GetQuery(queryName string) (*modconfig.Query, bool)
- func (w *Workspace) GetQueryMap() map[string]*modconfig.Query
- func (w *Workspace) GetResourceMaps() *modconfig.WorkspaceResourceMaps
- func (w *Workspace) Mods() []*modconfig.Mod
- func (w *Workspace) PublishReportEvent(e reportevents.ReportEvent)
- func (w *Workspace) RegisterReportEventHandler(handler reportevents.ReportEventHandler)
- func (w *Workspace) ResolveControlQuery(control *modconfig.Control) (string, error)
- func (w *Workspace) ResolveQuery(sqlString string, args *modconfig.QueryArgs) (string, modconfig.PreparedStatementProvider, error)
- func (w *Workspace) ResolveQueryAndArgs(sqlString string) (string, modconfig.PreparedStatementProvider, error)
- func (w *Workspace) SetupWatcher(client db_common.Client, errorHandler func(error)) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnsureSessionData ¶ added in v0.8.3
func EnsureSessionData(ctx context.Context, source *SessionDataSource, client db_common.Client) error
EnsureSessionData determines whether session scoped data (introspection tables and prepared statements) exists for this session, and if not, creates it
func LoadResourceNames ¶ added in v0.8.0
func LoadResourceNames(workspacePath string) (*modconfig.WorkspaceResources, error)
LoadResourceNames builds lists of all workspace respurce names
Types ¶
type SessionDataSource ¶ added in v0.8.3
type SessionDataSource struct {
// contains filtered or unexported fields
}
func NewSessionDataSource ¶ added in v0.8.3
func NewSessionDataSource(items ...*modconfig.WorkspaceResourceMaps) *SessionDataSource
NewSessionDataSource creates a new SessionDataSource object if a single parameter is poassed, this map is used for both prepared statements and introspection tables if a second parameter is passed, it will be a minimal set of resources for which we need to create prepared statements this will be populated for batch mode querying
type Workspace ¶
type Workspace struct { Path string Mod *modconfig.Mod // maps of mod resources from this mod and ALL DEPENDENCIES, keyed by long and short names QueryMap map[string]*modconfig.Query ControlMap map[string]*modconfig.Control BenchmarkMap map[string]*modconfig.Benchmark ModMap map[string]*modconfig.Mod ReportMap map[string]*modconfig.Report PanelMap map[string]*modconfig.Panel // contains filtered or unexported fields }
func (*Workspace) CheckRequiredPluginsInstalled ¶ added in v0.6.0
func (*Workspace) GetChildControls ¶ added in v0.5.0
GetChildControls builds a flat list of all controls in the worlspace, including dependencies
func (*Workspace) GetControl ¶ added in v0.6.1
func (*Workspace) GetControlMap ¶ added in v0.6.1
func (*Workspace) GetMod ¶ added in v0.5.0
GetMod attempts to return the mod with a name matching 'modName' It first checks the workspace mod, then checks all mod dependencies
func (*Workspace) GetQueriesFromArgs ¶ added in v0.8.0
func (w *Workspace) GetQueriesFromArgs(args []string) ([]string, *modconfig.WorkspaceResourceMaps, error)
GetQueriesFromArgs retrieves queries from args
For each arg check if it is a named query or a file, before falling back to treating it as sql
func (*Workspace) GetQueryMap ¶ added in v0.6.1
func (*Workspace) GetResourceMaps ¶ added in v0.5.0
func (w *Workspace) GetResourceMaps() *modconfig.WorkspaceResourceMaps
GetResourceMaps returns all resource maps NOTE: this function DOES NOT LOCK the load lock so should only be called in a context where the file watcher is not running
func (*Workspace) Mods ¶ added in v0.5.0
Mods returns a flat list of all mods - the workspace mod and depdnency mods
func (*Workspace) PublishReportEvent ¶ added in v0.7.1
func (w *Workspace) PublishReportEvent(e reportevents.ReportEvent)
func (*Workspace) RegisterReportEventHandler ¶ added in v0.7.1
func (w *Workspace) RegisterReportEventHandler(handler reportevents.ReportEventHandler)
func (*Workspace) ResolveControlQuery ¶ added in v0.8.0
ResolveControlQuery resolves the query for the given Control
func (*Workspace) ResolveQuery ¶ added in v0.8.0
func (*Workspace) ResolveQueryAndArgs ¶ added in v0.8.0
func (w *Workspace) ResolveQueryAndArgs(sqlString string) (string, modconfig.PreparedStatementProvider, error)
ResolveQueryAndArgs attempts to resolve 'arg' to a query and query args