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

_QueryStringVectorProperty.notContains #260

Closed
frogman1189 opened this issue Jun 2, 2021 · 3 comments
Closed

_QueryStringVectorProperty.notContains #260

frogman1189 opened this issue Jun 2, 2021 · 3 comments
Labels
duplicate This issue or pull request already exists enhancement New feature or request

Comments

@frogman1189
Copy link

I have an object that looks like

@Entity()
class Post {
  int id;
  List<String>? readByIds
  // other properties

  queryObject({this.id = 0, this.readByIds});
}

And I would like to be able to retrieve Posts I have not read. It would be useful if the generated metadata had the .notContains function for this kind of situation. i.e box.query(Post_.notContains(userId))

In my situation I know all the ids of who could read it, and so have added an extra property that is the inverse readByIds:

@Entity()
class Post {
  int id;
  List<String>? readByIds;
  List<String>? notReadByIds;
  // other properties

  queryObject({this.id = 0, this.readByIds, this.notReadByIds});
}

but the duplication makes this undesirable

@frogman1189 frogman1189 added the enhancement New feature or request label Jun 2, 2021
@vaind
Copy link
Contributor

vaind commented Jun 23, 2021

Would need to be implemented in the core. I'm raising a feature request there.

@vaind
Copy link
Contributor

vaind commented Jun 23, 2021

BTW, this looks like a good candidate for a separate "table" with the list of which items have been read by which user (assuming that's what you mean by readByIds), e.g.

@Entity()
class Post {
  int id;
  ...
}

@Entity()
class PostReads {
  int id;
  final post = ToOne<Post>();
  final user = ToOne<User>();
}

@vaind vaind added the on-hold Blocked by some other issue or a lack of information/ideas how to proceed. label Jul 28, 2021
@greenrobot-team
Copy link
Member

As this is kind of asking for the notOneOf condition and to track interest in one place, closing this as a duplicate of #591.

@greenrobot-team greenrobot-team added duplicate This issue or pull request already exists and removed on-hold Blocked by some other issue or a lack of information/ideas how to proceed. labels Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants