Documentation
¶
Index ¶
- Variables
- func NewPostgresPlugin() *engine.Plugin
- func NormalizeType(typeName string) string
- type PostgresPlugin
- func (p *PostgresPlugin) DB(config *engine.PluginConfig) (*gorm.DB, error)
- func (p *PostgresPlugin) FormatGeometryValue(rawBytes []byte, columnType string) string
- func (p *PostgresPlugin) GetAllSchemasQuery() string
- func (p *PostgresPlugin) GetColumnConstraints(config *engine.PluginConfig, schema string, storageUnit string) (map[string]map[string]any, error)
- func (p *PostgresPlugin) GetColumnsForTable(config *engine.PluginConfig, schema string, storageUnit string) ([]engine.Column, error)
- func (p *PostgresPlugin) GetCreateTableQuery(db *gorm.DB, schema string, storageUnit string, columns []engine.Record) string
- func (p *PostgresPlugin) GetDatabaseMetadata() *engine.DatabaseMetadata
- func (p *PostgresPlugin) GetDatabases(config *engine.PluginConfig) ([]string, error)
- func (p *PostgresPlugin) GetForeignKeyRelationships(config *engine.PluginConfig, schema string, storageUnit string) (map[string]*engine.ForeignKeyRelationship, error)
- func (p *PostgresPlugin) GetGraphQueryDB(db *gorm.DB, schema string) *gorm.DB
- func (p *PostgresPlugin) GetLastInsertID(db *gorm.DB) (int64, error)
- func (p *PostgresPlugin) GetPlaceholder(index int) string
- func (p *PostgresPlugin) GetPrimaryKeyColQuery() string
- func (p *PostgresPlugin) GetSSLStatus(config *engine.PluginConfig) (*engine.SSLStatus, error)
- func (p *PostgresPlugin) GetStorageUnitExistsQuery() string
- func (p *PostgresPlugin) GetSupportedOperators() map[string]string
- func (p *PostgresPlugin) GetTableInfoQuery() string
- func (p *PostgresPlugin) GetTableNameAndAttributes(rows *sql.Rows) (string, []engine.Record)
- func (p *PostgresPlugin) NormalizeType(typeName string) string
- func (p *PostgresPlugin) RawExecute(config *engine.PluginConfig, query string, params ...any) (*engine.GetRowsResult, error)
Constants ¶
This section is empty.
Variables ¶
var AliasMap = map[string]string{
"INT": "INTEGER",
"INT2": "SMALLINT",
"INT4": "INTEGER",
"INT8": "BIGINT",
"SERIAL2": "SMALLSERIAL",
"SERIAL4": "SERIAL",
"SERIAL8": "BIGSERIAL",
"FLOAT": "DOUBLE PRECISION",
"FLOAT4": "REAL",
"FLOAT8": "DOUBLE PRECISION",
"BOOL": "BOOLEAN",
"VARCHAR": "CHARACTER VARYING",
"CHAR": "CHARACTER",
"BPCHAR": "CHARACTER",
"TIMESTAMP WITHOUT TIME ZONE": "TIMESTAMP",
"TIMESTAMPTZ": "TIMESTAMP WITH TIME ZONE",
"TIME WITHOUT TIME ZONE": "TIME",
"TIMETZ": "TIME WITH TIME ZONE",
}
AliasMap maps PostgreSQL type aliases to their canonical names. All keys and values are UPPERCASE.
var TypeDefinitions = []engine.TypeDefinition{ {ID: "SMALLINT", Label: "smallint", Category: engine.TypeCategoryNumeric}, {ID: "INTEGER", Label: "integer", Category: engine.TypeCategoryNumeric}, {ID: "BIGINT", Label: "bigint", Category: engine.TypeCategoryNumeric}, {ID: "SERIAL", Label: "serial", Category: engine.TypeCategoryNumeric}, {ID: "BIGSERIAL", Label: "bigserial", Category: engine.TypeCategoryNumeric}, {ID: "SMALLSERIAL", Label: "smallserial", Category: engine.TypeCategoryNumeric}, {ID: "DECIMAL", Label: "decimal", HasPrecision: true, DefaultPrecision: engine.IntPtr(10), Category: engine.TypeCategoryNumeric}, {ID: "NUMERIC", Label: "numeric", HasPrecision: true, DefaultPrecision: engine.IntPtr(10), Category: engine.TypeCategoryNumeric}, {ID: "REAL", Label: "real", Category: engine.TypeCategoryNumeric}, {ID: "DOUBLE PRECISION", Label: "double precision", Category: engine.TypeCategoryNumeric}, {ID: "MONEY", Label: "money", Category: engine.TypeCategoryNumeric}, {ID: "CHARACTER VARYING", Label: "varchar", HasLength: true, DefaultLength: engine.IntPtr(255), Category: engine.TypeCategoryText}, {ID: "CHARACTER", Label: "char", HasLength: true, DefaultLength: engine.IntPtr(1), Category: engine.TypeCategoryText}, {ID: "TEXT", Label: "text", Category: engine.TypeCategoryText}, {ID: "BYTEA", Label: "bytea", Category: engine.TypeCategoryBinary}, {ID: "TIMESTAMP", Label: "timestamp", Category: engine.TypeCategoryDatetime}, {ID: "TIMESTAMP WITH TIME ZONE", Label: "timestamptz", Category: engine.TypeCategoryDatetime}, {ID: "DATE", Label: "date", Category: engine.TypeCategoryDatetime}, {ID: "TIME", Label: "time", Category: engine.TypeCategoryDatetime}, {ID: "TIME WITH TIME ZONE", Label: "timetz", Category: engine.TypeCategoryDatetime}, {ID: "BOOLEAN", Label: "boolean", Category: engine.TypeCategoryBoolean}, {ID: "JSON", Label: "json", Category: engine.TypeCategoryJSON}, {ID: "JSONB", Label: "jsonb", Category: engine.TypeCategoryJSON}, {ID: "UUID", Label: "uuid", Category: engine.TypeCategoryOther}, {ID: "CIDR", Label: "cidr", Category: engine.TypeCategoryOther}, {ID: "INET", Label: "inet", Category: engine.TypeCategoryOther}, {ID: "MACADDR", Label: "macaddr", Category: engine.TypeCategoryOther}, {ID: "POINT", Label: "point", Category: engine.TypeCategoryOther}, {ID: "LINE", Label: "line", Category: engine.TypeCategoryOther}, {ID: "LSEG", Label: "lseg", Category: engine.TypeCategoryOther}, {ID: "BOX", Label: "box", Category: engine.TypeCategoryOther}, {ID: "PATH", Label: "path", Category: engine.TypeCategoryOther}, {ID: "CIRCLE", Label: "circle", Category: engine.TypeCategoryOther}, {ID: "POLYGON", Label: "polygon", Category: engine.TypeCategoryOther}, {ID: "XML", Label: "xml", Category: engine.TypeCategoryOther}, {ID: "ARRAY", Label: "array", Category: engine.TypeCategoryOther}, {ID: "HSTORE", Label: "hstore", Category: engine.TypeCategoryOther}, }
TypeDefinitions contains the canonical PostgreSQL types with metadata for UI.
Functions ¶
func NewPostgresPlugin ¶
func NormalizeType ¶
NormalizeType converts a PostgreSQL type alias to its canonical form.
Types ¶
type PostgresPlugin ¶
type PostgresPlugin struct {
gorm_plugin.GormPlugin
}
func (*PostgresPlugin) DB ¶
func (p *PostgresPlugin) DB(config *engine.PluginConfig) (*gorm.DB, error)
func (*PostgresPlugin) FormatGeometryValue ¶
func (p *PostgresPlugin) FormatGeometryValue(rawBytes []byte, columnType string) string
FormatGeometryValue formats PostgreSQL geometry data for display. PostGIS columns use EWKB format which we decode to WKT. Native PostgreSQL geometric types (point, line, etc.) return text representation.
func (*PostgresPlugin) GetAllSchemasQuery ¶
func (p *PostgresPlugin) GetAllSchemasQuery() string
func (*PostgresPlugin) GetColumnConstraints ¶
func (p *PostgresPlugin) GetColumnConstraints(config *engine.PluginConfig, schema string, storageUnit string) (map[string]map[string]any, error)
GetColumnConstraints retrieves column constraints for PostgreSQL tables
func (*PostgresPlugin) GetColumnsForTable ¶
func (p *PostgresPlugin) GetColumnsForTable(config *engine.PluginConfig, schema string, storageUnit string) ([]engine.Column, error)
GetColumnsForTable returns columns with computed column detection. Generated columns (GENERATED ALWAYS AS) are marked as IsComputed.
func (*PostgresPlugin) GetCreateTableQuery ¶
func (*PostgresPlugin) GetDatabaseMetadata ¶
func (p *PostgresPlugin) GetDatabaseMetadata() *engine.DatabaseMetadata
GetDatabaseMetadata returns PostgreSQL metadata for frontend configuration.
func (*PostgresPlugin) GetDatabases ¶
func (p *PostgresPlugin) GetDatabases(config *engine.PluginConfig) ([]string, error)
func (*PostgresPlugin) GetForeignKeyRelationships ¶
func (p *PostgresPlugin) GetForeignKeyRelationships(config *engine.PluginConfig, schema string, storageUnit string) (map[string]*engine.ForeignKeyRelationship, error)
func (*PostgresPlugin) GetGraphQueryDB ¶
func (*PostgresPlugin) GetLastInsertID ¶
func (p *PostgresPlugin) GetLastInsertID(db *gorm.DB) (int64, error)
GetLastInsertID returns the most recently auto-generated ID using PostgreSQL's lastval().
func (*PostgresPlugin) GetPlaceholder ¶
func (p *PostgresPlugin) GetPlaceholder(index int) string
func (*PostgresPlugin) GetPrimaryKeyColQuery ¶
func (p *PostgresPlugin) GetPrimaryKeyColQuery() string
func (*PostgresPlugin) GetSSLStatus ¶
func (p *PostgresPlugin) GetSSLStatus(config *engine.PluginConfig) (*engine.SSLStatus, error)
GetSSLStatus queries PostgreSQL to get the actual SSL status of the connection. Uses pg_stat_ssl system view. Results are cached.
func (*PostgresPlugin) GetStorageUnitExistsQuery ¶
func (p *PostgresPlugin) GetStorageUnitExistsQuery() string
func (*PostgresPlugin) GetSupportedOperators ¶
func (p *PostgresPlugin) GetSupportedOperators() map[string]string
func (*PostgresPlugin) GetTableInfoQuery ¶
func (p *PostgresPlugin) GetTableInfoQuery() string
func (*PostgresPlugin) GetTableNameAndAttributes ¶
func (*PostgresPlugin) NormalizeType ¶
func (p *PostgresPlugin) NormalizeType(typeName string) string
NormalizeType converts PostgreSQL type aliases to their canonical form.
func (*PostgresPlugin) RawExecute ¶
func (p *PostgresPlugin) RawExecute(config *engine.PluginConfig, query string, params ...any) (*engine.GetRowsResult, error)