mirror of
https://github.com/turbot/steampipe.git
synced 2026-02-15 13:00:08 -05:00
* Provide feedback for failed prepared statements * Move error functions to error_helpers * Make maintenance client retriable
35 lines
868 B
Go
35 lines
868 B
Go
package db_client
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"github.com/turbot/steampipe/pkg/constants"
|
|
)
|
|
|
|
// CacheOn implements Client
|
|
func (c *DbClient) CacheOn(ctx context.Context) error {
|
|
return c.executeCacheCommand(ctx, constants.CommandCacheOn)
|
|
}
|
|
|
|
// CacheOff implements Client
|
|
func (c *DbClient) CacheOff(ctx context.Context) error {
|
|
return c.executeCacheCommand(ctx, constants.CommandCacheOff)
|
|
}
|
|
|
|
// CacheClear implements Client
|
|
func (c *DbClient) CacheClear(ctx context.Context) error {
|
|
return c.executeCacheCommand(ctx, constants.CommandCacheClear)
|
|
}
|
|
|
|
func (c *DbClient) executeCacheCommand(ctx context.Context, controlCommand string) error {
|
|
_, err := c.pool.Exec(ctx, fmt.Sprintf(
|
|
"insert into %s.%s (%s) values ('%s')",
|
|
constants.CommandSchema,
|
|
constants.CommandTableCache,
|
|
constants.CommandTableCacheOperationColumn,
|
|
controlCommand,
|
|
))
|
|
return err
|
|
}
|