Documentation
¶
Index ¶
- Constants
- func NormalizeIdentifier(identifier string) string
- func NormalizeSchemaName(schema string) string
- func QualifiedName(schema, name string) string
- type Column
- type CompressionPolicy
- type CompressionSettings
- type Constraint
- type ContinuousAggregate
- type CustomType
- type Database
- func (db *Database) GetContinuousAggregate(schema, viewName string) *ContinuousAggregate
- func (db *Database) GetContinuousAggregates() int
- func (db *Database) GetCustomTypes() int
- func (db *Database) GetExtensions() int
- func (db *Database) GetFunction(schema, name string, argTypes []string) *Function
- func (db *Database) GetFunctions() int
- func (db *Database) GetHypertables() int
- func (db *Database) GetMaterializedView(schema, name string) *MaterializedView
- func (db *Database) GetMaterializedViews() int
- func (db *Database) GetSchemas() int
- func (db *Database) GetSequences() int
- func (db *Database) GetTable(schema, name string) *Table
- func (db *Database) GetTables() int
- func (db *Database) GetTriggers() int
- func (db *Database) GetView(schema, name string) *View
- func (db *Database) GetViews() int
- func (db *Database) MarshalJSON() ([]byte, error)
- func (db *Database) Sort()
- func (db *Database) UnmarshalJSON(data []byte) error
- type Extension
- type Function
- type Hypertable
- type Index
- type MaterializedView
- type OrderByColumn
- type Partition
- type PartitionStrategy
- type RefreshPolicy
- type RetentionPolicy
- type Schema
- type Sequence
- type Table
- type Trigger
- type View
Constants ¶
View Source
const ( VolatilityImmutable = "IMMUTABLE" VolatilityStable = "STABLE" VolatilityVolatile = "VOLATILE" )
View Source
const ( IndexTypeBTree = "btree" IndexTypeHash = "hash" IndexTypeGIN = "gin" IndexTypeGiST = "gist" IndexTypeSPGiST = "spgist" IndexTypeBRIN = "brin" )
View Source
const ( DefaultSchema = "public" SchemaVersion = "1.0" ForeignKey = "FOREIGN KEY" NoAction = "NO ACTION" )
View Source
const ( ConstraintPrimaryKey = "PRIMARY KEY" ConstraintForeignKey = "FOREIGN KEY" ConstraintUnique = "UNIQUE" ConstraintCheck = "CHECK" ConstraintExclude = "EXCLUDE" )
Variables ¶
This section is empty.
Functions ¶
func NormalizeIdentifier ¶
func NormalizeSchemaName ¶
func QualifiedName ¶
Types ¶
type Column ¶
type Column struct {
Name string `json:"name"`
DataType string `json:"data_type"`
Position int `json:"position"`
IsNullable bool `json:"is_nullable"`
Default string `json:"default,omitempty"`
Comment string `json:"comment,omitempty"`
MaxLength *int `json:"max_length,omitempty"`
Precision *int `json:"precision,omitempty"`
Scale *int `json:"scale,omitempty"`
IsArray bool `json:"is_array,omitempty"`
IsIdentity bool `json:"is_identity,omitempty"`
IdentityGeneration string `json:"identity_generation,omitempty"`
IsGenerated bool `json:"is_generated,omitempty"`
GenerationExpression string `json:"generation_expression,omitempty"`
}
func (*Column) FullDataType ¶
func (*Column) IsPrimaryKey ¶
type CompressionPolicy ¶
type CompressionSettings ¶
type CompressionSettings struct {
SegmentByColumns []string `json:"segment_by_columns,omitempty"`
OrderByColumns []OrderByColumn `json:"order_by_columns,omitempty"`
ChunkTimeInterval string `json:"chunk_time_interval,omitempty"`
}
func (*CompressionSettings) OrderByList ¶
func (cs *CompressionSettings) OrderByList() string
func (*CompressionSettings) SegmentByList ¶
func (cs *CompressionSettings) SegmentByList() string
type Constraint ¶
type Constraint struct {
Name string `json:"name"`
Type string `json:"type"`
Columns []string `json:"columns"`
Definition string `json:"definition,omitempty"`
ReferencedSchema string `json:"referenced_schema,omitempty"`
ReferencedTable string `json:"referenced_table,omitempty"`
ReferencedColumns []string `json:"referenced_columns,omitempty"`
OnDelete string `json:"on_delete,omitempty"`
OnUpdate string `json:"on_update,omitempty"`
CheckExpression string `json:"check_expression,omitempty"`
IndexName string `json:"index_name,omitempty"`
IsDeferrable bool `json:"is_deferrable,omitempty"`
InitiallyDeferred bool `json:"initially_deferred,omitempty"`
}
func (*Constraint) IsCheck ¶
func (c *Constraint) IsCheck() bool
func (*Constraint) IsForeignKey ¶
func (c *Constraint) IsForeignKey() bool
func (*Constraint) IsPrimaryKey ¶
func (c *Constraint) IsPrimaryKey() bool
func (*Constraint) IsUnique ¶
func (c *Constraint) IsUnique() bool
func (*Constraint) QualifiedReferencedTable ¶
func (c *Constraint) QualifiedReferencedTable() string
type ContinuousAggregate ¶
type ContinuousAggregate struct {
Schema string `json:"schema"`
ViewName string `json:"view_name"`
HypertableSchema string `json:"hypertable_schema"`
HypertableName string `json:"hypertable_name"`
Query string `json:"query"`
RefreshPolicy *RefreshPolicy `json:"refresh_policy,omitempty"`
WithData bool `json:"with_data"`
Materialized bool `json:"materialized"`
Finalized bool `json:"finalized,omitempty"`
Comment string `json:"comment,omitempty"`
Indexes []Index `json:"indexes,omitempty"`
}
func (*ContinuousAggregate) QualifiedHypertableName ¶
func (ca *ContinuousAggregate) QualifiedHypertableName() string
func (*ContinuousAggregate) QualifiedViewName ¶
func (ca *ContinuousAggregate) QualifiedViewName() string
type CustomType ¶
type CustomType struct {
Schema string `json:"schema"`
Name string `json:"name"`
Type string `json:"type"`
Definition string `json:"definition"`
Values []string `json:"values,omitempty"`
Comment string `json:"comment,omitempty"`
}
func (*CustomType) QualifiedName ¶
func (ct *CustomType) QualifiedName() string
type Database ¶
type Database struct {
Version string `json:"version"`
DatabaseName string `json:"database_name"`
ExtractedAt string `json:"extracted_at"`
Schemas []Schema `json:"schemas,omitempty"`
Extensions []Extension `json:"extensions,omitempty"`
CustomTypes []CustomType `json:"custom_types,omitempty"`
Sequences []Sequence `json:"sequences,omitempty"`
Tables []Table `json:"tables"`
Views []View `json:"views,omitempty"`
MaterializedViews []MaterializedView `json:"materialized_views,omitempty"`
Functions []Function `json:"functions,omitempty"`
Triggers []Trigger `json:"triggers,omitempty"`
Hypertables []Hypertable `json:"hypertables,omitempty"`
ContinuousAggregates []ContinuousAggregate `json:"continuous_aggregates,omitempty"`
}
func (*Database) GetContinuousAggregate ¶
func (db *Database) GetContinuousAggregate(schema, viewName string) *ContinuousAggregate
func (*Database) GetContinuousAggregates ¶
func (*Database) GetCustomTypes ¶
func (*Database) GetExtensions ¶
func (*Database) GetFunction ¶
func (*Database) GetFunctions ¶
func (*Database) GetHypertables ¶
func (*Database) GetMaterializedView ¶ added in v0.4.7
func (db *Database) GetMaterializedView(schema, name string) *MaterializedView
func (*Database) GetMaterializedViews ¶
func (*Database) GetSchemas ¶
func (*Database) GetSequences ¶
func (*Database) GetTriggers ¶
func (*Database) MarshalJSON ¶
func (*Database) UnmarshalJSON ¶
type Function ¶
type Function struct {
Schema string `json:"schema"`
Name string `json:"name"`
ArgumentTypes []string `json:"argument_types"`
ArgumentNames []string `json:"argument_names,omitempty"`
ArgumentModes []string `json:"argument_modes,omitempty"`
ReturnType string `json:"return_type"`
Language string `json:"language"`
Body string `json:"body"`
Volatility string `json:"volatility"`
Definition string `json:"definition"`
IsAggregate bool `json:"is_aggregate,omitempty"`
IsWindow bool `json:"is_window,omitempty"`
IsStrict bool `json:"is_strict,omitempty"`
IsSecurityDefiner bool `json:"is_security_definer,omitempty"`
Comment string `json:"comment,omitempty"`
Owner string `json:"owner,omitempty"`
}
func (*Function) ArgumentList ¶
func (*Function) QualifiedName ¶
type Hypertable ¶
type Hypertable struct {
Schema string `json:"schema"`
TableName string `json:"table_name"`
TimeColumnName string `json:"time_column_name"`
TimeColumnType string `json:"time_column_type"`
PartitionInterval string `json:"partition_interval"`
SpacePartitions int `json:"space_partitions,omitempty"`
SpaceColumns []string `json:"space_columns,omitempty"`
CompressionEnabled bool `json:"compression_enabled"`
CompressionSettings *CompressionSettings `json:"compression_settings,omitempty"`
RetentionPolicy *RetentionPolicy `json:"retention_policy,omitempty"`
ChunkTimeInterval string `json:"chunk_time_interval,omitempty"`
NumDimensions int `json:"num_dimensions"`
}
func (*Hypertable) QualifiedTableName ¶
func (h *Hypertable) QualifiedTableName() string
type Index ¶
type Index struct {
Schema string `json:"schema"`
TableName string `json:"table_name"`
Name string `json:"name"`
Columns []string `json:"columns"`
Type string `json:"type"`
IsUnique bool `json:"is_unique"`
IsPrimary bool `json:"is_primary"`
Where string `json:"where,omitempty"`
Definition string `json:"definition"`
IsExcludeConstraint bool `json:"is_exclude_constraint,omitempty"`
NullsNotDistinct bool `json:"nulls_not_distinct,omitempty"`
IncludeColumns []string `json:"include_columns,omitempty"`
Tablespace string `json:"tablespace,omitempty"`
StorageParams map[string]string `json:"storage_params,omitempty"`
}
func (*Index) ColumnList ¶
func (*Index) IncludeColumnList ¶
func (*Index) IsCoveringIndex ¶
func (*Index) IsExpression ¶
func (*Index) QualifiedName ¶
func (*Index) QualifiedTableName ¶
type MaterializedView ¶
type MaterializedView struct {
Schema string `json:"schema"`
Name string `json:"name"`
Definition string `json:"definition"`
Comment string `json:"comment,omitempty"`
Owner string `json:"owner,omitempty"`
Tablespace string `json:"tablespace,omitempty"`
Indexes []Index `json:"indexes,omitempty"`
WithData bool `json:"with_data"`
}
func (*MaterializedView) QualifiedName ¶
func (mv *MaterializedView) QualifiedName() string
type OrderByColumn ¶
type PartitionStrategy ¶
type RefreshPolicy ¶
type RetentionPolicy ¶
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"`
MaxValue int64 `json:"max_value"`
Increment int64 `json:"increment"`
CacheSize int64 `json:"cache_size"`
IsCyclic bool `json:"is_cyclic"`
OwnedByTable string `json:"owned_by_table,omitempty"`
OwnedByColumn string `json:"owned_by_column,omitempty"`
}
func (*Sequence) QualifiedName ¶
type Table ¶
type Table struct {
Schema string `json:"schema"`
Name string `json:"name"`
Columns []Column `json:"columns"`
Constraints []Constraint `json:"constraints,omitempty"`
Indexes []Index `json:"indexes,omitempty"`
Comment string `json:"comment,omitempty"`
Owner string `json:"owner,omitempty"`
Tablespace string `json:"tablespace,omitempty"`
PartitionStrategy *PartitionStrategy `json:"partition_strategy,omitempty"`
}
func (*Table) GetConstraint ¶
func (t *Table) GetConstraint(name string) *Constraint
func (*Table) GetPrimaryKey ¶
func (t *Table) GetPrimaryKey() *Constraint
func (*Table) QualifiedName ¶
type Trigger ¶
type Trigger struct {
Schema string `json:"schema"`
Name string `json:"name"`
TableName string `json:"table_name"`
Timing string `json:"timing"`
Events []string `json:"events"`
ForEachRow bool `json:"for_each_row"`
WhenCondition string `json:"when_condition,omitempty"`
FunctionSchema string `json:"function_schema"`
FunctionName string `json:"function_name"`
Definition string `json:"definition"`
Comment string `json:"comment,omitempty"`
}
func (*Trigger) QualifiedFunctionName ¶
func (*Trigger) QualifiedTableName ¶
type View ¶
type View struct {
Schema string `json:"schema"`
Name string `json:"name"`
Definition string `json:"definition"`
Comment string `json:"comment,omitempty"`
Owner string `json:"owner,omitempty"`
CheckOption string `json:"check_option,omitempty"`
IsUpdatable bool `json:"is_updatable,omitempty"`
}
func (*View) QualifiedName ¶
Click to show internal directories.
Click to hide internal directories.