diff --git a/README.md b/README.md index 2bef991..346d83c 100644 --- a/README.md +++ b/README.md @@ -95,17 +95,17 @@ $writtenEvents = $client->writeEvents([ *Note that according to the CloudEvents standard, event IDs must be of type string.* -#### Using the `isEventQlTrue` precondition +#### Using the `isEventQlQueryTrue` precondition -If you want to write events depending on an EventQL query, use the `IsEventQlTrue` function to create a precondition: +If you want to write events depending on an EventQL query, use the `IsEventQlQueryTrue` function to create a precondition: ```php -use Thenativeweb\Eventsourcingdb\IsEventQlTrue; +use Thenativeweb\Eventsourcingdb\IsEventQlQueryTrue; $writtenEvents = $client->writeEvents([ // events ], [ - new IsEventQlTrue("FROM e IN events WHERE e.type == 'io.eventsourcingdb.library.book-borrowed' PROJECT INTO COUNT() < 10") + new IsEventQlQueryTrue("FROM e IN events WHERE e.type == 'io.eventsourcingdb.library.book-borrowed' PROJECT INTO COUNT() < 10") ]); ``` diff --git a/src/IsEventQlTrue.php b/src/IsEventQlQueryTrue.php similarity index 75% rename from src/IsEventQlTrue.php rename to src/IsEventQlQueryTrue.php index 776584d..dc777ab 100644 --- a/src/IsEventQlTrue.php +++ b/src/IsEventQlQueryTrue.php @@ -6,7 +6,7 @@ use JsonSerializable; -final readonly class IsEventQlTrue implements JsonSerializable +final readonly class IsEventQlQueryTrue implements JsonSerializable { public function __construct( public string $query, @@ -16,7 +16,7 @@ public function __construct( public function jsonSerialize(): array { return [ - 'type' => 'isEventQlTrue', + 'type' => 'isEventQlQueryTrue', 'payload' => [ 'query' => $this->query, ], diff --git a/tests/WriteEventsTest.php b/tests/WriteEventsTest.php index 29820eb..0a4427f 100644 --- a/tests/WriteEventsTest.php +++ b/tests/WriteEventsTest.php @@ -5,7 +5,7 @@ use PHPUnit\Framework\TestCase; use Thenativeweb\Eventsourcingdb\CloudEvent; use Thenativeweb\Eventsourcingdb\EventCandidate; -use Thenativeweb\Eventsourcingdb\IsEventQlTrue; +use Thenativeweb\Eventsourcingdb\IsEventQlQueryTrue; use Thenativeweb\Eventsourcingdb\IsSubjectOnEventId; use Thenativeweb\Eventsourcingdb\IsSubjectPristine; use Thenativeweb\Eventsourcingdb\Tests\ClientTestTrait; @@ -139,7 +139,7 @@ public function testSupportsTheIsSubjectOnEventIdPrecondition(): void ); } - public function testSupportsTheIsEventQlTruePrecondition(): void + public function testSupportsTheIsEventQlQueryTruePrecondition(): void { $firstEvent = new EventCandidate( source: 'https://www.eventsourcingdb.io', @@ -169,7 +169,7 @@ public function testSupportsTheIsEventQlTruePrecondition(): void $secondEvent, ], [ - new IsEventQlTrue('FROM e IN events PROJECT INTO COUNT() == 0'), + new IsEventQlQueryTrue('FROM e IN events PROJECT INTO COUNT() == 0'), ], ); }