Documentation
¶
Overview ¶
Package dumpdata provides database introspection and row fetching utilities for the dump-data feature. It supports PostgreSQL, SQLite, MySQL, and TiDB for primary key detection, and generic row fetching for any SQL database.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DetectPrimaryKeys ¶
DetectPrimaryKeys introspects the database to find primary key columns for the given table. The dbType parameter determines which SQL dialect to use for the introspection query. Supported values are "postgresql", "postgres", "sqlite", "mysql", and "tidb". For unsupported database types, it returns nil, nil so the caller can fall back to a user-specified conflict key.
func FetchRows ¶
FetchRows queries rows from the given table, optionally filtered by a WHERE clause. The where parameter should contain just the condition (e.g. "status = 'active'"), not the WHERE keyword itself. Pass an empty string to fetch all rows.
Note: the where clause is appended to the query as-is. The caller is responsible for ensuring it is valid SQL. This is safe because the where value originates from the CLI operator (the person running the tool), not from untrusted external input.
func NormalizeValue ¶
NormalizeValue converts driver-specific types to clean Go types suitable for serialization. It handles nil, []byte, time.Time, int64, float64, bool, and falls back to fmt.Sprintf for any other type.
Types ¶
This section is empty.