Skip to content

v0.12.0

Latest
Compare
Choose a tag to compare
@schultek schultek released this 27 Feb 10:19
· 50 commits to main since this release
  • Support self-joins. Models can now have relations to itself.
  • Added value property to QueryParams to supply custom query parameters.
  • Added @BindTo() annotation to resolve ambiguous field relations.

When you have multiple relations between the same types, it may be ambiguous fields refer to each other.
In those cases, you can use the @BindTo(#otherField) annotation like this:

@Model()
abstract class User {
  @PrimaryKey()
  String get id;

  @BindTo(#author)
  List<Post> get posts;
  @BindTo(#likes)
  List<Post> get liked;
}

@Model()
abstract class Post {
  @PrimaryKey()
  String get id;

  @BindTo(#posts)
  User get author;
  @BindTo(#liked)
  List<User> get likes;
}