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

Get Collection by wildcards #2552

Open
stuartc opened this issue Oct 7, 2024 · 0 comments
Open

Get Collection by wildcards #2552

stuartc opened this issue Oct 7, 2024 · 0 comments

Comments

@stuartc
Copy link
Member

stuartc commented Oct 7, 2024

Re: #2190

Add a function that retrieves a list of items from a collection based on a key with wildcards.

Given this rough example:

{op: "get", collection: "collection-name", key: "foo:*:bar*"}

The resulting query might look something like this:

SELECT * FROM collection_items 
  -- join collections by name
  WHERE key LIKE "foo:%:bar%"

Note that a simple BTREE index will help up until the first wildcard appears, using a GIN index with the pg_trgm extension will allow for indexing to work with more than one wildcard:

CREATE INDEX idx_my_keys_trgm ON my_keys USING GIN (key_name gin_trgm_ops);

Acceptance criteria

  • A new function in the Collections context that returns a stream of items with keys matching the query.
  • Must be injection proof, i.e. use the like macros from Ecto.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Ready
Development

No branches or pull requests

1 participant