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

feat: add filters for list types #319

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

Sekhmet
Copy link
Contributor

@Sekhmet Sekhmet commented Nov 5, 2024

Summary

This commit adds support for filters for list of scalar types:

  • list
  • list_not
  • list_contains
  • list_not_contains

Those filters are implemented using in PostgreSQL and only available on JSONB so we changed column type for those fields.

This will allow us to implement https://github.com/snapshot-labs/workflow/issues/254 again.

Test plan:

Run sx-api on Sepolia with default start index for a bit to get some data (1 minute should be enough), run following queries:

{
  spaces(
    where: {
      authenticators: [
        "0x2b63a8a92b7c67484ab99c4307c7db41b15b9a3c33359cd2b2459fd7f543a9c"
      ]
    }
  ) {
    id
    authenticators
  }
}
{
  spaces(
    where: {
      authenticators_not: [
        "0x2b63a8a92b7c67484ab99c4307c7db41b15b9a3c33359cd2b2459fd7f543a9c"
      ]
    }
  ) {
    id
    authenticators
  }
}
{
  spaces(
    where: {
      authenticators_contains: [
        "0x53d98050a9738da0eac7498d909ea03f6eb03d07fb95877b54ff8acf7712276",
        "0x2b63a8a92b7c67484ab99c4307c7db41b15b9a3c33359cd2b2459fd7f543a9c"
      ]
    }
  ) {
    id
    authenticators
  }
}
{
  spaces(
    where: {
      authenticators_not_contains: [
        "0x2b63a8a92b7c67484ab99c4307c7db41b15b9a3c33359cd2b2459fd7f543a9c"
      ]
    }
  ) {
    id
    authenticators
  }
}

They work as you expect them.

This commit adds support for filters for list of scalar types:
- list
- list_not
- list_contains
- list_not_contains

Those filters are implemented using in PostgreSQL and only available on JSONB
so we changed column type for those fields.
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

Successfully merging this pull request may close these issues.

1 participant