db_client

package
v0.13.0-alpha.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 4, 2022 License: AGPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

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 NewDbClient(ctx context.Context, connectionString string) (*DbClient, error)

func (*DbClient) AcquireSession added in v0.10.0

func (c *DbClient) AcquireSession(ctx context.Context) (res *db_common.AcquireSessionResult)

func (*DbClient) CacheClear

func (c *DbClient) CacheClear(ctx context.Context) error

CacheClear implements Client

func (*DbClient) CacheOff

func (c *DbClient) CacheOff(ctx context.Context) error

CacheOff implements Client

func (*DbClient) CacheOn

func (c *DbClient) CacheOn(ctx context.Context) error

CacheOn implements Client

func (*DbClient) Close

func (c *DbClient) Close(context.Context) error

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) ContructSearchPath added in v0.10.0

func (c *DbClient) ContructSearchPath(ctx context.Context, requiredSearchPath []string, searchPathPrefix []string, currentUserSearchPath []string) ([]string, error)

func (*DbClient) Execute

func (c *DbClient) Execute(ctx context.Context, query string) (*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 added in v0.10.0

func (c *DbClient) ExecuteInSession(ctx context.Context, session *db_common.DatabaseSession, query string, onComplete func()) (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) (*queryresult.SyncQueryResult, error)

ExecuteSync implements Client execute a query against this client and wait for the result

func (*DbClient) ExecuteSyncInSession added in v0.10.0

func (c *DbClient) ExecuteSyncInSession(ctx context.Context, session *db_common.DatabaseSession, query string) (*queryresult.SyncQueryResult, error)

ExecuteSyncInSession implements Client execute a query against this client and wait for the result

func (*DbClient) ForeignSchemas added in v0.11.0

func (c *DbClient) ForeignSchemas() []string

ForeignSchemas implements Client

func (*DbClient) GetCurrentSearchPath

func (c *DbClient) GetCurrentSearchPath(ctx context.Context) ([]string, error)

GetCurrentSearchPath implements Client query the database to get the current search path

func (*DbClient) GetSchemaFromDB added in v0.11.0

func (c *DbClient) GetSchemaFromDB(ctx context.Context, schemas []string) (*schema.Metadata, error)

func (*DbClient) LoadForeignSchemaNames added in v0.11.0

func (c *DbClient) LoadForeignSchemaNames(ctx context.Context) error

func (*DbClient) RefreshConnectionAndSearchPaths

func (c *DbClient) RefreshConnectionAndSearchPaths(ctx context.Context) *steampipeconfig.RefreshConnectionResult

RefreshConnectionAndSearchPaths implements Client

func (*DbClient) RefreshSessions added in v0.10.0

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) SetEnsureSessionDataFunc

func (c *DbClient) SetEnsureSessionDataFunc(f db_common.EnsureSessionStateCallback)

func (*DbClient) SetSessionSearchPath

func (c *DbClient) SetSessionSearchPath(ctx context.Context, currentUserSearchPath ...string) error

SetSessionSearchPath 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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL