Documentation
¶
Index ¶
- func IsBuiltInType(typeName string) bool
- func IsTextLikeType(typeName string) bool
- func QualifyEntityNameWithQuotes(entitySchema, entityName, targetSchema string) string
- func QuoteIdentifier(identifier string) string
- type Aggregate
- type Column
- type ColumnPrivilege
- type Constraint
- type ConstraintColumn
- type ConstraintType
- type DefaultPrivilege
- type DefaultPrivilegeObjectType
- type DependencyType
- type DomainConstraint
- type Function
- type IR
- type Identity
- type IgnoreConfig
- func (c *IgnoreConfig) ShouldIgnoreFunction(functionName string) bool
- func (c *IgnoreConfig) ShouldIgnoreProcedure(procedureName string) bool
- func (c *IgnoreConfig) ShouldIgnoreSequence(sequenceName string) bool
- func (c *IgnoreConfig) ShouldIgnoreTable(tableName string) bool
- func (c *IgnoreConfig) ShouldIgnoreType(typeName string) bool
- func (c *IgnoreConfig) ShouldIgnoreView(viewName string) bool
- type Index
- type IndexColumn
- type IndexType
- type Inspector
- type LikeClause
- type Metadata
- type Parameter
- type PolicyCommand
- type Privilege
- type PrivilegeObjectType
- type Procedure
- type RLSPolicy
- type RevokedDefaultPrivilege
- type Schema
- func (s *Schema) GetAggregate(name string) (*Aggregate, bool)
- func (s *Schema) GetFunction(name string) (*Function, bool)
- func (s *Schema) GetProcedure(name string) (*Procedure, bool)
- func (s *Schema) GetSequence(name string) (*Sequence, bool)
- func (s *Schema) GetTable(name string) (*Table, bool)
- func (s *Schema) GetType(name string) (*Type, bool)
- func (s *Schema) GetView(name string) (*View, bool)
- func (s *Schema) SetAggregate(name string, aggregate *Aggregate)
- func (s *Schema) SetFunction(name string, function *Function)
- func (s *Schema) SetProcedure(name string, procedure *Procedure)
- func (s *Schema) SetSequence(name string, sequence *Sequence)
- func (s *Schema) SetTable(name string, table *Table)
- func (s *Schema) SetType(name string, typ *Type)
- func (s *Schema) SetView(name string, view *View)
- type Sequence
- type Table
- type TableDependency
- type TableType
- type Trigger
- type TriggerEvent
- type TriggerLevel
- type TriggerTiming
- type Type
- type TypeColumn
- type TypeKind
- type View
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsBuiltInType ¶
IsBuiltInType checks if a type name is a PostgreSQL built-in type. This is used to determine if type conversions need explicit USING clauses (e.g., text -> custom_enum requires USING, but integer -> bigint does not)
func IsTextLikeType ¶
IsTextLikeType checks if a type is a text-like type (text, varchar, char, etc.) This is used to determine if type conversions need explicit USING clauses
func QualifyEntityNameWithQuotes ¶
QualifyEntityNameWithQuotes returns the properly qualified and quoted entity name
func QuoteIdentifier ¶
QuoteIdentifier adds quotes to an identifier if needed
Types ¶
type Aggregate ¶
type Aggregate struct {
Schema string `json:"schema"`
Name string `json:"name"`
ReturnType string `json:"return_type"`
TransitionFunction string `json:"transition_function"`
TransitionFunctionSchema string `json:"transition_function_schema,omitempty"`
StateType string `json:"state_type"`
InitialCondition string `json:"initial_condition,omitempty"`
FinalFunction string `json:"final_function,omitempty"`
FinalFunctionSchema string `json:"final_function_schema,omitempty"`
Comment string `json:"comment,omitempty"`
}
Aggregate represents a database aggregate function
type Column ¶
type Column struct {
Name string `json:"name"`
Position int `json:"position"` // ordinal_position
DataType string `json:"data_type"`
IsNullable bool `json:"is_nullable"`
DefaultValue *string `json:"default_value,omitempty"`
MaxLength *int `json:"max_length,omitempty"`
Precision *int `json:"precision,omitempty"`
Scale *int `json:"scale,omitempty"`
Comment string `json:"comment,omitempty"`
Identity *Identity `json:"identity,omitempty"`
GeneratedExpr *string `json:"generated_expr,omitempty"` // Expression for generated columns
IsGenerated bool `json:"is_generated,omitempty"` // True if this is a generated column
}
Column represents a table column
func (*Column) GetObjectName ¶
type ColumnPrivilege ¶
type ColumnPrivilege struct {
TableName string `json:"table_name"` // table containing the columns
Columns []string `json:"columns"` // columns for this grant (sorted alphabetically)
Grantee string `json:"grantee"` // role name or "PUBLIC"
Privileges []string `json:"privileges"` // SELECT, INSERT, UPDATE, REFERENCES only
WithGrantOption bool `json:"with_grant_option"` // Can grantee grant to others?
}
ColumnPrivilege represents a column-level privilege grant on a table Column-level grants allow fine-grained access control on specific columns rather than the entire table. Stored in pg_attribute.attacl.
func (*ColumnPrivilege) GetFullKey ¶
func (cp *ColumnPrivilege) GetFullKey() string
GetFullKey returns a unique identifier including grant option. Use this when you need to distinguish between the same privilege with different grant options.
func (*ColumnPrivilege) GetObjectKey ¶
func (cp *ColumnPrivilege) GetObjectKey() string
GetObjectKey returns a unique identifier for the column privilege. MUST include sorted columns - two grants on same table/role with different columns are different objects.
func (*ColumnPrivilege) GetObjectName ¶
func (cp *ColumnPrivilege) GetObjectName() string
GetObjectName returns the table name for the column privilege
type Constraint ¶
type Constraint struct {
Schema string `json:"schema"`
Table string `json:"table"`
Name string `json:"name"`
Type ConstraintType `json:"type"`
Columns []*ConstraintColumn `json:"columns"`
ReferencedSchema string `json:"referenced_schema,omitempty"`
ReferencedTable string `json:"referenced_table,omitempty"`
ReferencedColumns []*ConstraintColumn `json:"referenced_columns,omitempty"`
CheckClause string `json:"check_clause,omitempty"`
ExclusionDefinition string `json:"exclusion_definition,omitempty"` // Full EXCLUDE definition from pg_get_constraintdef()
DeleteRule string `json:"delete_rule,omitempty"`
UpdateRule string `json:"update_rule,omitempty"`
Deferrable bool `json:"deferrable,omitempty"`
InitiallyDeferred bool `json:"initially_deferred,omitempty"`
IsValid bool `json:"is_valid,omitempty"`
Comment string `json:"comment,omitempty"`
}
Constraint represents a table constraint
func (*Constraint) GetObjectName ¶
func (c *Constraint) GetObjectName() string
type ConstraintColumn ¶
type ConstraintColumn struct {
Name string `json:"name"`
Position int `json:"position"` // ordinal_position within the constraint
}
ConstraintColumn represents a column within a constraint with its position
type ConstraintType ¶
type ConstraintType string
ConstraintType represents different types of database constraints
const ( ConstraintTypePrimaryKey ConstraintType = "PRIMARY_KEY" ConstraintTypeUnique ConstraintType = "UNIQUE" ConstraintTypeForeignKey ConstraintType = "FOREIGN_KEY" ConstraintTypeCheck ConstraintType = "CHECK" ConstraintTypeExclusion ConstraintType = "EXCLUSION" )
type DefaultPrivilege ¶
type DefaultPrivilege struct {
OwnerRole string `json:"owner_role"` // Role that owns the default privilege
ObjectType DefaultPrivilegeObjectType `json:"object_type"` // TABLES, SEQUENCES, FUNCTIONS, TYPES
Grantee string `json:"grantee"` // Role name or "PUBLIC"
Privileges []string `json:"privileges"` // SELECT, INSERT, UPDATE, etc.
WithGrantOption bool `json:"with_grant_option"` // Can grantee grant to others?
}
DefaultPrivilege represents an ALTER DEFAULT PRIVILEGES setting
func (*DefaultPrivilege) GetObjectName ¶
func (d *DefaultPrivilege) GetObjectName() string
GetObjectName returns a unique identifier for the default privilege
type DefaultPrivilegeObjectType ¶
type DefaultPrivilegeObjectType string
DefaultPrivilegeObjectType represents the object type for default privileges
const ( DefaultPrivilegeObjectTypeTables DefaultPrivilegeObjectType = "TABLES" DefaultPrivilegeObjectTypeSequences DefaultPrivilegeObjectType = "SEQUENCES" DefaultPrivilegeObjectTypeFunctions DefaultPrivilegeObjectType = "FUNCTIONS" DefaultPrivilegeObjectTypeTypes DefaultPrivilegeObjectType = "TYPES" )
type DependencyType ¶
type DependencyType string
DependencyType represents different types of database object dependencies
const ( DependencyTypeTable DependencyType = "TABLE" DependencyTypeView DependencyType = "VIEW" DependencyTypeFunction DependencyType = "FUNCTION" DependencyTypeSequence DependencyType = "SEQUENCE" )
type DomainConstraint ¶
DomainConstraint represents a constraint on a domain
type Function ¶
type Function struct {
Schema string `json:"schema"`
Name string `json:"name"`
Definition string `json:"definition"`
ReturnType string `json:"return_type"`
Language string `json:"language"`
Parameters []*Parameter `json:"parameters,omitempty"`
Comment string `json:"comment,omitempty"`
Volatility string `json:"volatility,omitempty"` // IMMUTABLE, STABLE, VOLATILE
IsStrict bool `json:"is_strict,omitempty"` // STRICT or null behavior
IsSecurityDefiner bool `json:"is_security_definer,omitempty"` // SECURITY DEFINER
IsLeakproof bool `json:"is_leakproof,omitempty"` // LEAKPROOF
Parallel string `json:"parallel,omitempty"` // SAFE, UNSAFE, RESTRICTED
SearchPath string `json:"search_path,omitempty"` // SET search_path value
Dependencies []string `json:"dependencies,omitempty"` // Function keys (name(args)) this function depends on
}
Function represents a database function
func (*Function) GetArguments ¶
GetArguments returns the function arguments string (types only) for function identification. This is built dynamically from the Parameters array to ensure it uses normalized types. Per PostgreSQL DROP FUNCTION syntax, only input parameters are included (IN, INOUT, VARIADIC).
func (*Function) GetObjectName ¶
type IR ¶
type IR struct {
Metadata Metadata `json:"metadata"`
Schemas map[string]*Schema `json:"schemas"` // schema_name -> Schema
// contains filtered or unexported fields
}
IR represents the complete database schema intermediate representation
func (*IR) CreateSchema ¶
CreateSchema creates a new schema with the given name. If the schema already exists, it returns the existing schema.
func (*IR) GetOrCreateSchema ¶
GetOrCreateSchema gets or creates a database schema by name with thread safety. This is an exported version of the internal getOrCreateSchema method.
type Identity ¶
type Identity struct {
Generation string `json:"generation,omitempty"` // "ALWAYS" or "BY DEFAULT"
Start *int64 `json:"start,omitempty"`
Increment *int64 `json:"increment,omitempty"`
Maximum *int64 `json:"maximum,omitempty"`
Minimum *int64 `json:"minimum,omitempty"`
Cycle bool `json:"cycle,omitempty"`
}
Identity represents PostgreSQL identity column configuration
type IgnoreConfig ¶
type IgnoreConfig struct {
Tables []string `toml:"tables,omitempty"`
Views []string `toml:"views,omitempty"`
Functions []string `toml:"functions,omitempty"`
Procedures []string `toml:"procedures,omitempty"`
Types []string `toml:"types,omitempty"`
Sequences []string `toml:"sequences,omitempty"`
}
IgnoreConfig represents the configuration for ignoring database objects
func (*IgnoreConfig) ShouldIgnoreFunction ¶
func (c *IgnoreConfig) ShouldIgnoreFunction(functionName string) bool
ShouldIgnoreFunction checks if a function should be ignored based on the patterns
func (*IgnoreConfig) ShouldIgnoreProcedure ¶
func (c *IgnoreConfig) ShouldIgnoreProcedure(procedureName string) bool
ShouldIgnoreProcedure checks if a procedure should be ignored based on the patterns
func (*IgnoreConfig) ShouldIgnoreSequence ¶
func (c *IgnoreConfig) ShouldIgnoreSequence(sequenceName string) bool
ShouldIgnoreSequence checks if a sequence should be ignored based on the patterns
func (*IgnoreConfig) ShouldIgnoreTable ¶
func (c *IgnoreConfig) ShouldIgnoreTable(tableName string) bool
ShouldIgnoreTable checks if a table should be ignored based on the patterns
func (*IgnoreConfig) ShouldIgnoreType ¶
func (c *IgnoreConfig) ShouldIgnoreType(typeName string) bool
ShouldIgnoreType checks if a type should be ignored based on the patterns
func (*IgnoreConfig) ShouldIgnoreView ¶
func (c *IgnoreConfig) ShouldIgnoreView(viewName string) bool
ShouldIgnoreView checks if a view should be ignored based on the patterns
type Index ¶
type Index struct {
Schema string `json:"schema"`
Table string `json:"table"`
Name string `json:"name"`
Type IndexType `json:"type"`
Method string `json:"method"` // btree, hash, gin, gist, etc.
Columns []*IndexColumn `json:"columns"`
IsPartial bool `json:"is_partial"` // has a WHERE clause
IsExpression bool `json:"is_expression"` // functional/expression index
Where string `json:"where,omitempty"` // partial index condition
Comment string `json:"comment,omitempty"`
}
Index represents a database index
func (*Index) GetObjectName ¶
type IndexColumn ¶
type IndexColumn struct {
Name string `json:"name"`
Position int `json:"position"`
Direction string `json:"direction,omitempty"` // ASC, DESC
Operator string `json:"operator,omitempty"` // operator class
}
IndexColumn represents a column within an index
type Inspector ¶
type Inspector struct {
// contains filtered or unexported fields
}
Inspector builds IR from database queries
func NewInspector ¶
func NewInspector(db *sql.DB, ignoreConfig *IgnoreConfig) *Inspector
NewInspector creates a new schema inspector with optional ignore configuration
type LikeClause ¶
type LikeClause struct {
SourceSchema string `json:"source_schema"`
SourceTable string `json:"source_table"`
Options string `json:"options"` // e.g., "INCLUDING ALL" or "INCLUDING DEFAULTS EXCLUDING INDEXES"
}
LikeClause represents a LIKE clause in CREATE TABLE statement
type Metadata ¶
type Metadata struct {
DatabaseVersion string `json:"database_version"`
}
Metadata contains information about the schema dump
type Parameter ¶
type Parameter struct {
Name string `json:"name"`
DataType string `json:"data_type"`
Mode string `json:"mode"` // IN, OUT, INOUT
Position int `json:"position"`
DefaultValue *string `json:"default_value,omitempty"`
}
Parameter represents a function parameter
type PolicyCommand ¶
type PolicyCommand string
PolicyCommand represents the command for which the policy applies
const ( PolicyCommandAll PolicyCommand = "ALL" PolicyCommandSelect PolicyCommand = "SELECT" PolicyCommandInsert PolicyCommand = "INSERT" PolicyCommandUpdate PolicyCommand = "UPDATE" PolicyCommandDelete PolicyCommand = "DELETE" )
type Privilege ¶
type Privilege struct {
ObjectType PrivilegeObjectType `json:"object_type"` // TABLE, VIEW, SEQUENCE, FUNCTION, PROCEDURE, TYPE
ObjectName string `json:"object_name"` // table name or function signature
Grantee string `json:"grantee"` // role name or "PUBLIC"
Privileges []string `json:"privileges"` // [SELECT, INSERT, UPDATE, ...] or [EXECUTE] or [USAGE]
WithGrantOption bool `json:"with_grant_option"` // Can grantee grant to others?
}
Privilege represents an explicit privilege grant on a schema object
func (*Privilege) GetFullKey ¶
GetFullKey returns a unique identifier including WithGrantOption. Use this when you need to distinguish between the same privilege with different grant options.
func (*Privilege) GetObjectKey ¶
GetObjectKey returns a unique identifier for the privilege (object + grantee) Note: This intentionally excludes WithGrantOption so that privilege modifications (e.g., adding or removing GRANT OPTION) are detected as modifications, not as separate add/drop operations.
func (*Privilege) GetObjectName ¶
GetObjectName returns the object name for the privilege
type PrivilegeObjectType ¶
type PrivilegeObjectType string
PrivilegeObjectType represents the object type for explicit privilege grants
const ( PrivilegeObjectTypeTable PrivilegeObjectType = "TABLE" PrivilegeObjectTypeView PrivilegeObjectType = "VIEW" PrivilegeObjectTypeSequence PrivilegeObjectType = "SEQUENCE" PrivilegeObjectTypeFunction PrivilegeObjectType = "FUNCTION" PrivilegeObjectTypeProcedure PrivilegeObjectType = "PROCEDURE" PrivilegeObjectTypeType PrivilegeObjectType = "TYPE" )
type Procedure ¶
type Procedure struct {
Schema string `json:"schema"`
Name string `json:"name"`
Definition string `json:"definition"`
Language string `json:"language"`
Parameters []*Parameter `json:"parameters,omitempty"`
Comment string `json:"comment,omitempty"`
}
Procedure represents a database procedure
func (*Procedure) GetArguments ¶
GetArguments returns the procedure arguments string (types only) for procedure identification. This is built dynamically from the Parameters array to ensure it uses normalized types. Per PostgreSQL DROP PROCEDURE syntax, only input parameters are included (IN, INOUT, VARIADIC).
func (*Procedure) GetObjectName ¶
type RLSPolicy ¶
type RLSPolicy struct {
Schema string `json:"schema"`
Table string `json:"table"`
Name string `json:"name"`
Command PolicyCommand `json:"command"` // SELECT, INSERT, UPDATE, DELETE, ALL
Permissive bool `json:"permissive"`
Roles []string `json:"roles,omitempty"`
Using string `json:"using,omitempty"` // USING expression
WithCheck string `json:"with_check,omitempty"` // WITH CHECK expression
Comment string `json:"comment,omitempty"`
}
RLSPolicy represents a Row Level Security policy
func (*RLSPolicy) GetObjectName ¶
type RevokedDefaultPrivilege ¶
type RevokedDefaultPrivilege struct {
ObjectType PrivilegeObjectType `json:"object_type"` // FUNCTION, PROCEDURE, TYPE
ObjectName string `json:"object_name"` // function signature or type name
Privileges []string `json:"privileges"` // [EXECUTE] or [USAGE]
}
RevokedDefaultPrivilege represents an explicit revoke of a default PUBLIC privilege This is used to track when default PUBLIC grants (e.g., EXECUTE on functions) are revoked
func (*RevokedDefaultPrivilege) GetObjectKey ¶
func (r *RevokedDefaultPrivilege) GetObjectKey() string
GetObjectKey returns a unique identifier for the revoked default privilege
func (*RevokedDefaultPrivilege) GetObjectName ¶
func (r *RevokedDefaultPrivilege) GetObjectName() string
GetObjectName returns the object name for the revoked default privilege
type Schema ¶
type Schema struct {
Name string `json:"name"`
Owner string `json:"owner"` // Schema owner
// Note: Indexes, Triggers, and RLS Policies are stored at table level (Table.Indexes, Table.Triggers, Table.Policies)
Tables map[string]*Table `json:"tables"` // table_name -> Table
Views map[string]*View `json:"views"` // view_name -> View
Functions map[string]*Function `json:"functions"` // function_name -> Function
Procedures map[string]*Procedure `json:"procedures"` // procedure_name -> Procedure
Aggregates map[string]*Aggregate `json:"aggregates"` // aggregate_name -> Aggregate
Sequences map[string]*Sequence `json:"sequences"` // sequence_name -> Sequence
Types map[string]*Type `json:"types"` // type_name -> Type
DefaultPrivileges []*DefaultPrivilege `json:"default_privileges,omitempty"` // Default privileges for future objects
Privileges []*Privilege `json:"privileges,omitempty"` // Explicit privilege grants on objects
ColumnPrivileges []*ColumnPrivilege `json:"column_privileges,omitempty"` // Column-level privilege grants
RevokedDefaultPrivileges []*RevokedDefaultPrivilege `json:"revoked_default_privileges,omitempty"` // Explicit revokes of default PUBLIC privileges
// contains filtered or unexported fields
}
Schema represents a single database schema (namespace)
func (*Schema) GetAggregate ¶
GetAggregate retrieves an aggregate from the schema with thread safety
func (*Schema) GetFunction ¶
GetFunction retrieves a function from the schema with thread safety
func (*Schema) GetProcedure ¶
GetProcedure retrieves a procedure from the schema with thread safety
func (*Schema) GetSequence ¶
GetSequence retrieves a sequence from the schema with thread safety
func (*Schema) SetAggregate ¶
SetAggregate sets an aggregate in the schema with thread safety
func (*Schema) SetFunction ¶
SetFunction sets a function in the schema with thread safety
func (*Schema) SetProcedure ¶
SetProcedure sets a procedure in the schema with thread safety
func (*Schema) SetSequence ¶
SetSequence sets a sequence in the schema with thread safety
type Sequence ¶
type Sequence struct {
Schema string `json:"schema"`
Name string `json:"name"`
DataType string `json:"data_type"`
StartValue int64 `json:"start_value"`
MinValue *int64 `json:"min_value,omitempty"`
MaxValue *int64 `json:"max_value,omitempty"`
Increment int64 `json:"increment"`
CycleOption bool `json:"cycle_option"`
Cache *int64 `json:"cache,omitempty"`
OwnedByTable string `json:"owned_by_table,omitempty"`
OwnedByColumn string `json:"owned_by_column,omitempty"`
Comment string `json:"comment,omitempty"`
}
Sequence represents a database sequence
func (*Sequence) GetObjectName ¶
type Table ¶
type Table struct {
Schema string `json:"schema"`
Name string `json:"name"`
Type TableType `json:"type"` // BASE_TABLE, VIEW, etc.
IsExternal bool `json:"is_external,omitempty"` // True if table is externally managed (e.g., in ignored schemas)
Columns []*Column `json:"columns"`
Constraints map[string]*Constraint `json:"constraints"` // constraint_name -> Constraint
Indexes map[string]*Index `json:"indexes"` // index_name -> Index
Triggers map[string]*Trigger `json:"triggers"` // trigger_name -> Trigger
RLSEnabled bool `json:"rls_enabled"`
RLSForced bool `json:"rls_forced"`
Policies map[string]*RLSPolicy `json:"policies"` // policy_name -> RLSPolicy
Dependencies []TableDependency `json:"dependencies"`
Comment string `json:"comment,omitempty"`
IsPartitioned bool `json:"is_partitioned"`
PartitionStrategy string `json:"partition_strategy,omitempty"` // RANGE, LIST, HASH
PartitionKey string `json:"partition_key,omitempty"` // Column(s) used for partitioning
LikeClauses []LikeClause `json:"like_clauses,omitempty"` // LIKE clauses in CREATE TABLE
}
Table represents a database table
func (*Table) GetObjectName ¶
GetObjectName implementations for DiffSource interface
type TableDependency ¶
type TableDependency struct {
Schema string `json:"schema"`
Name string `json:"name"`
Type DependencyType `json:"type"`
}
TableDependency represents a dependency between database objects
type Trigger ¶
type Trigger struct {
Schema string `json:"schema"`
Table string `json:"table"`
Name string `json:"name"`
Timing TriggerTiming `json:"timing"` // BEFORE, AFTER, INSTEAD OF
Events []TriggerEvent `json:"events"` // INSERT, UPDATE, DELETE
Level TriggerLevel `json:"level"` // ROW, STATEMENT
Function string `json:"function"`
Condition string `json:"condition,omitempty"` // WHEN condition
Comment string `json:"comment,omitempty"`
IsConstraint bool `json:"is_constraint,omitempty"` // Whether this is a constraint trigger
Deferrable bool `json:"deferrable,omitempty"` // Can be deferred until end of transaction
InitiallyDeferred bool `json:"initially_deferred,omitempty"` // Whether deferred by default
OldTable string `json:"old_table,omitempty"` // REFERENCING OLD TABLE AS name
NewTable string `json:"new_table,omitempty"` // REFERENCING NEW TABLE AS name
}
Trigger represents a database trigger
func (*Trigger) GetObjectName ¶
type TriggerEvent ¶
type TriggerEvent string
TriggerEvent represents the event that triggers the trigger
const ( TriggerEventInsert TriggerEvent = "INSERT" TriggerEventUpdate TriggerEvent = "UPDATE" TriggerEventDelete TriggerEvent = "DELETE" TriggerEventTruncate TriggerEvent = "TRUNCATE" )
type TriggerLevel ¶
type TriggerLevel string
TriggerLevel represents the level at which the trigger fires
const ( TriggerLevelRow TriggerLevel = "ROW" TriggerLevelStatement TriggerLevel = "STATEMENT" )
type TriggerTiming ¶
type TriggerTiming string
TriggerTiming represents the timing of trigger execution
const ( TriggerTimingBefore TriggerTiming = "BEFORE" TriggerTimingAfter TriggerTiming = "AFTER" TriggerTimingInsteadOf TriggerTiming = "INSTEAD OF" )
type Type ¶
type Type struct {
Schema string `json:"schema"`
Name string `json:"name"`
Kind TypeKind `json:"kind"`
Comment string `json:"comment,omitempty"`
EnumValues []string `json:"enum_values,omitempty"` // For ENUM types
Columns []*TypeColumn `json:"columns,omitempty"` // For composite types
BaseType string `json:"base_type,omitempty"` // For DOMAIN types
NotNull bool `json:"not_null,omitempty"` // For DOMAIN types
Default string `json:"default,omitempty"` // For DOMAIN types
Constraints []*DomainConstraint `json:"constraints,omitempty"` // For DOMAIN types
}
Type represents a PostgreSQL user-defined type
func (*Type) GetObjectName ¶
type TypeColumn ¶
type TypeColumn struct {
Name string `json:"name"`
DataType string `json:"data_type"`
Position int `json:"position"`
}
TypeColumn represents a column in a composite type
type View ¶
type View struct {
Schema string `json:"schema"`
Name string `json:"name"`
Definition string `json:"definition"`
Comment string `json:"comment,omitempty"`
Materialized bool `json:"materialized,omitempty"`
Indexes map[string]*Index `json:"indexes,omitempty"` // For materialized views only
Triggers map[string]*Trigger `json:"triggers,omitempty"` // For INSTEAD OF triggers on views
}
View represents a database view