Documentation
¶
Index ¶
- Variables
- func ConfigInstance() interface{}
- func FindCommentOnAttrs(attrs []schema.Attr) string
- func GetAtlasSchemaForDBSchema(ctx context.Context, connectionString, schema string) (*schema.Schema, error)
- func ListRawResults(ctx context.Context, d *plugin.QueryData, _ *plugin.HydrateData) (interface{}, error)
- func ListTableRecords(ctx context.Context, d *plugin.QueryData, _ *plugin.HydrateData) (interface{}, error)
- func MakeRawSQLQuery(ctx context.Context, connectionString, schema string, table string, ...) ([]map[string]any, error)
- func MakeSQLQuery(ctx context.Context, connectionString, schema string, table string, ...) ([]map[string]any, error)
- func Plugin(ctx context.Context) *plugin.Plugin
- func PluginTables(ctx context.Context, d *plugin.TableMapData) (map[string]*plugin.Table, error)
- func PostgresColTypeToSteampipeColType(ctx context.Context, col *schema.Column) proto.ColumnType
- type PostgresConfig
Constants ¶
This section is empty.
Variables ¶
var ConfigSchema = map[string]*schema.Attribute{ "connection_string": {Type: schema.TypeString}, "schema": {Type: schema.TypeString}, "tables_to_expose": {Type: schema.TypeList, Elem: &schema.Attribute{Type: schema.TypeString}}, }
Functions ¶
func ConfigInstance ¶
func ConfigInstance() interface{}
func FindCommentOnAttrs ¶
FindCommentOnAttrs tries to locate an Attr among the passed array that corresponds to a comment, and returns it if found. Otherwise, returns an empty string. This function can be used to identify the comment that is attached to a schema, table or column.
func GetAtlasSchemaForDBSchema ¶
func GetAtlasSchemaForDBSchema(ctx context.Context, connectionString, schema string) (*schema.Schema, error)
GetAtlasSchemaForDBSchema gets the Atlas schema (as in, the metadata) for a Postgres schema (as in, the hierarchy below a database and above a table, such as `public`). Must receive a connection string in the format expected by pgx (https://pkg.go.dev/github.com/jackc/pgx/v5#hdr-Establishing_a_Connection)
func ListRawResults ¶
func ListTableRecords ¶
func MakeRawSQLQuery ¶
func MakeRawSQLQuery(ctx context.Context, connectionString, schema string, table string, query string) ([]map[string]any, error)
MakeRawSQLQuery sends a raw SQL query to a remote DB, and returns any results
func MakeSQLQuery ¶
func MakeSQLQuery(ctx context.Context, connectionString, schema string, table string, quals plugin.KeyColumnQualMap) ([]map[string]any, error)
MakeSQLQuery composes a SQL query from a set of quals, sends it to a remote DB, and returns any results
func PluginTables ¶
func PostgresColTypeToSteampipeColType ¶
PostgresColTypeToSteampipeColType converts an Atlas column type to a Steampipe column. Atlas column types correspond almost one-to-one to actual SQL types, either standard SQL or Postgres extensions. For example, DECIMAL, FLOAT and CURRENCY become DOUBLEs on Steampipe
Types ¶
type PostgresConfig ¶
type PostgresConfig struct { ConnectionString *string `cty:"connection_string"` Schema *string `cty:"schema"` TablesToExpose []string `cty:"tables_to_expose"` }
func GetConfig ¶
func GetConfig(connection *plugin.Connection) PostgresConfig
GetConfig :: retrieve and cast connection config from query data
func (PostgresConfig) GetConnectionString ¶
func (c PostgresConfig) GetConnectionString() (string, error)
func (PostgresConfig) GetSchema ¶
func (c PostgresConfig) GetSchema() string
GetSchema returns the schema that was configured in the .spc file, if available, and "public" otherwise
func (PostgresConfig) GetTablesToExpose ¶
func (c PostgresConfig) GetTablesToExpose() []string
GetTablesToExpose returns the slice of table blobs that was configured in the .spc file, if set, and ["*"] otherwise (which will expose every table)
func (PostgresConfig) String ¶
func (c PostgresConfig) String() string