Documentation
¶
Index ¶
- Constants
- func BuildSchemaMetadata(rows *sql.Rows) (*schema.Metadata, error)
- func CreateIntrospectionTables(ctx context.Context, workspaceResources *modconfig.WorkspaceResourceMaps, ...) error
- func CreatePreparedStatements(ctx context.Context, resourceMaps *modconfig.WorkspaceResourceMaps, ...) error
- func ExecuteQuery(ctx context.Context, queryString string, client Client) (*queryresult.ResultStreamer, error)
- func GetActor(bearer string, client *http.Client) (string, error)
- func GetConnectionString(workspaceHandle, token string) (string, error)
- func GetPassword(userHandle, bearer string, client *http.Client) (string, error)
- func GetPreparedStatementsSQL(resourceMaps *modconfig.WorkspaceResourceMaps) map[string]string
- func GetWorkspaceHost(userHandle, workspaceHandle, bearer string, client *http.Client) (string, string, error)
- func PgEscapeName(name string) string
- func PgEscapeSearchPath(searchPath []string) []string
- func PgEscapeString(str string) string
- func UpdateIntrospectionTables(workspaceResources *modconfig.WorkspaceResourceMaps, client Client) error
- func UpdatePreparedStatements(ctx context.Context, ...) error
- func WaitForConnection(pool *sql.DB) bool
- type Client
- type ColumnTag
- type EnsureSessionStateCallback
- type InitResult
- type QueryInitData
- type WorkspaceResourceProvider
Constants ¶
const TagColumn = "column"
TagColumn is the tag used to specify the column name and type in the introspection tables
Variables ¶
This section is empty.
Functions ¶
func BuildSchemaMetadata ¶ added in v0.9.0
func CreateIntrospectionTables ¶ added in v0.9.0
func ExecuteQuery ¶
func ExecuteQuery(ctx context.Context, queryString string, client Client) (*queryresult.ResultStreamer, error)
ExecuteQuery executes a single query. If shutdownAfterCompletion is true, shutdown the client after completion
func GetConnectionString ¶ added in v0.9.0
func GetPassword ¶ added in v0.9.0
func GetPreparedStatementsSQL ¶ added in v0.9.0
func GetPreparedStatementsSQL(resourceMaps *modconfig.WorkspaceResourceMaps) map[string]string
func GetWorkspaceHost ¶ added in v0.9.0
func PgEscapeName ¶
func PgEscapeSearchPath ¶ added in v0.9.0
PgEscapeSearchPath applies postgres escaping to search path and remove whitespace
func PgEscapeString ¶
PgEscapeString escapes strings which are to be inserted use a custom escape tag to avoid chance of clash with the escaped text https://medium.com/@lnishada/postgres-dollar-quoting-6d23e4f186ec
func UpdateIntrospectionTables ¶ added in v0.9.0
func UpdateIntrospectionTables(workspaceResources *modconfig.WorkspaceResourceMaps, client Client) error
func UpdatePreparedStatements ¶
func UpdatePreparedStatements(ctx context.Context, prevResourceMaps, currentResourceMaps *modconfig.WorkspaceResourceMaps, client Client) error
UpdatePreparedStatements first attempts to deallocate all prepared statements in workspace, then recreates them
func WaitForConnection ¶ added in v0.8.3
waits for the db to start accepting connections and returns true returns false if the dbClient does not start within a stipulated time,
Types ¶
type Client ¶
type Client interface {
Close() error
LoadSchema()
SchemaMetadata() *schema.Metadata
ConnectionMap() *steampipeconfig.ConnectionDataMap
GetCurrentSearchPath() ([]string, error)
SetSessionSearchPath(...string) error
ExecuteSync(ctx context.Context, query string, disableSpinner bool) (*queryresult.SyncQueryResult, error)
Execute(ctx context.Context, query string, disableSpinner bool) (res *queryresult.Result, err error)
CacheOn() error
CacheOff() error
CacheClear() error
SetEnsureSessionDataFunc(EnsureSessionStateCallback)
RefreshConnectionAndSearchPaths() *steampipeconfig.RefreshConnectionResult
}
type EnsureSessionStateCallback ¶ added in v0.8.3
type InitResult ¶
func (*InitResult) AddMessage ¶
func (r *InitResult) AddMessage(message string)
func (*InitResult) AddWarnings ¶
func (r *InitResult) AddWarnings(warnings ...string)
func (*InitResult) DisplayMessages ¶
func (r *InitResult) DisplayMessages()
func (*InitResult) HasMessages ¶
func (r *InitResult) HasMessages() bool
type QueryInitData ¶
type QueryInitData struct {
Queries []string
Workspace WorkspaceResourceProvider
Client Client
Result *InitResult
}
func NewQueryInitData ¶
func NewQueryInitData() *QueryInitData
type WorkspaceResourceProvider ¶
type WorkspaceResourceProvider interface {
ResolveQueryAndArgs(arg string) (string, modconfig.PreparedStatementProvider, error)
GetQueryMap() map[string]*modconfig.Query
GetControlMap() map[string]*modconfig.Control
GetResourceMaps() *modconfig.WorkspaceResourceMaps
GetControl(controlName string) (*modconfig.Control, bool)
SetupWatcher(client Client, onError func(err error)) error
}
WorkspaceResourceProvider is an interface encapsulating workspace functionality - provided to avoid db needing a reference to Workspace