NAME

DBIx::QuickORM::Affinity - Column affinity helpers for DBIx::QuickORM.

DESCRIPTION

Functions for working with column "affinities" - the broad value categories (string, numeric, binary, boolean) that drive type-aware comparison and introspection. Maps SQL type names to affinities, validates affinity names, and compares two values according to a given affinity.

All four functions are exported by default.

SYNOPSIS

use DBIx::QuickORM::Affinity;

my @all      = valid_affinities();
my $affinity = affinity_from_type('VARCHAR(255)');   # 'string'
my $ok       = validate_affinity('numeric');         # 'numeric'

my $same = compare_affinity_values('numeric', 1, 1.0);

EXPORTS

@affinities = valid_affinities()

Returns the sorted, de-duplicated list of valid affinity names.

$affinity_or_undef = validate_affinity($affinity)

Returns the affinity name if it is valid, otherwise returns nothing.

$bool = compare_affinity_values($affinity, $a, $b)

Compares two values under the given affinity and returns true when they are considered equal. For boolean, undef is treated as false; for the other affinities two undefs compare equal and a defined/undef mismatch is unequal. Croaks when $affinity is missing or not valid.

$affinity_or_undef = affinity_from_type($type)

Maps a SQL type name to an affinity. Lower-cases the type, strips any parenthesized size/precision, and resolves common tiny/medium/big/ long/var prefixes. Returns undef for unknown types.

SOURCE

The source code repository for DBIx::QuickORM can be found at https://github.com/exodist/DBIx-QuickORM.

MAINTAINERS

Chad Granum <exodist@cpan.org>

AUTHORS

Chad Granum <exodist@cpan.org>

COPYRIGHT

Copyright Chad Granum <exodist7@gmail.com>.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

See https://dev.perl.org/licenses/