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

Add tags functionality to Records. #706

Merged
merged 13 commits into from
Apr 8, 2024
Merged

Add tags functionality to Records. #706

merged 13 commits into from
Apr 8, 2024

Conversation

LiranCohen
Copy link
Member

@LiranCohen LiranCohen commented Mar 14, 2024

This is a first pass at adding the functionality for tags within records as mentioned here #642.

There will be subsequent PRs for any protocol specific enforcement.

{
    published : true,
    schema    : 'post',
    tags      : {
        someString : 'some-value',
        someStringArray : ['some-value1', 'some-value2'],
        someNumber : 54566975,
        someNumberArray : [ 1, 2, 3, 4, 5 ],
        someBoolean: true,
        someOtherBoolean: false
    }
}

Filtering

A filter for a tag is treated as an Equal filter. If any of the values within the tag array match the filter, the record matches.

Exact Match

{
  filter : {
    schema : 'post',
    tags   : {
      someString: 'some-value'
    }
  }
}

Range Filters

{
  filter : {
    schema : 'post',
    tags   : {
      someString: { gte: 'b', lt: 'c' }, // returns anything that starts with `b`
      someNumber: { gt: 0, lt: 10 }, // (exclusive) returns anything greater than 0 but less than 10 
      someStringArray: { gte: 'b', lt: 'c' }, // returns anything that starts with `b` within the array
      someNumberArray: { gt: 0, lt: 10 } // (exclusive) returns anything greater than 0 but less than 10 within the array 
    }
  }
}

Prefix Filters

{
  filter : {
    schema : 'post',
    tags   : {
      someString: { prefix: 'some' }, // returns anything that starts with the string prefix `some`
      someStringArray: { prefix: 'some' }, // returns anything that starts with the string prefix `some` within the array
    }
  }
}

@codecov-commenter
Copy link

codecov-commenter commented Mar 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.48%. Comparing base (1e9cd85) to head (0e92d59).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #706      +/-   ##
==========================================
+ Coverage   98.46%   98.48%   +0.01%     
==========================================
  Files          74       74              
  Lines       10195    10329     +134     
  Branches     1511     1533      +22     
==========================================
+ Hits        10039    10173     +134     
  Misses        150      150              
  Partials        6        6              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@LiranCohen LiranCohen changed the title [WIP] Add tags functionality to Records. Add tags functionality to Records. Mar 14, 2024
@LiranCohen LiranCohen marked this pull request as ready for review March 14, 2024 17:43
Copy link
Contributor

@thehenrytsai thehenrytsai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐐 🐐 🐐 ! Thanks for adding this powerful feature. This alone will take dev-ex to the next level!!

@LiranCohen LiranCohen requested a review from thehenrytsai March 18, 2024 21:02
thehenrytsai
thehenrytsai previously approved these changes Mar 20, 2024
Copy link
Contributor

@thehenrytsai thehenrytsai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐐 🐐 🐐 🚀 🚀 🚀

@LiranCohen LiranCohen force-pushed the lirancohen/tags-write branch from 83a34e6 to ff3aed2 Compare March 22, 2024 18:29
Copy link
Contributor

@thehenrytsai thehenrytsai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 once more!

@LiranCohen LiranCohen merged commit 22560ec into main Apr 8, 2024
4 checks passed
@LiranCohen LiranCohen deleted the lirancohen/tags-write branch April 8, 2024 21:02
thehenrytsai added a commit that referenced this pull request Apr 10, 2024
* main:
  Bump to `v0.2.23` (#719)
  Add `tags` functionality to `Records`. (#706)
  Signing and verifying with Secp256r1 keys (#715)
  Upgrade foundational `@web5/dids` to `1.0.0` (#718)
LiranCohen added a commit to decentralized-identity/dwn-sql-store that referenced this pull request Apr 24, 2024
Implement indexing for the work in:
decentralized-identity/dwn-sdk-js#706

- Adds reference tables:
  - messageStoreRecordsTags
  - eventLogRecordsTags
- Adds helper methods to deal with adding foreign key constraints to all
3 dialects.
- Adds helper methods to deal with returning `insertedId` across all 3
dialects.

---------

Co-authored-by: Henry Tsai <henrytsai@outlook.com>
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.

3 participants