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

proposal: arbitraryTags #113

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

proposal: arbitraryTags #113

wants to merge 1 commit into from

Conversation

leo-lox
Copy link
Contributor

@leo-lox leo-lox commented Feb 15, 2025

No description provided.

Copy link

codecov bot commented Feb 15, 2025

Codecov Report

Attention: Patch coverage is 47.05882% with 9 lines in your changes missing coverage. Please review.

Project coverage is 72.36%. Comparing base (d925e77) to head (62b6906).

Files with missing lines Patch % Lines
packages/ndk/lib/domain_layer/entities/filter.dart 47.05% 9 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #113      +/-   ##
==========================================
- Coverage   72.49%   72.36%   -0.13%     
==========================================
  Files         106      106              
  Lines        3537     3554      +17     
==========================================
+ Hits         2564     2572       +8     
- Misses        973      982       +9     

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

Copy link

@v0l v0l left a comment

Choose a reason for hiding this comment

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

Can this be merged soon? I need this feature

// Handle arbitrary tags
arbitraryTags = {};
map.forEach((key, value) {
if (key.startsWith('#') &&
Copy link

Choose a reason for hiding this comment

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

Dont restrict which tags are allowed, only check that it startsWith # and length == 2

/// Map to store arbitrary/unsupported tags \
/// Key is the tag name, value is a list of tag values
/// Unsupported tags dont offer caching support
Map<String, List<String>>? arbitraryTags;
Copy link

Choose a reason for hiding this comment

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

I thinks tags is an ok name

// set an arbitrary tag
void setArbitraryTag(String tagName, List<String> values) {
arbitraryTags ??= {};
arbitraryTags![tagName.startsWith('#') ? tagName : '#$tagName'] = values;
Copy link

Choose a reason for hiding this comment

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

check tagName.length == 1

// get an arbitrary tag
List<String>? getArbitraryTag(String tagName) {
if (arbitraryTags == null) return null;
return arbitraryTags![tagName.startsWith('#') ? tagName : '#$tagName'];
Copy link

Choose a reason for hiding this comment

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

check tagName.length == 1

@v0l v0l mentioned this pull request Feb 24, 2025
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.

2 participants