From c490c9c70872981171669af3339a5dc1253242fd Mon Sep 17 00:00:00 2001 From: Golo Roden Date: Fri, 1 Aug 2025 23:01:01 +0200 Subject: [PATCH] fix: Rename precondition. --- README.md | 8 ++++---- src/client/precondition.rs | 4 ++-- tests/write_events.rs | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index e6bd59a..d444c76 100644 --- a/README.md +++ b/README.md @@ -114,14 +114,14 @@ match result { *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` precondition to create a precondition and pass it in a vector as the second argument: +If you want to write events depending on an EventQL query, use the `IsEventQLQueryTrue` precondition to create a precondition and pass it in a vector as the second argument: ```rust let result = client.write_events( vec![event.clone()], - vec![Precondition::IsEventQLTrue { + vec![Precondition::IsEventQLQueryTrue { query: "FROM e IN events WHERE e.type == 'io.eventsourcingdb.library.book-borrowed' PROJECT INTO COUNT() < 10".to_string(), }], ).await; @@ -449,4 +449,4 @@ In case you need to set up the client yourself, use the following functions to g - `get_host()` returns the host name - `get_mapped_port()` returns the port - `get_base_url()` returns the full URL of the container -- `get_api_token()` returns the API token \ No newline at end of file +- `get_api_token()` returns the API token diff --git a/src/client/precondition.rs b/src/client/precondition.rs index f2328b6..d190b5a 100644 --- a/src/client/precondition.rs +++ b/src/client/precondition.rs @@ -20,8 +20,8 @@ pub enum Precondition { event_id: String, }, /// Check if an EventQL query returns true - #[serde(rename = "isEventQlTrue")] - IsEventQLTrue { + #[serde(rename = "isEventQlQueryTrue")] + IsEventQLQueryTrue { /// The EventQL query to check query: String, }, diff --git a/tests/write_events.rs b/tests/write_events.rs index 9b386ec..9710d18 100644 --- a/tests/write_events.rs +++ b/tests/write_events.rs @@ -224,7 +224,7 @@ async fn write_events_with_is_eventql_true_condition() { let result = client .write_events( event_candidates.clone(), - vec![Precondition::IsEventQLTrue { + vec![Precondition::IsEventQLQueryTrue { query: "FROM e IN events PROJECT INTO COUNT() == 0".to_string(), }], )