Skip to content

Validate queries #7

@chouzar

Description

@chouzar

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))
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions