Skip to content

Simplify syntax for selecting fields with raw query #26

@IlyaSemenov

Description

@IlyaSemenov

Currently, selecting a custom field with raw sql looks like this:

r.table(
      db.post,
      {
        fields: {
          preview: (q) =>
            q.select({ preview: q.sql<string>`substr(text,1,100)` }),

This is too wordy, and, it breaks when a field is requested with an alias:

posts {
  my_preview: preview  # will not work
}

The syntax should rather be:

r.table(
      db.post,
      {
        fields: {
          preview: (q) => q.sql<string>`substr(text,1,100)`

with orchid-graphql wrapping the field select.

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