Repository navigation
Releases
Releases · rasuvaeff/specification
v1.4.0
- Added.
InMemorySpecification::satisfies(Specification $specification, array $row): bool— an in-memory interpreter for a specification (#40): a
rule written once as a specification holds both in a query (the existing
QueryApplier) and on a single row the read model already holds.
Comparisons (=,!=,<>,<,<=,>,>=,in,not in,
between,not between,is/is notnull) and AND, OR, NOT are
supported; ordering, LIMIT and OFFSET are ignored (they do not filter).
Verdicts are the SQL the package actually builds, guarded by a property
test against real SQLite: type coercion as SQL compares ('1'against1
agrees), a NULL row value is UNKNOWN andNOTof it stays unknown
(three-valued logic), a NULL entry in anin/not inlist is yiisoft/db's
IS NULL/IS NOT NULLrendering, an emptyinis0=1and an empty
not inadds no condition. Thelikefamily, date values, raw SQL and raw
OR conditions are refused with aLogicExceptionnaming what — as is a
non-numeric string against a number, where SQL engines disagree on the
coercion.
v1.3.3
Fixed
- Reject unknown operators in direct
OrConditionSpecificationconditions
instead of allowing SQL syntax to be injected through the operator position. SpecificationBuilder::orWhere()now keepsORDER BY,LIMITandOFFSET
outside OR branches, and nestedorWhere()/notWhere()callbacks retain
the builder returned by the callback.BETWEENvalues must be zero-based lists with exactly two elements, so
malformed associative arrays fail during specification construction.DateTimeInterfacevalues are passed throughyiisoft/db's timezone-aware
DateTimeValuewith six-digit fractional precision.- Update the test adapter dependency to
rasuvaeff/property-testing-testo
^0.10. - Direct
NOTspecifications now preserve nestedORDER BY,LIMITand
OFFSETmodifiers, matching the existingORbehavior. - Canonical three-element
LIKEconditions inOrConditionSpecificationnow
reject non-string patterns instead of passing malformed input to the query
builder. - Track
build/.gitkeepso coverage and other build outputs have a directory
in fresh checkouts. - Document the public
OrderBySpecificationandLimitSpecificationclasses.
v1.3.1
Fixed
- An OR condition written as
['is', value]/['is not', value](or handed
toOrConditionSpecificationas['is', column, value]) was passed to
yiisoft/db verbatim and renderedcol IS 'value'— a syntax error on MySQL
and PostgreSQL that SQLite alone accepts. The OR path now mapsis/is not
to=/!=exactly asvisitComparison()does: anulloperand still
rendersIS NULL/IS NOT NULL, any other operand a plain equality (#34).
v1.3.0
Fixed
- Renaming a colliding raw placeholder also rewrote every sibling it was a
prefix of::sort→:sort_0turned:sort_maxinto:sort_0_max, which
nothing bound, and the query failed withcolumn index out of range. The
rename now replaces whole:nametokens only, in one pass (#30). - Two
RawSpecifications reusing one placeholder name under a single
CompositeSpecificationoverwrote each other's value, soa AND bselected
a different row set thanb AND a.visitRaw()now routes its params
through the same remap as NOT/OR: the second leaf binds:name_0. As a
consequencegetParams()keys of raw leaves are always colon-prefixed
(['age' => 18]is bound as':age'); positional?params keep their
integer keys instead of being turned into a:0name (#31).
v1.2.0
Fixed
startsWith(),endsWith()andcontains()searched for a literal%:
yiisoft/db ≥ 2.0 escapes the LIKE value and wraps it in%…%unless told
otherwise, so the wildcard the factory added was escaped. The three helpers
now hand a clean string to the builder withmode: LikeMode::StartsWith
/EndsWith/Contains, andlike()/notLike()send the pattern
verbatim (mode: Custom,escape: false) — also for a['like', col, pattern]entry ofwithOrCondition().ilike/not ilikeno longer
render a verbatimILIKE(a syntax error outside PostgreSQL): they are
LIKEwithcaseSensitive: false. NewLikeMatchenum,
ComparisonSpecification::getLikeMatch()and an optional$likeMatch
argument on the constructor,CompositeSpecification::withComparison()
andSpecificationBuilder::where(). A custom visitor that reads
getValue()of astartsWith()/endsWith()/contains()specification
now gets the bare string and must honourgetLikeMatch()(#27).
Changed
- Add a
zizmorGitHub Actions security audit workflow and skip heavy CI jobs on irrelevant changes via a path-aware gate.
v1.1.0
- Ship an AI agent skill (
resources/skills/rasuvaeff-specification/SKILL.mdextra.skillsin composer.json): projects using thellm/skillsComposer
plugin get the skill synced into.agents/skills/automatically on install.
- Bump dev dependency
rasuvaeff/property-testingto^2.6.