EntryTypesMap
Read onlyYes
FinalYes
Maps ETL Entry types to PostgreSQL types.
Users can customize the mapping by passing overrides to the constructor. Entry classes not in the map will throw TypeMappingException.
Example usage:
// Use defaults
$map = new EntryTypesMap();
// Override specific types
$map = new EntryTypesMap([
IntegerEntry::class => PostgreSqlType::INT2,
ListEntry::class => PostgreSqlType::TEXT_ARRAY,
]);
Constants
- DEFAULT_TYPES = [\Flow\ETL\Row\Entry\StringEntry::class => \Flow\PostgreSql\Client\Types\PostgreSqlType::TEXT, \Flow\ETL\Row\Entry\IntegerEntry::class => \Flow\PostgreSql\Client\Types\PostgreSqlType::INT8, \Flow\ETL\Row\Entry\FloatEntry::class => \Flow\PostgreSql\Client\Types\PostgreSqlType::FLOAT8, \Flow\ETL\Row\Entry\BooleanEntry::class => \Flow\PostgreSql\Client\Types\PostgreSqlType::BOOL, \Flow\ETL\Row\Entry\DateEntry::class => \Flow\PostgreSql\Client\Types\PostgreSqlType::DATE, \Flow\ETL\Row\Entry\DateTimeEntry::class => \Flow\PostgreSql\Client\Types\PostgreSqlType::TIMESTAMPTZ, \Flow\ETL\Row\Entry\TimeEntry::class => \Flow\PostgreSql\Client\Types\PostgreSqlType::TIME, \Flow\ETL\Row\Entry\UuidEntry::class => \Flow\PostgreSql\Client\Types\PostgreSqlType::UUID, \Flow\ETL\Row\Entry\JsonEntry::class => \Flow\PostgreSql\Client\Types\PostgreSqlType::JSONB, \Flow\ETL\Row\Entry\XMLEntry::class => \Flow\PostgreSql\Client\Types\PostgreSqlType::XML, \Flow\ETL\Row\Entry\XMLElementEntry::class => \Flow\PostgreSql\Client\Types\PostgreSqlType::XML, \Flow\ETL\Row\Entry\HTMLEntry::class => \Flow\PostgreSql\Client\Types\PostgreSqlType::TEXT, \Flow\ETL\Row\Entry\HTMLElementEntry::class => \Flow\PostgreSql\Client\Types\PostgreSqlType::TEXT, \Flow\ETL\Row\Entry\EnumEntry::class => \Flow\PostgreSql\Client\Types\PostgreSqlType::TEXT, \Flow\ETL\Row\Entry\ListEntry::class => \Flow\PostgreSql\Client\Types\PostgreSqlType::JSONB, \Flow\ETL\Row\Entry\MapEntry::class => \Flow\PostgreSql\Client\Types\PostgreSqlType::JSONB, \Flow\ETL\Row\Entry\StructureEntry::class => \Flow\PostgreSql\Client\Types\PostgreSqlType::JSONB]
- Default mapping of Entry classes to PostgreSQL types.
Methods
- __construct() : mixed
- mapEntry() : TypedValue|null
- Maps an Entry to a TypedValue suitable for PostgreSQL queries.
Constants
DEFAULT_TYPES
Default mapping of Entry classes to PostgreSQL types.
public
mixed
DEFAULT_TYPES
= [\Flow\ETL\Row\Entry\StringEntry::class => \Flow\PostgreSql\Client\Types\PostgreSqlType::TEXT, \Flow\ETL\Row\Entry\IntegerEntry::class => \Flow\PostgreSql\Client\Types\PostgreSqlType::INT8, \Flow\ETL\Row\Entry\FloatEntry::class => \Flow\PostgreSql\Client\Types\PostgreSqlType::FLOAT8, \Flow\ETL\Row\Entry\BooleanEntry::class => \Flow\PostgreSql\Client\Types\PostgreSqlType::BOOL, \Flow\ETL\Row\Entry\DateEntry::class => \Flow\PostgreSql\Client\Types\PostgreSqlType::DATE, \Flow\ETL\Row\Entry\DateTimeEntry::class => \Flow\PostgreSql\Client\Types\PostgreSqlType::TIMESTAMPTZ, \Flow\ETL\Row\Entry\TimeEntry::class => \Flow\PostgreSql\Client\Types\PostgreSqlType::TIME, \Flow\ETL\Row\Entry\UuidEntry::class => \Flow\PostgreSql\Client\Types\PostgreSqlType::UUID, \Flow\ETL\Row\Entry\JsonEntry::class => \Flow\PostgreSql\Client\Types\PostgreSqlType::JSONB, \Flow\ETL\Row\Entry\XMLEntry::class => \Flow\PostgreSql\Client\Types\PostgreSqlType::XML, \Flow\ETL\Row\Entry\XMLElementEntry::class => \Flow\PostgreSql\Client\Types\PostgreSqlType::XML, \Flow\ETL\Row\Entry\HTMLEntry::class => \Flow\PostgreSql\Client\Types\PostgreSqlType::TEXT, \Flow\ETL\Row\Entry\HTMLElementEntry::class => \Flow\PostgreSql\Client\Types\PostgreSqlType::TEXT, \Flow\ETL\Row\Entry\EnumEntry::class => \Flow\PostgreSql\Client\Types\PostgreSqlType::TEXT, \Flow\ETL\Row\Entry\ListEntry::class => \Flow\PostgreSql\Client\Types\PostgreSqlType::JSONB, \Flow\ETL\Row\Entry\MapEntry::class => \Flow\PostgreSql\Client\Types\PostgreSqlType::JSONB, \Flow\ETL\Row\Entry\StructureEntry::class => \Flow\PostgreSql\Client\Types\PostgreSqlType::JSONB]
Methods
__construct()
public
__construct([array<string|int, mixed> $overrides = [] ]) : mixed
Parameters
- $overrides : array<string|int, mixed> = []
mapEntry()
Maps an Entry to a TypedValue suitable for PostgreSQL queries.
public
mapEntry(Entry<string|int, mixed> $entry) : TypedValue|null
Parameters
- $entry : Entry<string|int, mixed>