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

Prototype 'meta' column alternative to message table #6

Open
jamesaoverton opened this issue Nov 15, 2021 · 0 comments
Open

Prototype 'meta' column alternative to message table #6

jamesaoverton opened this issue Nov 15, 2021 · 0 comments

Comments

@jamesaoverton
Copy link
Member

All the VALVE implementations so far output to a message table, which identifies the table/row/column then specifies the message information. This is a flexible approach, but this requires the original table to have a primary key or row ID, and it can be difficult/annoying/expensive to combine the value and message when trying to render a table of highlighted cells.

I'd like to try another approach that keeps the message data in the table. Given a column such as 'weight' with datatype INT, we will have a second column 'weight_meta' with type TEXT. The 'weight_meta' column will store JSON that includes the message (when appropriate). For the first version, I would be happy with this:

weight weight_meta
100 NULL
NULL {"value":"99g","message":"Must be an integer"}

Eventually I would like to support multiple messages with more information, something like this:

{
  "value": "99g",
  "messages": [{
      "rule": "datatype:integer",
      "level": "error",
      "message": "Must be a positive integer"
  }]
}

What should the SQL for an in() condition look like for this approach?

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