graphql-engine/server/tests-py/queries/graphql_query/computed_fields
Samir Talwar eab4f75212 An ErrorMessage type, to encapsulate.
This introduces an `ErrorMessage` newtype which wraps `Text` in a manner which is designed to be easy to construct, and difficult to deconstruct.

It provides functionality similar to `Data.Text.Extended`, but designed _only_ for error messages. Error messages are constructed through `fromString`, concatenation, or the `toErrorValue` function, which is designed to be overridden for all meaningful domain types that might show up in an error message. Notably, there are not and should never be instances of `ToErrorValue` for `String`, `Text`, `Int`, etc. This is so that we correctly represent the value in a way that is specific to its type. For example, all `Name` values (from the _graphql-parser-hs_ library) are single-quoted now; no exceptions.

I have mostly had to add `instance ToErrorValue` for various backend types (and also add newtypes where necessary). Some of these are not strictly necessary for this changeset, as I had bigger aspirations when I started. These aspirations have been tempered by trying and failing twice.

As such, in this changeset, I have started by introducing this type to the `parseError` and `parseErrorWith` functions. In the future, I would like to extend this to the `QErr` record and the various `throwError` functions, but this is a much larger task and should probably be done in stages.

For now, `toErrorMessage` and `fromErrorMessage` are provided for conversion to and from `Text`, but the intent is to stop exporting these once all error messages are converted to the new type.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5018
GitOrigin-RevId: 84b37e238992e4312255a87ca44f41af65e2d89a
2022-07-18 20:27:06 +00:00
..
computed_fields_permission.yaml An ErrorMessage type, to encapsulate. 2022-07-18 20:27:06 +00:00
computed_fields.yaml support computed fields returning scalars or set of tables (close #1387) (#2917) 2019-10-18 13:59:47 +05:30
float_test.yaml include scalars types returning by computed fields in generated schema (fix #3650) (#3651) 2020-01-10 22:05:07 -06:00
locations.yaml computed fields in export/import metadata, other fixes (#3211) 2019-11-07 20:09:48 +05:30
scalar_computed_field_filter.yaml server/postgres: support computed fields in query filters ('where' expression) 2021-07-07 11:59:32 +00:00
setup.yaml server/postgres: add test case to test computed field with session argument in where expression 2021-09-30 11:27:37 +00:00
table_computed_field_filter_fail.yaml An ErrorMessage type, to encapsulate. 2022-07-18 20:27:06 +00:00
table_computed_field_filter_session_argument.yaml server/postgres: add test case to test computed field with session argument in where expression 2021-09-30 11:27:37 +00:00
table_computed_field_filter.yaml server/postgres: support computed fields in query filters ('where' expression) 2021-07-07 11:59:32 +00:00
teardown.yaml server/postgres: add test case to test computed field with session argument in where expression 2021-09-30 11:27:37 +00:00
tracked_function_as_comp_field.yaml server: support adding a tracked function as a computed field and vice versa 2021-05-20 06:29:24 +00:00