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 all rows from the given table and returns them as a slice of maps (column name to value) along with the ordered column names. Values are normalized using NormalizeValue. It first tries ANSI SQL double-quoted table names and falls back to MySQL backtick quoting if the first attempt fails.
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.