aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMarcos Magueta <maguetamarcos@gmail.com>2026-01-03 20:58:59 -0300
committerGitHub <noreply@github.com>2026-01-03 20:58:59 -0300
commita138f1c57ef376a3f2521ce1f8877ed97bc3e654 (patch)
treec400a4888b6ef004300f28e09e313bb85984d6a4 /include
parentc9b69ab3ae238da966bcba3d3e86f5c27a0df922 (diff)
downloadSakura-a138f1c57ef376a3f2521ce1f8877ed97bc3e654.tar.gz
Sakura-a138f1c57ef376a3f2521ce1f8877ed97bc3e654.zip
Refactor constraint system (#49)
* fix dialyzer and clean code * rework on validation criterias and mnesia-aware domains * [refactor] add comparison relations to database startup * fix nix build * fix docs for edoc
Diffstat (limited to 'include')
-rw-r--r--include/operations.hrl22
1 files changed, 3 insertions, 19 deletions
diff --git a/include/operations.hrl b/include/operations.hrl
index 0200c44..2afb27b 100644
--- a/include/operations.hrl
+++ b/include/operations.hrl
@@ -10,7 +10,7 @@
constraints, % #relation_constraints{} - all constraint types (1OP, 2OP, 3OP)
cardinality, % {finite, N} | aleph_zero | continuum
generator, % Generator function (immutable only), undefined for tree-based
- membership_criteria, % #{attribute_name => constraint_spec()} - domain membership test
+ membership_criteria, % #{attribute_name => constraint:relational_constraint()} - domain membership test
provenance, % attribute_provenance() - maps attribute to source relation
lineage % lineage_op() - operation tree showing derivation
}).
@@ -23,7 +23,7 @@
name, % Atom - relation name
schema, % #{attribute_name => relation_name}
generator, % {module, function} - tuple generator
- membership_criteria, % #{attribute_name => constraint_spec()} - domain membership
+ membership_criteria, % #{attribute_name => constraint:relational_constraint()} - domain membership
cardinality % {finite, N} | aleph_zero | continuum
}).
@@ -48,23 +48,7 @@
| aleph_zero % Countably infinite (ℵ₀)
| continuum. % Uncountably infinite (2^ℵ₀)
-%%% Constraint Types
-
--type constraint_spec() ::
- {eq, term()} % Equality: attr = value
- | {neq, term()} % Inequality: attr ≠ value
- | {lt, number()} % Less than: attr < value
- | {lte, number()} % Less than or equal: attr ≤ value
- | {gt, number()} % Greater than: attr > value
- | {gte, number()} % Greater than or equal: attr ≥ value
- | {in, [term()]} % Membership: attr ∈ list
- | {range, number(), number()} % Range: attr ∈ [min, max]
- | {member_of, atom()} % Type constraint: attr ∈ Relation
- | {'and', [term()]}
- | is_integer
- | is_float.
-
--type constraints() :: #{atom() => constraint_spec()}.
+-type constraints() :: #{atom() => constraint:relational_constraint()}.
-type boundedness_constraints() :: #{atom() => constraints()}.