Documentation ¶
Index ¶
- Constants
- func EnsureDBInstalled()
- func ExecuteQuery(queryString string) (*results.ResultStreamer, error)
- func IsInstalled() bool
- func PgEscapeName(name string) string
- func PgEscapeString(str string) string
- func RefreshConnections(client *Client) error
- func Shutdown(client *Client, invoker Invoker)
- func StartService(invoker Invoker)
- func TrimLogs()
- type Client
- type InteractiveClient
- type Invoker
- type Passwords
- type RunningDBInstanceInfo
- type StartListenType
- type StartResult
- type StopStatus
Constants ¶
const ( // InvokerService :: Invoker - when invoked by `service start` InvokerService Invoker = "service" // InvokerQuery :: Invoker - when invoked by `query` InvokerQuery = "query" // InvokerInstaller :: Invoker - when invoked by the `installer` InvokerInstaller = "installer" // InvokerPlugin :: Invoker - when invoked by the `pluginmanager` InvokerPlugin = "plugin" )
Variables ¶
This section is empty.
Functions ¶
func EnsureDBInstalled ¶
func EnsureDBInstalled()
EnsureDBInstalled makes sure that the embedded pg database is installed and running
func ExecuteQuery ¶
func ExecuteQuery(queryString string) (*results.ResultStreamer, error)
ExecuteQuery :: entry point for executing ad-hoc queries from outside the package
func IsInstalled ¶
func IsInstalled() bool
IsInstalled :: checks and reports whether the embedded database is installed and setup
func PgEscapeName ¶
func PgEscapeString ¶
func RefreshConnections ¶ added in v0.2.0
RefreshConnections :: load required connections and refresh
func Shutdown ¶ added in v0.2.0
Shutdown :: closes the client connection and stops the database instance if the given `invoker` matches
func StartService ¶
func StartService(invoker Invoker)
StartService :: invokes `steampipe service start --listen local --refresh=false --invoker query`
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps over `sql.DB` and gives an interface to the database
func GetClient ¶
GetClient ensures that the database instance is running and returns a `Client` to interact with it
func (*Client) ConnectionMap ¶
func (c *Client) ConnectionMap() *steampipeconfig.ConnectionMap
ConnectionMap :: returns the latest connection map
func (*Client) ExecuteSync ¶
func (c *Client) ExecuteSync(query string) (*results.SyncQueryResult, error)
ExecuteSync :: execute a query against this client and wait for the result
func (*Client) SchemaMetadata ¶
SchemaMetadata :: returns the latest schema metadata
type InteractiveClient ¶
type InteractiveClient struct {
// contains filtered or unexported fields
}
InteractiveClient :: wrapper over *Client and *prompt.Prompt along to facilitate interactive query prompt
func (*InteractiveClient) InteractiveQuery ¶
func (c *InteractiveClient) InteractiveQuery(resultsStreamer *results.ResultStreamer, onCompleteCallback func())
InteractiveQuery :: start an interactive prompt and return
type RunningDBInstanceInfo ¶
type RunningDBInstanceInfo struct { Pid int Port int Listen []string ListenType StartListenType Invoker Invoker Password string User string Database string }
RunningDBInstanceInfo :: contains data about the running process and it's credentials
func GetStatus ¶
func GetStatus() (*RunningDBInstanceInfo, error)
GetStatus :: check that the db instance is running and returns it's details
type StartListenType ¶
type StartListenType string
StartListenType :: pseudoEnum of network binding for postgres
const ( // ListenTypeNetwork :: StartListenType - bind to all known interfaces ListenTypeNetwork StartListenType = "network" // ListenTypeLocal :: StartListenType - bind to localhost only ListenTypeLocal = "local" )
func (StartListenType) IsValid ¶
func (slt StartListenType) IsValid() error
IsValid :: validator for StartListenType known values
type StartResult ¶
type StartResult int
StartResult :: pseudoEnum for outcomes of Start
const ( // ServiceStarted :: StartResult - Service was started ServiceStarted StartResult = iota // ServiceAlreadyRunning :: StartResult - Service was already running ServiceAlreadyRunning // ServiceFailedToStart :: StartResult - Could not start service ServiceFailedToStart )
func StartDB ¶
func StartDB(port int, listen StartListenType, invoker Invoker) (StartResult, error)
StartDB :: start the database is not already running
type StopStatus ¶
type StopStatus int
StopStatus :: pseudoEnum for service stop result
const ( // ServiceStopped :: StopStatus - service was stopped ServiceStopped StopStatus = iota // ServiceNotRunning :: StopStatus - service was not running ServiceNotRunning // ServiceStopFailed :: StopStatus - service could not be stopped ServiceStopFailed // ServiceStopTimedOut :: StopStatus - service stop attempt timed out ServiceStopTimedOut )