Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
- `get_api_token()` returns the API token
4 changes: 2 additions & 2 deletions src/client/precondition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand Down
2 changes: 1 addition & 1 deletion tests/write_events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
}],
)
Expand Down