From ff3e3b535b400e2f4956615dc9ee86100f255ebe Mon Sep 17 00:00:00 2001 From: thosakwe Date: Fri, 15 Sep 2017 16:05:03 -0400 Subject: [PATCH] Car example --- .../test/example/car_controller.dart | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 angel_orm_generator/test/example/car_controller.dart diff --git a/angel_orm_generator/test/example/car_controller.dart b/angel_orm_generator/test/example/car_controller.dart new file mode 100644 index 00000000..0919e30a --- /dev/null +++ b/angel_orm_generator/test/example/car_controller.dart @@ -0,0 +1,18 @@ +import 'dart:async'; +import 'package:angel_framework/angel_framework.dart'; +import 'package:postgres/postgres.dart'; +import '../models/car.dart'; +import '../models/car.orm.g.dart'; + +@Expose('/api/cars') +class CarController extends Controller { + @Expose('/luxury') + Stream getLuxuryCars(PostgreSQLConnection connection) { + var query = new CarQuery(); + query.where + ..familyFriendly.equals(false) + ..createdAt.year.greaterThanOrEqualTo(2014) + ..make.isIn(['Ferrari', 'Lamborghini', 'Mustang', 'Lexus']); + return query.get(connection); + } +}