Documentation ¶
Index ¶
- type DbClient
- func (c *DbClient) AcquireSession(ctx context.Context) (sessionResult *db_common.AcquireSessionResult)
- func (c *DbClient) AllSchemaNames() []string
- func (c *DbClient) CacheClear(ctx context.Context) error
- func (c *DbClient) CacheOff(ctx context.Context) error
- func (c *DbClient) CacheOn(ctx context.Context) error
- func (c *DbClient) Close(context.Context) error
- func (c *DbClient) ConnectionMap() *steampipeconfig.ConnectionDataMap
- func (c *DbClient) ConstructSearchPath(ctx context.Context, customSearchPath, searchPathPrefix []string) ([]string, error)
- func (c *DbClient) Execute(ctx context.Context, query string, args ...any) (*queryresult.Result, error)
- func (c *DbClient) ExecuteInSession(ctx context.Context, session *db_common.DatabaseSession, onComplete func(), ...) (res *queryresult.Result, err error)
- func (c *DbClient) ExecuteSync(ctx context.Context, query string, args ...any) (*queryresult.SyncQueryResult, error)
- func (c *DbClient) ExecuteSyncInSession(ctx context.Context, session *db_common.DatabaseSession, query string, ...) (*queryresult.SyncQueryResult, error)
- func (c *DbClient) ForeignSchemaNames() []string
- func (c *DbClient) GetCurrentSearchPath(ctx context.Context) ([]string, error)
- func (c *DbClient) GetCurrentSearchPathForDbConnection(ctx context.Context, databaseConnection *sql.Conn) ([]string, error)
- func (c *DbClient) GetDefaultSearchPath(ctx context.Context) []string
- func (c *DbClient) GetRequiredSessionSearchPath() []string
- func (c *DbClient) GetSchemaFromDB(ctx context.Context) (*schema.Metadata, error)
- func (c *DbClient) LoadSchemaNames(ctx context.Context) error
- func (c *DbClient) RefreshConnectionAndSearchPaths(ctx context.Context, _ ...string) *steampipeconfig.RefreshConnectionResult
- func (c *DbClient) RefreshSessions(ctx context.Context) *db_common.AcquireSessionResult
- func (c *DbClient) SetRequiredSessionSearchPath(ctx context.Context) error
- type DbConnectionCallback
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DbClient ¶
type DbClient struct {
// contains filtered or unexported fields
}
DbClient wraps over `sql.DB` and gives an interface to the database
func NewDbClient ¶
func (*DbClient) AcquireSession ¶
func (c *DbClient) AcquireSession(ctx context.Context) (sessionResult *db_common.AcquireSessionResult)
func (*DbClient) AllSchemaNames ¶ added in v0.19.0
AllSchemaNames implements Client
func (*DbClient) CacheClear ¶
CacheClear implements Client
func (*DbClient) Close ¶
Close implements Client closes the connection to the database and shuts down the backend
func (*DbClient) ConnectionMap ¶
func (c *DbClient) ConnectionMap() *steampipeconfig.ConnectionDataMap
func (*DbClient) ConstructSearchPath ¶ added in v0.19.0
func (*DbClient) Execute ¶
func (c *DbClient) Execute(ctx context.Context, query string, args ...any) (*queryresult.Result, error)
Execute implements Client execute the query in the given Context NOTE: The returned Result MUST be fully read - otherwise the connection will block and will prevent further communication
func (*DbClient) ExecuteInSession ¶
func (c *DbClient) ExecuteInSession(ctx context.Context, session *db_common.DatabaseSession, onComplete func(), query string, args ...any) (res *queryresult.Result, err error)
ExecuteInSession implements Client execute the query in the given Context using the provided DatabaseSession ExecuteInSession assumes no responsibility over the lifecycle of the DatabaseSession - that is the responsibility of the caller NOTE: The returned Result MUST be fully read - otherwise the connection will block and will prevent further communication
func (*DbClient) ExecuteSync ¶
func (c *DbClient) ExecuteSync(ctx context.Context, query string, args ...any) (*queryresult.SyncQueryResult, error)
ExecuteSync implements Client execute a query against this client and wait for the result
func (*DbClient) ExecuteSyncInSession ¶
func (c *DbClient) ExecuteSyncInSession(ctx context.Context, session *db_common.DatabaseSession, query string, args ...any) (*queryresult.SyncQueryResult, error)
ExecuteSyncInSession implements Client execute a query against this client and wait for the result
func (*DbClient) ForeignSchemaNames ¶
ForeignSchemaNames implements Client
func (*DbClient) GetCurrentSearchPath ¶
GetCurrentSearchPath implements Client query the database to get the current session search path
func (*DbClient) GetCurrentSearchPathForDbConnection ¶
func (c *DbClient) GetCurrentSearchPathForDbConnection(ctx context.Context, databaseConnection *sql.Conn) ([]string, error)
GetCurrentSearchPathForDbConnection queries the database to get the current session search path using the given connection
func (*DbClient) GetDefaultSearchPath ¶
GetDefaultSearchPath builds default search path from the connection schemas, book-ended with public and internal
func (*DbClient) GetRequiredSessionSearchPath ¶
GetRequiredSessionSearchPath implements Client
func (*DbClient) GetSchemaFromDB ¶
GetSchemaFromDB requests for all columns of tables backed by steampipe plugins and creates golang struct representations from the result
func (*DbClient) LoadSchemaNames ¶ added in v0.19.0
LoadSchemaNames implements Client
func (*DbClient) RefreshConnectionAndSearchPaths ¶
func (c *DbClient) RefreshConnectionAndSearchPaths(ctx context.Context, _ ...string) *steampipeconfig.RefreshConnectionResult
RefreshConnectionAndSearchPaths implements Client
func (*DbClient) RefreshSessions ¶
func (c *DbClient) RefreshSessions(ctx context.Context) *db_common.AcquireSessionResult
RefreshSessions terminates the current connections and creates a new one - repopulating session data
func (*DbClient) SetRequiredSessionSearchPath ¶
SetRequiredSessionSearchPath implements Client if either a search-path or search-path-prefix is set in config, set the search path (otherwise fall back to user search path) this just sets the required search path for this client - when creating a database session, we will actually set the searchPath