Documentation ¶
Index ¶
- func IsChunkEvent(relation *pgtypes.RelationMessage) bool
- func IsContinuousAggregateHypertable(hypertableName string) bool
- func IsHypertableEvent(relation *pgtypes.RelationMessage) bool
- func MakeRelationKey(schemaName, tableName string) string
- type Chunk
- func (c *Chunk) ApplyChanges(schemaName, tableName string, dropped bool, status int32, ...) (*Chunk, map[string]string)
- func (bse Chunk) CanonicalName() string
- func (c *Chunk) CompressedChunkId() *int32
- func (c *Chunk) Dropped() bool
- func (c *Chunk) HypertableId() int32
- func (c *Chunk) Id() int32
- func (c *Chunk) IsCompressed() bool
- func (c *Chunk) IsPartiallyCompressed() bool
- func (bse Chunk) SchemaName() string
- func (c *Chunk) Status() int32
- func (c *Chunk) String() string
- func (bse Chunk) TableName() string
- type Column
- func (c Column) DataType() uint32
- func (c Column) DefaultValue() *string
- func (c Column) DimensionType() *string
- func (c Column) Format() string
- func (c Column) IsDimension() bool
- func (c Column) IsDimensionAligned() bool
- func (c Column) IsNullable() bool
- func (c Column) IsPrimaryKey() bool
- func (c Column) IsReplicaIdent() bool
- func (c Column) MaxCharLength() *int
- func (c Column) Modifiers() int
- func (c Column) Name() string
- func (c Column) PgType() pgtypes.PgType
- func (c Column) SchemaBuilder() schema.SchemaBuilder
- func (c Column) SchemaType() schema.Type
- func (c Column) String() string
- type Columns
- type Hypertable
- func (h *Hypertable) ApplyChanges(schemaName, tableName, associatedSchemaName, associatedTablePrefix string, ...) (applied *Hypertable, changes map[string]string)
- func (h *Hypertable) ApplyTableSchema(newColumns []Column) (changes map[string]string)
- func (h *Hypertable) CanonicalContinuousAggregateName() string
- func (bse Hypertable) CanonicalName() string
- func (h *Hypertable) Columns() Columns
- func (h *Hypertable) CompressedHypertableId() (compressedHypertableId int32, present bool)
- func (h *Hypertable) DatabaseName() string
- func (h *Hypertable) Id() int32
- func (h *Hypertable) IsCompressedTable() bool
- func (h *Hypertable) IsCompressionEnabled() bool
- func (h *Hypertable) IsContinuousAggregate() bool
- func (h *Hypertable) IsDistributed() bool
- func (h *Hypertable) ReplicaIdentity() pgtypes.ReplicaIdentity
- func (h *Hypertable) SchemaBuilder() schema.SchemaBuilder
- func (bse Hypertable) SchemaName() string
- func (h *Hypertable) String() string
- func (h *Hypertable) TableColumns() []schema.ColumnAlike
- func (bse Hypertable) TableName() string
- func (h *Hypertable) ViewName() (viewName string, present bool)
- func (h *Hypertable) ViewSchema() (viewSchemaName string, present bool)
- type Index
- func (i *Index) AsSqlOrderBy(desc bool) string
- func (i *Index) AsSqlTuple() string
- func (i *Index) Columns() []Column
- func (i *Index) Name() string
- func (i *Index) PrimaryKey() bool
- func (i *Index) ReplicaIdentity() bool
- func (i *Index) String() string
- func (i *Index) WhereTupleEQ(params map[string]any) (string, bool)
- func (i *Index) WhereTupleGE(params map[string]any) (string, bool)
- func (i *Index) WhereTupleGT(params map[string]any) (string, bool)
- func (i *Index) WhereTupleLE(params map[string]any) (string, bool)
- func (i *Index) WhereTupleLT(params map[string]any) (string, bool)
- type IndexNullsOrder
- type IndexSortOrder
- type SystemEntity
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsChunkEvent ¶
func IsChunkEvent(relation *pgtypes.RelationMessage) bool
IsChunkEvent returns true if the given relation represents a chunk system catalog entry, otherwise false
func IsContinuousAggregateHypertable ¶
IsContinuousAggregateHypertable returns true if the given hypertable name is a backing hypertable for a continuous aggregate, otherwise false
func IsHypertableEvent ¶
func IsHypertableEvent(relation *pgtypes.RelationMessage) bool
IsHypertableEvent returns true if the given relation represents a hypertable system catalog entry, otherwise false
func MakeRelationKey ¶
Types ¶
type Chunk ¶
type Chunk struct {
// contains filtered or unexported fields
}
func (*Chunk) ApplyChanges ¶
func (Chunk) CanonicalName ¶
func (bse Chunk) CanonicalName() string
func (*Chunk) CompressedChunkId ¶
func (*Chunk) HypertableId ¶
func (*Chunk) IsCompressed ¶
func (*Chunk) IsPartiallyCompressed ¶
func (Chunk) SchemaName ¶
func (bse Chunk) SchemaName() string
type Column ¶
type Column struct {
// contains filtered or unexported fields
}
Column represents a column from a hypertable or index
func NewColumn ¶
func NewColumn(name string, dataType uint32, modifiers int, pgType pgtypes.PgType, nullable bool, defaultValue *string) Column
NewColumn instantiates a new Column instance which isn't part of any index. This method is a shorthand version of NewIndexColumn
func NewIndexColumn ¶
func NewIndexColumn(name string, dataType uint32, modifiers int, pgType pgtypes.PgType, nullable, primaryKey bool, keySeq *int, defaultValue *string, isReplicaIdent bool, indexName *string, sortOrder IndexSortOrder, nullsOrder IndexNullsOrder, dimension, dimAligned bool, dimType *string, dimSeq, maxCharLength *int) Column
NewIndexColumn instantiates a new Column instance
func (Column) DefaultValue ¶
DefaultValue returns the default value of the column, otherwise nil if no default value is defined
func (Column) DimensionType ¶
DimensionType returns the type (`space` or `time`) of the dimension. If not a dimension, this function returns nil.
func (Column) IsDimension ¶
IsDimension returns true if the column is used as a dimension of the hypertable
func (Column) IsDimensionAligned ¶
IsDimensionAligned returns true if the range of the dimension is aligned
func (Column) IsNullable ¶
IsNullable returns true if the column is nullable
func (Column) IsPrimaryKey ¶
IsPrimaryKey returns true if the columns is part of a primary key index
func (Column) IsReplicaIdent ¶
IsReplicaIdent returns true if the columns is part of a replica identity index
func (Column) MaxCharLength ¶ added in v0.3.1
MaxCharLength returns the maximum number of characters necessary to represent the value as a string (if the type is type limited), otherwise it returns nil
func (Column) Modifiers ¶ added in v0.3.1
Modifiers returns the type specific modifiers for this column. If no specific modifiers is set, -1 is returned
func (Column) SchemaBuilder ¶ added in v0.3.0
func (c Column) SchemaBuilder() schema.SchemaBuilder
SchemaBuilder returns a schema builder based on the column's PgType and internal state (default value, nullable, name, etc).
func (Column) SchemaType ¶ added in v0.3.1
type Columns ¶
type Columns []Column
Columns represents a collection of columns which may or may not represent an index
func (Columns) HasPrimaryKey ¶
HasPrimaryKey returns true if the collection of columns contains one or more primary key column(s)
func (Columns) HasReplicaIdentity ¶
HasReplicaIdentity returns true if the collection of columns contains one or more replica identity column(s)
func (Columns) PrimaryKeyIndex ¶
PrimaryKeyIndex returns an Index instance which represents the primary key definition of the collection of columns and true, otherwise present will be false, meaning, that there isn't a primary key available in this collection
func (Columns) ReplicaIdentityIndex ¶
ReplicaIdentityIndex returns an Index instance which represents the primary key definition of the collection of columns and true, otherwise present will be false, meaning, that there isn't a primary key available in this collection
func (Columns) SnapshotIndex ¶
SnapshotIndex returns the index used for snapshot watermarks. This can either be an actual index, such as a primary key, or a virtual index based on the dimensions of the hypertable.
type Hypertable ¶
type Hypertable struct {
// contains filtered or unexported fields
}
Hypertable represents a TimescaleDB hypertable definition in the system catalog
func NewHypertable ¶
func NewHypertable(id int32, databaseName, schemaName, tableName, associatedSchemaName, associatedTablePrefix string, compressedHypertableId *int32, compressionState int16, distributed bool, viewSchema, viewName *string, replicaIdentity pgtypes.ReplicaIdentity) *Hypertable
NewHypertable instantiates a new Hypertable entity
func (*Hypertable) ApplyChanges ¶
func (h *Hypertable) ApplyChanges( schemaName, tableName, associatedSchemaName, associatedTablePrefix string, compressedHypertableId *int32, compressionState int16, replicaIdentity pgtypes.ReplicaIdentity) (applied *Hypertable, changes map[string]string)
ApplyChanges applies catalog changes to a copy of the hypertable instance (not updating the current one) and returns the new instance and a collection of applied changes.
func (*Hypertable) ApplyTableSchema ¶
func (h *Hypertable) ApplyTableSchema(newColumns []Column) (changes map[string]string)
ApplyTableSchema applies a new hypertable schema to this hypertable instance and returns changes to the previously known schema layout.
func (*Hypertable) CanonicalContinuousAggregateName ¶
func (h *Hypertable) CanonicalContinuousAggregateName() string
CanonicalContinuousAggregateName returns the canonical continuous aggregate name of the hypertable in the form of <<schema.view>>. This method panics if the hypertable doesn't back a continuous aggregate. A check using IsContinuousAggregate before calling this method is adviced.
func (Hypertable) CanonicalName ¶
func (bse Hypertable) CanonicalName() string
func (*Hypertable) Columns ¶
func (h *Hypertable) Columns() Columns
Columns returns a slice with the column definitions of the hypertable
func (*Hypertable) CompressedHypertableId ¶
func (h *Hypertable) CompressedHypertableId() (compressedHypertableId int32, present bool)
CompressedHypertableId returns the id of a hypertable which is used to represent the compressed chunks and true, otherwise present will be false
func (*Hypertable) DatabaseName ¶
func (h *Hypertable) DatabaseName() string
DatabaseName returns the database name
func (*Hypertable) IsCompressedTable ¶
func (h *Hypertable) IsCompressedTable() bool
IsCompressedTable returns true if the hypertable is a compressed hypertable (not if the hypertable has compression enabled), otherwise false
func (*Hypertable) IsCompressionEnabled ¶
func (h *Hypertable) IsCompressionEnabled() bool
IsCompressionEnabled returns true if the hypertable has compression enabled (not if the hypertable is a compressed hypertable), otherwise false
func (*Hypertable) IsContinuousAggregate ¶
func (h *Hypertable) IsContinuousAggregate() bool
IsContinuousAggregate returns true if the hypertable is a backing hypertable for a continues aggregate, otherwise false
func (*Hypertable) IsDistributed ¶
func (h *Hypertable) IsDistributed() bool
IsDistributed returns true if the hypertable is a distributed hypertable, otherwise false
func (*Hypertable) ReplicaIdentity ¶
func (h *Hypertable) ReplicaIdentity() pgtypes.ReplicaIdentity
ReplicaIdentity returns the replica identity (if available), otherwise a pgtypes.UNKNOWN is returned
func (*Hypertable) SchemaBuilder ¶ added in v0.3.0
func (h *Hypertable) SchemaBuilder() schema.SchemaBuilder
SchemaBuilder returns a SchemaBuilder instance, preconfigured for this hypertable instance
func (Hypertable) SchemaName ¶
func (bse Hypertable) SchemaName() string
func (*Hypertable) String ¶ added in v0.0.10
func (h *Hypertable) String() string
func (*Hypertable) TableColumns ¶ added in v0.3.1
func (h *Hypertable) TableColumns() []schema.ColumnAlike
func (*Hypertable) ViewName ¶
func (h *Hypertable) ViewName() (viewName string, present bool)
ViewName returns the view name and true if the hypertable is a backing hypertable for a continuous aggregate, otherwise the present will be false
func (*Hypertable) ViewSchema ¶
func (h *Hypertable) ViewSchema() (viewSchemaName string, present bool)
ViewSchema returns the view schema name and true if the hypertable is a backing hypertable for a continuous aggregate, otherwise the present will be false
type Index ¶
type Index struct {
// contains filtered or unexported fields
}
Index represents either a (compound) primary key index or replica identity index in the database and attached to a hypertable (and its chunks)
func (*Index) AsSqlOrderBy ¶
AsSqlOrderBy creates a string for ORDER BY clauses with all parts of the index being ordered in descending direction
func (*Index) AsSqlTuple ¶
AsSqlTuple creates a string to be used as a tuple definition in a WHERE-clause: (col1, col2, col3, ...)
func (*Index) Columns ¶
Columns returns an array of colum instances representing the columns of the index (in order of definition)
func (*Index) PrimaryKey ¶
PrimaryKey returns true if the index represents a primary key, otherwise false
func (*Index) ReplicaIdentity ¶
ReplicaIdentity returns true if the index represents a replica identity index, otherwise false
func (*Index) WhereTupleEQ ¶
WhereTupleEQ creates a WHERE-clause string which selects all values equal to the given set of index parameter values
func (*Index) WhereTupleGE ¶
WhereTupleGE creates a WHERE-clause string which selects all values greater or equal to the given set of index parameter values
func (*Index) WhereTupleGT ¶
WhereTupleGT creates a WHERE-clause string which selects all values greater than to the given set of index parameter values
func (*Index) WhereTupleLE ¶
WhereTupleLE creates a WHERE-clause string which selects all values less or equal to the given set of index parameter values
type IndexNullsOrder ¶
type IndexNullsOrder string
const ( NULLS_FIRST IndexNullsOrder = "NULLS FIRST" NULLS_LAST IndexNullsOrder = "NULLS LAST" )
type IndexSortOrder ¶
type IndexSortOrder string
const ( ASC IndexSortOrder = "ASC" DESC IndexSortOrder = "DESC" )
type SystemEntity ¶
type SystemEntity interface { // SchemaName returns the schema name of the entity SchemaName() string // TableName returns the table name of the entity TableName() string // CanonicalName returns the canonical name of the entity >>schema.table<< CanonicalName() string }
SystemEntity represents an entity defined by its canonical elements (schema and table names)
func NewSystemEntity ¶
func NewSystemEntity(schemaName, tableName string) SystemEntity
NewSystemEntity instantiates a new basic SystemEntity