surrealdb / surrealdb.rs

SurrealDB driver for Rust
https://surrealdb.com
Apache License 2.0
64 stars 7 forks source link

Feature: Duplicate index should set specific kind instead of generic Query ErrorKind #16

Closed prabirshrestha closed 1 year ago

prabirshrestha commented 1 year ago

Is your feature request related to a problem?

I have an index that avoid's duplicate username. I would like it to throw specific request so I can handle it.

(Error { kind: Query, message: "failed to perform query; Database index `username_idx` already contains 'admin', with record `user:ce7psl4jqouice6j35ug`" })

Describe the solution

Set kind as DuplicateIndex(username_idx) or some other error code.

Alternative methods

Need to use string contains.

SurrealDB version

Release v1.0.0-beta.8

Contact Details

No response

Is there an existing issue for this?

Code of Conduct

rushmorem commented 1 year ago

Thank you for this feature request. This is something I would like to have as well.

tobiemh commented 1 year ago

Now that the Rust client library is being merged with the surrealdb crate itself, I am going to close this issue!