Documentation
¶
Overview ¶
Package postgresql provides methods to interact with PostgreSQL server
Index ¶
- Variables
- func GetDatabaseConnection(c ConnectionSettings) (*pgx.Conn, error)
- type ColumnType
- type ConnectionSettings
- type PartitionResult
- type PgxIface
- type Postgres
- func (p Postgres) AttachPartition(schema, table, parent, lowerBound, upperBound string) error
- func (p Postgres) CreateTableLikeTable(schema, table, parent string) error
- func (p Postgres) DetachPartitionConcurrently(schema, table, parent string) error
- func (p Postgres) DropTable(schema, table string) error
- func (p Postgres) FinalizePartitionDetach(schema, table, parent string) error
- func (p Postgres) GetColumnDataType(schema, table, column string) (ColumnType, error)
- func (p *Postgres) GetEngineVersion() (int64, error)
- func (p Postgres) GetPartitionSettings(schema, table string) (strategy, key string, err error)
- func (p *Postgres) GetServerTime() (serverTime time.Time, err error)
- func (p Postgres) IsPartitionAttached(schema, table string) (exists bool, err error)
- func (p Postgres) IsTableExists(schema, table string) (exists bool, err error)
- func (p Postgres) ListPartitions(schema, table string) (partitions []PartitionResult, err error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrUnsupportedPartitionStrategy represents an error indicating that the partitioning strategy on the table is not supported. ErrUnsupportedPartitionStrategy = errors.New("unsupported partitioning strategy") // ErrTableIsNotPartitioned represents an error indicating the specified table don't have partitioning ErrTableIsNotPartitioned = errors.New("table is not partitioned") )
View Source
var ErrUnkownServerVersion = errors.New("could not find server version")
View Source
var ErrUnsupportedPartitionKeyType = errors.New("unsupported partition key column type")
ErrUnsupportedPartitionKeyType represents an error indicating that the column type for partitioning is not supported.
Functions ¶
func GetDatabaseConnection ¶
func GetDatabaseConnection(c ConnectionSettings) (*pgx.Conn, error)
Types ¶
type ColumnType ¶
type ColumnType string
const ( Date ColumnType = "date" DateTime ColumnType = "timestamp" DateTimeWithTZ ColumnType = "timestamp with time zone" UUID ColumnType = "uuid" )
type ConnectionSettings ¶
type PartitionResult ¶
type Postgres ¶
type Postgres struct {
// contains filtered or unexported fields
}
func (Postgres) AttachPartition ¶
func (Postgres) CreateTableLikeTable ¶
func (Postgres) DetachPartitionConcurrently ¶
DetachPartitionConcurrently detaches specified partition from the parent table. The partition still exists as standalone table after detaching More info: https://www.postgresql.org/docs/current/sql-altertable.html#SQL-ALTERTABLE-DETACH-PARTITION
func (Postgres) FinalizePartitionDetach ¶
FinalizePartitionDetach finalizes a partition detach operation. It's required when a partition is in "detach pending" status. More info: https://www.postgresql.org/docs/current/sql-altertable.html#SQL-ALTERTABLE-DETACH-PARTITION
func (Postgres) GetColumnDataType ¶
func (p Postgres) GetColumnDataType(schema, table, column string) (ColumnType, error)
func (*Postgres) GetEngineVersion ¶
func (Postgres) GetPartitionSettings ¶
func (*Postgres) GetServerTime ¶
func (Postgres) IsPartitionAttached ¶
func (Postgres) IsTableExists ¶
func (Postgres) ListPartitions ¶
func (p Postgres) ListPartitions(schema, table string) (partitions []PartitionResult, err error)
Click to show internal directories.
Click to hide internal directories.