Querying #17

Merged
c.fahner merged 13 commits from issues/2 into main 2026-08-18 18:20:00 +02:00
Owner

Resolves #2.

  • Introduces the Predicate interface and the Predicate\Expr namespace
  • Introduces the DocumentShape query builder
  • Introduces the FieldPath value object
  • Introduces the StorageClass enum
Resolves #2. * Introduces the Predicate interface and the Predicate\Expr namespace * Introduces the DocumentShape query builder * Introduces the FieldPath value object * Introduces the StorageClass enum
c.fahner added this to the v0.1 milestone 2026-08-14 19:50:40 +02:00
c.fahner changed title from WIP: Querying to Querying 2026-08-18 06:44:43 +02:00
@ -0,0 +11,4 @@
*
* A document shape in SQL is essentially a `WHERE` clause specifying multiple fields and the patterns
* they must match for a row to be included in the results.
* For example: `WHERE name = :name AND number >= :number AND flag = 0 AND...` would be created as follows:
Author
Owner

Update this example to match the actual code example

Update this example to match the actual code example
c.fahner marked this conversation as resolved
@ -0,0 +123,4 @@
* @param non-empty-list<string|float|int|bool|null> $values
* @return Closure(FieldPath):Expr\MatchAll
*/
public static function all(array $values): Closure {
Author
Owner

Rename matchAll()

Rename `matchAll()`
c.fahner marked this conversation as resolved
@ -0,0 +132,4 @@
* @param non-empty-list<string|float|int|bool|null> $values
* @return Closure(FieldPath):Expr\MatchSome
*/
public static function some(array $values): Closure {
Author
Owner

Rename matchSome()

Rename `matchSome()`
c.fahner marked this conversation as resolved
@ -0,0 +141,4 @@
* @param non-empty-list<string|float|int|bool|null> $values
* @return Closure(FieldPath):Expr\MatchNone
*/
public static function none(array $values): Closure {
Author
Owner

Rename matchNone()

Rename `matchNone()`
c.fahner marked this conversation as resolved
@ -0,0 +154,4 @@
}
/**
* @since 1.0
Author
Owner

Document what is considered "empty"

Document what is considered "empty"
c.fahner marked this conversation as resolved
@ -0,0 +165,4 @@
}
/**
* @since 1.0
Author
Owner

Add @see ::isEmpty()

Add `@see ::isEmpty()`
c.fahner marked this conversation as resolved
@ -0,0 +197,4 @@
* @param (Closure(FieldPath):Predicate)|string|float|int|bool|null $wrappee
* @return Closure(FieldPath):Predicate
*/
public static function path(array $path, Closure|string|float|int|bool|null $wrappee): Closure {
Author
Owner

Q::path([ 'example' ], 'test') looks ambiguous. It is not necessarily clear that this is an "equals" operation.

Add an explicit eq method that returns a Closure():Expr\Equal and restrict $wrappee to only allow Closure's.

`Q::path([ 'example' ], 'test')` looks ambiguous. It is not necessarily clear that this is an "equals" operation. Add an explicit `eq` method that returns a `Closure():Expr\Equal` and restrict `$wrappee` to only allow `Closure`'s.
c.fahner marked this conversation as resolved
Add ::eq() method
Limit ::path() method to only allow closures
* Rename all() to matchAll()
* Rename some() to matchSome()
* Rename none() to matchNone()
* Updated the documentation for isEmpty() and isNonEmpty()
c.fahner added spent time 2026-08-18 18:13:02 +02:00
40 minutes
c.fahner stopped working 2026-08-18 18:20:01 +02:00
5 minutes 32 seconds
c.fahner deleted branch issues/2 2026-08-18 18:20:01 +02:00
c.fahner referenced this pull request from a commit 2026-08-18 18:20:02 +02:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Total time spent: 45 minutes 32 seconds
c.fahner
45 minutes 32 seconds
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
slendium/ocd!17
No description provided.