You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+17Lines changed: 17 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -114,6 +114,23 @@ match result {
114
114
115
115
*Note that according to the CloudEvents standard, event IDs must be of type string.*
116
116
117
+
#### Using the `IsEventQLTrue` precondition
118
+
119
+
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:
120
+
121
+
```rust
122
+
letresult=client.write_events(
123
+
vec![event.clone()],
124
+
vec![Precondition::IsEventQLTrue {
125
+
query:"FROM e IN events WHERE e.type == 'io.eventsourcingdb.library.book-borrowed' PROJECT INTO COUNT() < 10".to_string(),
126
+
}],
127
+
).await;
128
+
matchresult {
129
+
Ok(written_events) =>// ...
130
+
Err(err) =>// ...
131
+
}
132
+
```
133
+
117
134
### Reading Events
118
135
119
136
To read all events of a subject, call the `read_events` function with the subject and an options object. Set the `recursive` option to `false`. This ensures that only events of the given subject are returned, not events of nested subjects.
0 commit comments