Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate queries #7

Open
chouzar opened this issue Nov 27, 2024 · 0 comments
Open

Validate queries #7

chouzar opened this issue Nov 27, 2024 · 0 comments

Comments

@chouzar
Copy link
Owner

chouzar commented Nov 27, 2024

Validate queries at runtime as to always have a way to determine why a query might not be working. Either require a result or fail gracefully with a warning log at runtime.

fn against(
  query: Query(index, record, binding),
  row: row,
) -> Result(shape, List(String)) {
  case ffi_test_query(query, row) {
    NoMatch -> Error(["no match"])
    Spec(shape) -> Ok(shape)
    Invalid(errors) -> Error(list.map(errors, charlist.to_string))
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant