1010 <a href =" https://app.codecov.io/gh/schultek/stormberry " >
1111 <img src="https://img.shields.io/codecov/c/github/schultek/stormberry?logo=codecov&logoColor=fff&labelColor=333940">
1212 </a >
13- <!-- <a href="https://twitter.com/schultek_dev">
14- <img src="https://img.shields.io/twitter/follow/schultek_dev?style=flat&label=Follow&color=1DA1F2&labelColor=333940&logo=twitter&logoColor=fff">
15- </a>-->
13+ <br />
14+ <a href =" https://twitter.com/schultek_dev " >
15+ <img src="https://img.shields.io/badge/follow-%40schultek__dev-1DA1F2?style=flat&label=follow&color=1DA1F2&labelColor=333940&logo=twitter&logoColor=fff">
16+ </a >
17+ <a href =" https://github.com/schultek/stormberry " >
18+ <img src="https://img.shields.io/github/stars/schultek/stormberry?style=flat&label=stars&labelColor=333940&color=8957e5&logo=github">
19+ </a >
1620</p >
1721
1822<p align =" center " >
19- A strongly-typed postgres ORM to provide easy bindings between your dart classes and postgres database.
20- It supports all kinds of relations without any complex configuration.
23+ A < b > strongly-typed postgres ORM</ b > to provide easy bindings between your dart classes and postgres database.
24+ It supports all kinds of < b > relations without any complex configuration</ b > .
2125</p >
2226
27+ ---
28+
2329# Outline
2430
2531- [ Get Started] ( #get-started )
@@ -38,17 +44,6 @@ It supports all kinds of relations without any complex configuration.
3844> This package is still in active development. If you have any feedback or feature requests,
3945> write me and issue on github.
4046
41- ## Roadmap
42-
43- - Documentation
44- - Improve Readme
45- - Improve example
46- - Testing & Maintenance
47- - Improve code structure
48- - Write tests
49- - Long Term
50- - Be database agnostic (sub-packages)
51-
5247# Get Started
5348
5449To get started, add ` stormberry ` as a dependency and ` build_runner ` as a dev dependency:
@@ -173,7 +168,36 @@ Generally, the correct relation type is determined by whether you use `List<...>
173168Depending on the relation type, it is also mandatory to specify a primary key field.
174169
175170Notice how when you specify both sides of a relation, querying one of the models would lead to a
176- cyclic dependency. You can solve this by using ` Views ` .
171+ cyclic dependency. You can solve this by using [ Views] ( #views ) .
172+
173+ #### Bindings
174+
175+ When you have multiple relations between the same types, it may be ambiguous fields refer to each other.
176+ In those cases, you can use the ` @BindTo(#otherField) ` annotation like this:
177+
178+ ``` dart
179+ @Model()
180+ abstract class User {
181+ @PrimaryKey()
182+ String get id;
183+
184+ @BindTo(#author)
185+ List<Post> get posts;
186+ @BindTo(#likes)
187+ List<Post> get liked;
188+ }
189+
190+ @Model()
191+ abstract class Post {
192+ @PrimaryKey()
193+ String get id;
194+
195+ @BindTo(#posts)
196+ User get author;
197+ @BindTo(#liked)
198+ List<User> get likes;
199+ }
200+ ```
177201
178202## Views
179203
0 commit comments