Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FromJSONFile ¶
func SaveAsJSONFile ¶
Types ¶
type Export ¶
type Export struct {
DB *pgx.Conn
RootTable string
Filter string
RawQuery string
OutDir string
DryRun bool
Verbose bool
NoAnimations bool
}
func (*Export) Run ¶
Run the export
- Runs queries to understand your database schema
- Build a dependency graph of tables based on foreign key relationships (including transitive dependencies!)
- Provided with a root table an execution sequence is calculated to traverse the tree
- A set of queries are generated that copy data into temporary tables
- In the correct sequence (starting with the root table)
- Only including rows that are required to fulfil the foreign key relationships
- Queries are executed within a transaction for internal consistency
- COPY from commands are used to export these temp tables to CSV
type ExportTableQueries ¶
type Graph ¶
type GraphPrinter ¶
type GraphPrinter struct {
// contains filtered or unexported fields
}
func (*GraphPrinter) Init ¶
func (g *GraphPrinter) Init(w io.Writer)
func (*GraphPrinter) Render ¶
func (g *GraphPrinter) Render()
type Import ¶
type ImportTableQueries ¶
type ImportTableQueries struct {
Table string
Truncate string // TRUNCATE TABLE X CASCADE
Copy string // COPY X FROM STDIN ...
// Upsert mode: COPY into temp table, then INSERT ... ON CONFLICT
CreateTemp string // CREATE TEMP TABLE tmp_import_X (LIKE X INCLUDING ALL)
CopyTemp string // COPY tmp_import_X FROM STDIN WITH CSV HEADER ...
Upsert string // INSERT INTO X SELECT * FROM tmp ON CONFLICT (...) DO UPDATE SET ...
SoftInsert string // INSERT INTO X SELECT * FROM tmp ON CONFLICT (...) DO NOTHING
DropTemp string // DROP TABLE IF EXISTS tmp_import_X
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.