platform/angel_orm/lib/src/annotations.dart

32 lines
773 B
Dart
Raw Normal View History

2019-04-04 20:15:57 +00:00
/// A raw SQL statement that specifies a date/time default to the
/// current time.
2019-07-04 21:30:21 +00:00
const RawSql currentTimestamp = RawSql('CURRENT_TIMESTAMP');
2019-04-04 20:15:57 +00:00
/// Can passed to a [MigrationColumn] to default to a raw SQL expression.
class RawSql {
/// The raw SQL text.
final String value;
const RawSql(this.value);
}
/// Canonical instance of [ORM]. Implies all defaults.
2019-07-04 21:30:21 +00:00
const Orm orm = Orm();
2017-12-07 08:21:49 +00:00
2018-08-24 14:17:12 +00:00
class Orm {
2018-12-09 17:44:16 +00:00
/// The name of the table to query.
///
2018-12-09 17:44:16 +00:00
/// Inferred if not present.
2018-08-24 12:30:38 +00:00
final String tableName;
2018-12-09 17:44:16 +00:00
/// Whether to generate migrations for this model.
///
2018-12-09 17:44:16 +00:00
/// Defaults to [:true:].
final bool generateMigrations;
2018-08-24 12:30:38 +00:00
2019-04-02 23:19:01 +00:00
const Orm({this.tableName, this.generateMigrations = true});
2017-06-18 04:19:05 +00:00
}
2019-04-02 23:19:01 +00:00
/// The various types of join.
2018-12-01 18:23:50 +00:00
enum JoinType { inner, left, right, full, self }