diff --git a/README.md b/README.md index e8f00f7a..abab1df6 100644 --- a/README.md +++ b/README.md @@ -110,16 +110,18 @@ class CarController extends Controller { @Expose('/recalled_since_2008') carsRecalledSince2008(QueryExecutor executor) { // Instantiate a Car query, which is auto-generated. This class helps us build fluent queries easily. - var cars = new CarQuery(); - cars.where + var query = new CarQuery(); + query.where ..familyFriendly.equals(false) ..recalledAt.year.greaterThanOrEqualTo(2008); // Shorter syntax we could use instead... - cars.where.recalledAt.year <= 2008; + query.where.recalledAt.year <= 2008; // `get()` returns a Future>. - return await cars.get(executor); + var cars = await query.get(executor); + + return cars; } @Expose('/create', method: 'POST') @@ -154,15 +156,15 @@ with custom parameters (ex. `@HasOne(foreignKey: 'foreign_id')`). @orm abstract class _Author extends Model { @hasMany // Use the defaults, and auto-compute `foreignKey` - List books; + List<_Book> books; // Also supports parameters... @HasMany(localKey: 'id', foreignKey: 'author_id', cascadeOnDelete: true) - List books; + List<_Book> books; @SerializableField(alias: 'writing_utensil') @hasOne - Pen pen; + _Pen pen; } ```