Documentation
¶
Index ¶
- type DBTX
- type GetTableRowSecurityParams
- type ListColumnsForTableParams
- type ListColumnsForTableRow
- type ListConstraintsForTableParams
- type ListConstraintsForTableRow
- type ListExtensionsRow
- type ListFunctionsForSchemaRow
- type ListIndexesForTableParams
- type ListIndexesForTableRow
- type ListMaterializedViewsForSchemaRow
- type ListPoliciesForTableParams
- type ListPoliciesForTableRow
- type ListSequencesForSchemaRow
- type ListSignatureConstraintsRow
- type ListSignatureExtensionsRow
- type ListSignatureFunctionsRow
- type ListSignatureIndexesRow
- type ListSignaturePoliciesRow
- type ListSignatureTableColumnsRow
- type ListSignatureTriggersRow
- type ListSignatureViewsRow
- type ListTablesForSchemaRow
- type ListTriggersForTableParams
- type ListTriggersForTableRow
- type ListTypesForSchemaRow
- type ListViewsForSchemaRow
- type PgAm
- type PgAttrdef
- type PgAttribute
- type PgClass
- type PgConstraint
- type PgDepend
- type PgDescription
- type PgEnum
- type PgExtension
- type PgIndex
- type PgLanguage
- type PgMatview
- type PgNamespace
- type PgPolicy
- type PgProc
- type PgRange
- type PgRole
- type PgSequence
- type PgTrigger
- type PgType
- type Queries
- func (q *Queries) GetPostgresVersion(ctx context.Context) (string, error)
- func (q *Queries) GetSearchPath(ctx context.Context) (string, error)
- func (q *Queries) GetTableRowSecurity(ctx context.Context, arg GetTableRowSecurityParams) (bool, error)
- func (q *Queries) ListColumnsForTable(ctx context.Context, arg ListColumnsForTableParams) ([]ListColumnsForTableRow, error)
- func (q *Queries) ListConstraintsForTable(ctx context.Context, arg ListConstraintsForTableParams) ([]ListConstraintsForTableRow, error)
- func (q *Queries) ListExtensions(ctx context.Context) ([]ListExtensionsRow, error)
- func (q *Queries) ListFunctionsForSchema(ctx context.Context, schemaName string) ([]ListFunctionsForSchemaRow, error)
- func (q *Queries) ListIndexesForTable(ctx context.Context, arg ListIndexesForTableParams) ([]ListIndexesForTableRow, error)
- func (q *Queries) ListMaterializedViewsForSchema(ctx context.Context, schemaName string) ([]ListMaterializedViewsForSchemaRow, error)
- func (q *Queries) ListPoliciesForTable(ctx context.Context, arg ListPoliciesForTableParams) ([]ListPoliciesForTableRow, error)
- func (q *Queries) ListSequencesForSchema(ctx context.Context, schemaName string) ([]ListSequencesForSchemaRow, error)
- func (q *Queries) ListSignatureConstraints(ctx context.Context) ([]ListSignatureConstraintsRow, error)
- func (q *Queries) ListSignatureExtensions(ctx context.Context) ([]ListSignatureExtensionsRow, error)
- func (q *Queries) ListSignatureFunctions(ctx context.Context) ([]ListSignatureFunctionsRow, error)
- func (q *Queries) ListSignatureIndexes(ctx context.Context) ([]ListSignatureIndexesRow, error)
- func (q *Queries) ListSignaturePolicies(ctx context.Context) ([]ListSignaturePoliciesRow, error)
- func (q *Queries) ListSignatureTableColumns(ctx context.Context) ([]ListSignatureTableColumnsRow, error)
- func (q *Queries) ListSignatureTriggers(ctx context.Context) ([]ListSignatureTriggersRow, error)
- func (q *Queries) ListSignatureViews(ctx context.Context) ([]ListSignatureViewsRow, error)
- func (q *Queries) ListTablesForSchema(ctx context.Context, schemaName string) ([]ListTablesForSchemaRow, error)
- func (q *Queries) ListTriggersForTable(ctx context.Context, arg ListTriggersForTableParams) ([]ListTriggersForTableRow, error)
- func (q *Queries) ListTypesForSchema(ctx context.Context, schemaName string) ([]ListTypesForSchemaRow, error)
- func (q *Queries) ListUserSchemas(ctx context.Context) ([]string, error)
- func (q *Queries) ListViewsForSchema(ctx context.Context, schemaName string) ([]ListViewsForSchemaRow, error)
- func (q *Queries) WithTx(tx *sql.Tx) *Queries
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ListColumnsForTableRow ¶
type ListColumnsForTableRow struct {
ColumnName string `json:"column_name"`
DataType string `json:"data_type"`
IsNullable bool `json:"is_nullable"`
ColumnDefault string `json:"column_default"`
IsGenerated bool `json:"is_generated"`
GenerationExpression string `json:"generation_expression"`
IsIdentity bool `json:"is_identity"`
IdentityGeneration string `json:"identity_generation"`
CollationName string `json:"collation_name"`
ColumnComment string `json:"column_comment"`
}
type ListConstraintsForTableRow ¶
type ListConstraintsForTableRow struct {
ConstraintName string `json:"constraint_name"`
ConstraintType string `json:"constraint_type"`
Columns []string `json:"columns"`
RefTable string `json:"ref_table"`
RefColumns []string `json:"ref_columns"`
OnDelete string `json:"on_delete"`
OnUpdate string `json:"on_update"`
IsDeferrable bool `json:"is_deferrable"`
InitiallyDeferred bool `json:"initially_deferred"`
CheckExpr string `json:"check_expr"`
Definition string `json:"definition"`
}
type ListExtensionsRow ¶
type ListFunctionsForSchemaRow ¶
type ListFunctionsForSchemaRow struct {
FunctionName string `json:"function_name"`
Signature string `json:"signature"`
Language string `json:"language"`
ReturnType string `json:"return_type"`
Body string `json:"body"`
Volatility string `json:"volatility"`
IsStrict sql.NullBool `json:"is_strict"`
Security string `json:"security"`
Comment string `json:"comment"`
}
type ListIndexesForTableRow ¶
type ListIndexesForTableRow struct {
IndexName string `json:"index_name"`
Columns []string `json:"columns"`
IndexMethod string `json:"index_method"`
IsUnique sql.NullBool `json:"is_unique"`
IsPrimary sql.NullBool `json:"is_primary"`
WhereClause string `json:"where_clause"`
Definition string `json:"definition"`
}
type ListPoliciesForTableRow ¶
type ListSequencesForSchemaRow ¶
type ListSequencesForSchemaRow struct {
SequenceName string `json:"sequence_name"`
DataType string `json:"data_type"`
StartValue int64 `json:"start_value"`
Increment int64 `json:"increment"`
MinValue int64 `json:"min_value"`
MaxValue int64 `json:"max_value"`
CacheSize int64 `json:"cache_size"`
IsCycle sql.NullBool `json:"is_cycle"`
OwnedBy string `json:"owned_by"`
}
type ListSignatureIndexesRow ¶
type ListSignatureViewsRow ¶
type ListTablesForSchemaRow ¶
type ListTriggersForTableRow ¶
type ListTriggersForTableRow struct {
TriggerName string `json:"trigger_name"`
FunctionName string `json:"function_name"`
Timing string `json:"timing"`
Level string `json:"level"`
Events []string `json:"events"`
Condition string `json:"condition"`
IsEnabled bool `json:"is_enabled"`
Definition string `json:"definition"`
}
type ListTypesForSchemaRow ¶
type ListViewsForSchemaRow ¶
type PgAm ¶
type PgAm struct {
Oid sql.NullInt64 `json:"oid"`
Amname sql.NullString `json:"amname"`
}
type PgAttribute ¶
type PgAttribute struct {
Attrelid sql.NullInt64 `json:"attrelid"`
Attnum sql.NullInt32 `json:"attnum"`
Attname sql.NullString `json:"attname"`
Atttypid sql.NullInt64 `json:"atttypid"`
Atttypmod sql.NullInt32 `json:"atttypmod"`
Attnotnull sql.NullBool `json:"attnotnull"`
Attisdropped sql.NullBool `json:"attisdropped"`
Attgenerated sql.NullString `json:"attgenerated"`
Attidentity sql.NullString `json:"attidentity"`
Attcollation sql.NullInt64 `json:"attcollation"`
}
type PgClass ¶
type PgClass struct {
Oid sql.NullInt64 `json:"oid"`
Relname sql.NullString `json:"relname"`
Relnamespace sql.NullInt64 `json:"relnamespace"`
Relkind sql.NullString `json:"relkind"`
Relam sql.NullInt64 `json:"relam"`
Relrowsecurity sql.NullBool `json:"relrowsecurity"`
Relispopulated sql.NullBool `json:"relispopulated"`
}
type PgConstraint ¶
type PgConstraint struct {
Oid sql.NullInt64 `json:"oid"`
Conname sql.NullString `json:"conname"`
Connamespace sql.NullInt64 `json:"connamespace"`
Condeferrable sql.NullBool `json:"condeferrable"`
Condeferred sql.NullBool `json:"condeferred"`
Conrelid sql.NullInt64 `json:"conrelid"`
Contype sql.NullString `json:"contype"`
Conkey []int32 `json:"conkey"`
Confrelid sql.NullInt64 `json:"confrelid"`
Confkey []int32 `json:"confkey"`
Confdeltype sql.NullString `json:"confdeltype"`
Confupdtype sql.NullString `json:"confupdtype"`
Conbin sql.NullString `json:"conbin"`
Contypid sql.NullInt64 `json:"contypid"`
}
type PgDescription ¶
type PgEnum ¶
type PgEnum struct {
Enumtypid sql.NullInt64 `json:"enumtypid"`
Enumlabel sql.NullString `json:"enumlabel"`
Enumsortorder sql.NullFloat64 `json:"enumsortorder"`
}
type PgExtension ¶
type PgExtension struct {
Oid sql.NullInt64 `json:"oid"`
Extname sql.NullString `json:"extname"`
Extversion sql.NullString `json:"extversion"`
Extnamespace sql.NullInt64 `json:"extnamespace"`
Extrelocatable sql.NullBool `json:"extrelocatable"`
}
type PgLanguage ¶
type PgLanguage struct {
Oid sql.NullInt64 `json:"oid"`
Lanname sql.NullString `json:"lanname"`
}
type PgMatview ¶
type PgMatview struct {
Schemaname sql.NullString `json:"schemaname"`
Matviewname sql.NullString `json:"matviewname"`
Definition sql.NullString `json:"definition"`
Ispopulated sql.NullBool `json:"ispopulated"`
}
type PgNamespace ¶
type PgNamespace struct {
Oid sql.NullInt64 `json:"oid"`
Nspname sql.NullString `json:"nspname"`
}
type PgPolicy ¶
type PgPolicy struct {
Polname sql.NullString `json:"polname"`
Polcmd sql.NullString `json:"polcmd"`
Polpermissive sql.NullBool `json:"polpermissive"`
Polroles []int64 `json:"polroles"`
Polqual sql.NullString `json:"polqual"`
Polwithcheck sql.NullString `json:"polwithcheck"`
Polrelid sql.NullInt64 `json:"polrelid"`
}
type PgProc ¶
type PgProc struct {
Oid sql.NullInt64 `json:"oid"`
Proname sql.NullString `json:"proname"`
Pronamespace sql.NullInt64 `json:"pronamespace"`
Prolang sql.NullInt64 `json:"prolang"`
Provolatile sql.NullString `json:"provolatile"`
Proisstrict sql.NullBool `json:"proisstrict"`
Prosecdef sql.NullBool `json:"prosecdef"`
Prokind sql.NullString `json:"prokind"`
}
type PgRole ¶
type PgRole struct {
Oid sql.NullInt64 `json:"oid"`
Rolname sql.NullString `json:"rolname"`
}
type PgSequence ¶
type PgSequence struct {
Seqrelid sql.NullInt64 `json:"seqrelid"`
Seqtypid sql.NullInt64 `json:"seqtypid"`
Seqstart sql.NullInt64 `json:"seqstart"`
Seqincrement sql.NullInt64 `json:"seqincrement"`
Seqmin sql.NullInt64 `json:"seqmin"`
Seqmax sql.NullInt64 `json:"seqmax"`
Seqcache sql.NullInt64 `json:"seqcache"`
Seqcycle sql.NullBool `json:"seqcycle"`
}
type PgTrigger ¶
type PgTrigger struct {
Oid sql.NullInt64 `json:"oid"`
Tgname sql.NullString `json:"tgname"`
Tgrelid sql.NullInt64 `json:"tgrelid"`
Tgfoid sql.NullInt64 `json:"tgfoid"`
Tgtype sql.NullInt32 `json:"tgtype"`
Tgqual sql.NullString `json:"tgqual"`
Tgenabled sql.NullString `json:"tgenabled"`
Tgisinternal sql.NullBool `json:"tgisinternal"`
}
type PgType ¶
type PgType struct {
Oid sql.NullInt64 `json:"oid"`
Typname sql.NullString `json:"typname"`
Typnamespace sql.NullInt64 `json:"typnamespace"`
Typtype sql.NullString `json:"typtype"`
Typcollation sql.NullInt64 `json:"typcollation"`
Typbasetype sql.NullInt64 `json:"typbasetype"`
Typtypmod sql.NullInt32 `json:"typtypmod"`
Typnotnull sql.NullBool `json:"typnotnull"`
Typdefaultbin sql.NullString `json:"typdefaultbin"`
Typrelid sql.NullInt64 `json:"typrelid"`
}
type Queries ¶
type Queries struct {
// contains filtered or unexported fields
}
func (*Queries) GetPostgresVersion ¶
The metadata loader reads pg_catalog directly and renders every definition with PostgreSQL's own canonical functions (format_type, pg_get_expr, pg_get_constraintdef, pg_get_indexdef, pg_get_viewdef, pg_get_functiondef, pg_get_triggerdef), so two databases built by the same server major version can be compared structurally. information_schema is avoided: it hides objects the connecting role has no privileges on. Objects that belong to an extension (pg_depend deptype 'e') are skipped; extensions are compared by name and version instead.
func (*Queries) GetSearchPath ¶
func (*Queries) GetTableRowSecurity ¶
func (*Queries) ListColumnsForTable ¶
func (q *Queries) ListColumnsForTable(ctx context.Context, arg ListColumnsForTableParams) ([]ListColumnsForTableRow, error)
func (*Queries) ListConstraintsForTable ¶
func (q *Queries) ListConstraintsForTable(ctx context.Context, arg ListConstraintsForTableParams) ([]ListConstraintsForTableRow, error)
NOT NULL constraints (contype 'n', catalogued since PostgreSQL 18) are skipped: nullability is compared as a column property.
func (*Queries) ListExtensions ¶
func (q *Queries) ListExtensions(ctx context.Context) ([]ListExtensionsRow, error)
func (*Queries) ListFunctionsForSchema ¶
func (q *Queries) ListFunctionsForSchema(ctx context.Context, schemaName string) ([]ListFunctionsForSchemaRow, error)
Functions, procedures and window functions; aggregates are skipped because pg_get_functiondef rejects them.
func (*Queries) ListIndexesForTable ¶
func (q *Queries) ListIndexesForTable(ctx context.Context, arg ListIndexesForTableParams) ([]ListIndexesForTableRow, error)
func (*Queries) ListMaterializedViewsForSchema ¶
func (*Queries) ListPoliciesForTable ¶
func (q *Queries) ListPoliciesForTable(ctx context.Context, arg ListPoliciesForTableParams) ([]ListPoliciesForTableRow, error)
polroles holds 0 for PUBLIC, which has no pg_roles row.
func (*Queries) ListSequencesForSchema ¶
func (q *Queries) ListSequencesForSchema(ctx context.Context, schemaName string) ([]ListSequencesForSchemaRow, error)
owned_by covers both OWNED BY (deptype 'a') and identity columns (deptype 'i'), rendered as schema.table.column independent of search_path.
func (*Queries) ListSignatureConstraints ¶
func (q *Queries) ListSignatureConstraints(ctx context.Context) ([]ListSignatureConstraintsRow, error)
func (*Queries) ListSignatureExtensions ¶
func (q *Queries) ListSignatureExtensions(ctx context.Context) ([]ListSignatureExtensionsRow, error)
func (*Queries) ListSignatureFunctions ¶
func (q *Queries) ListSignatureFunctions(ctx context.Context) ([]ListSignatureFunctionsRow, error)
func (*Queries) ListSignatureIndexes ¶
func (q *Queries) ListSignatureIndexes(ctx context.Context) ([]ListSignatureIndexesRow, error)
func (*Queries) ListSignaturePolicies ¶
func (q *Queries) ListSignaturePolicies(ctx context.Context) ([]ListSignaturePoliciesRow, error)
func (*Queries) ListSignatureTableColumns ¶
func (q *Queries) ListSignatureTableColumns(ctx context.Context) ([]ListSignatureTableColumnsRow, error)
func (*Queries) ListSignatureTriggers ¶
func (q *Queries) ListSignatureTriggers(ctx context.Context) ([]ListSignatureTriggersRow, error)
func (*Queries) ListSignatureViews ¶
func (q *Queries) ListSignatureViews(ctx context.Context) ([]ListSignatureViewsRow, error)
func (*Queries) ListTablesForSchema ¶
func (*Queries) ListTriggersForTable ¶
func (q *Queries) ListTriggersForTable(ctx context.Context, arg ListTriggersForTableParams) ([]ListTriggersForTableRow, error)
func (*Queries) ListTypesForSchema ¶
func (q *Queries) ListTypesForSchema(ctx context.Context, schemaName string) ([]ListTypesForSchemaRow, error)
Composite types are limited to standalone ones (CREATE TYPE ... AS); every table also has a row type that is compared through the table itself.