Documentation ¶
Index ¶
- Variables
- func DetectPgVersion(versionFilePath string) (versionNumber string, err error)
- func IsPgVersionSupported(versionFilePath string) error
- func LDouble(bs []byte) (f float64)
- func LInt16(bs []byte) (i int16)
- func LInt32(bs []byte) (i int32)
- func LInt64(bs []byte) (i int64)
- func LInt8(bs []byte) (i int8)
- func LSingle(bs []byte) (f float32)
- func LUint(bs []byte) uint64
- type DatabaseDetails
- type Schema
- type SchemaField
- type SchemaReader
- func (sr *SchemaReader) ConvertRelNamesToIds(names []string) map[uint32]string
- func (sr *SchemaReader) GetDatabaseName(databaseID uint32) string
- func (sr *SchemaReader) GetFieldValues(databaseID uint32, relationID uint32, block uint32, offset uint16) (map[SchemaField]string, error)
- func (sr *SchemaReader) GetNamespaceAndTable(databaseID uint32, relationID uint32) (string, string)
- func (sr *SchemaReader) HaveConnectionToDb(databaseID uint32) bool
- func (sr *SchemaReader) LatestReplayLocation() uint64
Constants ¶
This section is empty.
Variables ¶
var ErrIncorrectVersion = errors.New("only postgres 9.1 is supported")
ErrIncorrectVersion is returned when a non supported postgres is found.
Functions ¶
func DetectPgVersion ¶
DetectPgVersion attempts to determine what version of postgres a data directory is based on.
func IsPgVersionSupported ¶
IsPgVersionSupported returns an error if the postgres version is not supported currently.
Types ¶
type DatabaseDetails ¶
DatabaseDetails represents a connection
type Schema ¶
type Schema struct { Database string Namespace string Table string Fields []*SchemaField }
Schema is the full representation of a Table
func (*Schema) GetTextColumnQuery ¶
GetTextColumnQuery will create a list of column names casted to return text
type SchemaField ¶
SchemaField represents a Column
func (SchemaField) String ¶
func (sf SchemaField) String() string
type SchemaReader ¶
type SchemaReader struct {
// contains filtered or unexported fields
}
SchemaReader is used to determine the schema from a database via queries.
func NewSchemaReader ¶
func NewSchemaReader(creds []string, driverName string, fieldSizeLimit uint32) (*SchemaReader, error)
NewSchemaReader takes a list of connections, the golang db driver name and a field size limit and returns a schema reader.
func (*SchemaReader) ConvertRelNamesToIds ¶
func (sr *SchemaReader) ConvertRelNamesToIds(names []string) map[uint32]string
ConvertRelNamesToIds takes a table name in the form db.ns.name and gets the postgres id for that relation.
func (*SchemaReader) GetDatabaseName ¶
func (sr *SchemaReader) GetDatabaseName(databaseID uint32) string
GetDatabaseName takes a postgres database id and returns the name of it.
func (*SchemaReader) GetFieldValues ¶
func (sr *SchemaReader) GetFieldValues(databaseID uint32, relationID uint32, block uint32, offset uint16) (map[SchemaField]string, error)
GetFieldValues takes database id, a table id, and a tuple and returns the fields for that table
func (*SchemaReader) GetNamespaceAndTable ¶
func (sr *SchemaReader) GetNamespaceAndTable(databaseID uint32, relationID uint32) (string, string)
GetNamespaceAndTable takes a database id and a relation id and returns the namespace and table names
func (*SchemaReader) HaveConnectionToDb ¶
func (sr *SchemaReader) HaveConnectionToDb(databaseID uint32) bool
HaveConnectionToDb returns true if the db id in question has a connection defined.
func (*SchemaReader) LatestReplayLocation ¶
func (sr *SchemaReader) LatestReplayLocation() uint64
LatestReplayLocation finds the last replicated WAL entry