Documentation ¶
Index ¶
- func S3Filename(prefix string, table string) string
- type ColInfo
- type DB
- func (db *DB) DumpTableToS3(table string, s3file string) error
- func (db *DB) DumpTablesToS3(tables []string, s3prefix string) error
- func (db *DB) GetTableSchema(table, namespace string) (TableSchema, error)
- func (db *DB) GetTableSchemas(tables []string, namespace string) (map[string]TableSchema, error)
- type TableSchema
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func S3Filename ¶
S3Filename returns the s3 filename used for storing the table data.
Types ¶
type ColInfo ¶
type ColInfo struct { Ordinal int Name string ColType string DefaultVal string NotNull bool PrimaryKey bool }
ColInfo is a struct that contains information about a column in a postgreSQL database.
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB is a struct that is used to perform operations on a postgreSQL database.
func (*DB) DumpTableToS3 ¶
DumpTableToS3 dumps a single table to S3 by executing a COPY TO query and writing the gzipped CSV data to an S3 file.
func (*DB) DumpTablesToS3 ¶
DumpTablesToS3 dumps multiple tables to s3 in parallel.
func (*DB) GetTableSchema ¶
func (db *DB) GetTableSchema(table, namespace string) (TableSchema, error)
GetTableSchema returns the schema for a postgresSQL table by performing a query on the postgreSQL internal tables. TODO: include foreign key relations
func (*DB) GetTableSchemas ¶
GetTableSchemas returns a map from a tablename to its schema. Gets schemas for different tables in parallel.
type TableSchema ¶
type TableSchema []*ColInfo
TableSchema is a type which models the schema of a postgreSQL table.
func (TableSchema) Len ¶
func (ts TableSchema) Len() int
func (TableSchema) Less ¶
func (ts TableSchema) Less(i, j int) bool
func (*TableSchema) New ¶
func (ts *TableSchema) New() interface{}
New adds a pointer to a new ColInfo object to the TableSchema and returns it.
func (TableSchema) Swap ¶
func (ts TableSchema) Swap(i, j int)