2.0.0-dev.2
This commit is contained in:
parent
047dc76408
commit
b62f26a0af
20 changed files with 472 additions and 319 deletions
|
@ -451,7 +451,11 @@ class Union<T> extends QueryBase<T> {
|
||||||
final QueryBase<T> left, right;
|
final QueryBase<T> left, right;
|
||||||
final bool all;
|
final bool all;
|
||||||
|
|
||||||
Union(this.left, this.right, {this.all: false});
|
Union(this.left, this.right, {this.all: false}) {
|
||||||
|
substitutionValues
|
||||||
|
..addAll(left.substitutionValues)
|
||||||
|
..addAll(right.substitutionValues);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
List<String> get fields => left.fields;
|
List<String> get fields => left.fields;
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
# 2.0.0-dev.2
|
||||||
|
* Changes to work with `package:angel_orm@2.0.0-dev.15`.
|
||||||
|
|
||||||
# 2.0.0-dev.1
|
# 2.0.0-dev.1
|
||||||
* Generate migration files.
|
* Generate migration files.
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'package:analyzer/dart/element/element.dart';
|
import 'package:analyzer/dart/element/element.dart';
|
||||||
import 'package:angel_orm/angel_orm.dart';
|
import 'package:angel_orm/angel_orm.dart';
|
||||||
|
import 'package:angel_serialize_generator/angel_serialize_generator.dart';
|
||||||
import 'package:build/build.dart';
|
import 'package:build/build.dart';
|
||||||
import 'package:code_builder/code_builder.dart';
|
import 'package:code_builder/code_builder.dart';
|
||||||
import 'package:dart_style/dart_style.dart';
|
import 'package:dart_style/dart_style.dart';
|
||||||
|
@ -168,9 +169,14 @@ class MigrationGenerator extends GeneratorForAnnotation<Orm> {
|
||||||
var field = table.property(methodName).call(positional, named);
|
var field = table.property(methodName).call(positional, named);
|
||||||
var cascade = <Expression>[];
|
var cascade = <Expression>[];
|
||||||
|
|
||||||
if (col.defaultValue != null) {
|
var defaultValue = ctx.buildContext.defaults[name];
|
||||||
cascade
|
|
||||||
.add(refer('defaultsTo').call([literal(col.defaultValue)]));
|
if (defaultValue != null) {
|
||||||
|
cascade.add(refer('defaultsTo').call([
|
||||||
|
new CodeExpression(
|
||||||
|
new Code(dartObjectToString(defaultValue)),
|
||||||
|
),
|
||||||
|
]));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (col.indexType == IndexType.primaryKey ||
|
if (col.indexType == IndexType.primaryKey ||
|
||||||
|
|
|
@ -86,7 +86,6 @@ Future<OrmBuildContext> buildOrmContext(
|
||||||
isNullable: column.isNullable,
|
isNullable: column.isNullable,
|
||||||
length: column.length,
|
length: column.length,
|
||||||
indexType: column.indexType,
|
indexType: column.indexType,
|
||||||
defaultValue: column.defaultValue,
|
|
||||||
type: inferColumnType(field.type),
|
type: inferColumnType(field.type),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -233,7 +232,6 @@ Column reviveColumn(ConstantReader cr) {
|
||||||
return new Column(
|
return new Column(
|
||||||
isNullable: cr.peek('isNullable')?.boolValue,
|
isNullable: cr.peek('isNullable')?.boolValue,
|
||||||
length: cr.peek('length')?.intValue,
|
length: cr.peek('length')?.intValue,
|
||||||
defaultValue: cr.peek('defaultValue')?.literalValue,
|
|
||||||
type: columnType,
|
type: columnType,
|
||||||
indexType: indexType,
|
indexType: indexType,
|
||||||
);
|
);
|
||||||
|
|
|
@ -105,23 +105,30 @@ class OrmGenerator extends GeneratorForAnnotation<Orm> {
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// Add where member
|
// Add _where member
|
||||||
clazz.fields.add(new Field((b) {
|
clazz.fields.add(new Field((b) {
|
||||||
b
|
b
|
||||||
..annotations.add(refer('override'))
|
..name = '_where'
|
||||||
..name = 'where'
|
..type = queryWhereType;
|
||||||
..modifier = FieldModifier.final$
|
|
||||||
..type = queryWhereType
|
|
||||||
..assignment = queryWhereType.newInstance([]).code;
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
// Add where getter
|
||||||
|
clazz.methods.add(new Method((b) {
|
||||||
|
b
|
||||||
|
..name = 'where'
|
||||||
|
..type = MethodType.getter
|
||||||
|
..returns = queryWhereType
|
||||||
|
..annotations.add(refer('override'))
|
||||||
|
..body = new Block((b) => b.addExpression(refer('_where').returned));
|
||||||
|
}));
|
||||||
|
// newWhereClause()
|
||||||
clazz.methods.add(new Method((b) {
|
clazz.methods.add(new Method((b) {
|
||||||
b
|
b
|
||||||
..name = 'newWhereClause'
|
..name = 'newWhereClause'
|
||||||
..annotations.add(refer('override'))
|
..annotations.add(refer('override'))
|
||||||
..returns = queryWhereType
|
..returns = queryWhereType
|
||||||
..body = new Block(
|
..body = new Block((b) => b.addExpression(
|
||||||
(b) => b.addExpression(queryWhereType.newInstance([]).returned));
|
queryWhereType.newInstance([refer('this')]).returned));
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// Add deserialize()
|
// Add deserialize()
|
||||||
|
@ -197,10 +204,15 @@ class OrmGenerator extends GeneratorForAnnotation<Orm> {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// If there are any relations, we need some overrides.
|
// If there are any relations, we need some overrides.
|
||||||
if (ctx.relations.isNotEmpty) {
|
|
||||||
clazz.constructors.add(new Constructor((b) {
|
clazz.constructors.add(new Constructor((b) {
|
||||||
b
|
b
|
||||||
..body = new Block((b) {
|
..body = new Block((b) {
|
||||||
|
// Add a constructor that initializes _where
|
||||||
|
b.addExpression(
|
||||||
|
refer('_where')
|
||||||
|
.assign(queryWhereType.newInstance([refer('this')])),
|
||||||
|
);
|
||||||
|
|
||||||
ctx.relations.forEach((fieldName, relation) {
|
ctx.relations.forEach((fieldName, relation) {
|
||||||
//var name = ctx.buildContext.resolveFieldName(fieldName);
|
//var name = ctx.buildContext.resolveFieldName(fieldName);
|
||||||
if (relation.type == RelationshipType.belongsTo ||
|
if (relation.type == RelationshipType.belongsTo ||
|
||||||
|
@ -228,8 +240,7 @@ class OrmGenerator extends GeneratorForAnnotation<Orm> {
|
||||||
b
|
b
|
||||||
..name = 'insert'
|
..name = 'insert'
|
||||||
..annotations.add(refer('override'))
|
..annotations.add(refer('override'))
|
||||||
..requiredParameters
|
..requiredParameters.add(new Parameter((b) => b..name = 'executor'))
|
||||||
.add(new Parameter((b) => b..name = 'executor'))
|
|
||||||
..body = new Block((b) {
|
..body = new Block((b) {
|
||||||
var inTransaction = new Method((b) {
|
var inTransaction = new Method((b) {
|
||||||
b
|
b
|
||||||
|
@ -263,8 +274,8 @@ class OrmGenerator extends GeneratorForAnnotation<Orm> {
|
||||||
ctx.relations.forEach((name, relation) {
|
ctx.relations.forEach((name, relation) {
|
||||||
if (relation.type == RelationshipType.hasMany) {
|
if (relation.type == RelationshipType.hasMany) {
|
||||||
// Call fetchLinked();
|
// Call fetchLinked();
|
||||||
var fetchLinked = refer('fetchLinked').call(
|
var fetchLinked = refer('fetchLinked')
|
||||||
[refer('result'), refer('executor')]).awaited;
|
.call([refer('result'), refer('executor')]).awaited;
|
||||||
b.addExpression(refer('result').assign(fetchLinked));
|
b.addExpression(refer('result').assign(fetchLinked));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -279,7 +290,6 @@ class OrmGenerator extends GeneratorForAnnotation<Orm> {
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Create a Future<T> fetchLinked(T model, QueryExecutor), if necessary.
|
// Create a Future<T> fetchLinked(T model, QueryExecutor), if necessary.
|
||||||
if (ctx.relations.values.any((r) => r.type == RelationshipType.hasMany)) {
|
if (ctx.relations.values.any((r) => r.type == RelationshipType.hasMany)) {
|
||||||
|
@ -412,6 +422,8 @@ class OrmGenerator extends GeneratorForAnnotation<Orm> {
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
var initializers = <Code>[];
|
||||||
|
|
||||||
// Add builders for each field
|
// Add builders for each field
|
||||||
for (var field in ctx.effectiveFields) {
|
for (var field in ctx.effectiveFields) {
|
||||||
var name = field.name;
|
var name = field.name;
|
||||||
|
@ -451,12 +463,27 @@ class OrmGenerator extends GeneratorForAnnotation<Orm> {
|
||||||
b
|
b
|
||||||
..name = name
|
..name = name
|
||||||
..modifier = FieldModifier.final$
|
..modifier = FieldModifier.final$
|
||||||
..type = builderType
|
..type = builderType;
|
||||||
..assignment = builderType.newInstance([
|
|
||||||
|
initializers.add(
|
||||||
|
refer(field.name)
|
||||||
|
.assign(builderType.newInstance([
|
||||||
|
refer('query'),
|
||||||
literalString(ctx.buildContext.resolveFieldName(field.name))
|
literalString(ctx.buildContext.resolveFieldName(field.name))
|
||||||
]).code;
|
]))
|
||||||
|
.code,
|
||||||
|
);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Now, just add a constructor that initializes each builder.
|
||||||
|
clazz.constructors.add(new Constructor((b) {
|
||||||
|
b
|
||||||
|
..requiredParameters.add(new Parameter((b) => b
|
||||||
|
..name = 'query'
|
||||||
|
..type = refer('${rc.pascalCase}Query')))
|
||||||
|
..initializers.addAll(initializers);
|
||||||
|
}));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -487,7 +514,6 @@ class OrmGenerator extends GeneratorForAnnotation<Orm> {
|
||||||
b
|
b
|
||||||
..name = field.name
|
..name = field.name
|
||||||
..type = MethodType.setter
|
..type = MethodType.setter
|
||||||
..returns = refer('void')
|
|
||||||
..requiredParameters.add(new Parameter((b) => b
|
..requiredParameters.add(new Parameter((b) => b
|
||||||
..name = 'value'
|
..name = 'value'
|
||||||
..type = type))
|
..type = type))
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
name: angel_orm_generator
|
name: angel_orm_generator
|
||||||
version: 2.0.0-dev.1
|
version: 2.0.0-dev.2
|
||||||
description: Code generators for Angel's ORM. Generates query builder classes.
|
description: Code generators for Angel's ORM. Generates query builder classes.
|
||||||
author: Tobe O <thosakwe@gmail.com>
|
author: Tobe O <thosakwe@gmail.com>
|
||||||
homepage: https://github.com/angel-dart/orm
|
homepage: https://github.com/angel-dart/orm
|
||||||
|
@ -34,3 +34,6 @@ dev_dependencies:
|
||||||
collection: ^1.0.0
|
collection: ^1.0.0
|
||||||
postgres: ^1.0.0
|
postgres: ^1.0.0
|
||||||
test: ^1.0.0
|
test: ^1.0.0
|
||||||
|
# dependency_overrides:
|
||||||
|
# angel_orm:
|
||||||
|
# path: ../angel_orm
|
||||||
|
|
|
@ -88,7 +88,7 @@ main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('union', () async {
|
test('union', () async {
|
||||||
var query1 = new BookQuery()..where.name.like('Deathly%');
|
var query1 = new BookQuery()..where.name.like((_) => 'Deathly%');
|
||||||
var query2 = new BookQuery()..where.authorId.equals(-1);
|
var query2 = new BookQuery()..where.authorId.equals(-1);
|
||||||
var query3 = new BookQuery()
|
var query3 = new BookQuery()
|
||||||
..where.name.isIn(['Goblet of Fire', 'Order of the Phoenix']);
|
..where.name.isIn(['Goblet of Fire', 'Order of the Phoenix']);
|
||||||
|
|
|
@ -23,15 +23,20 @@ class PostgresExecutor extends QueryExecutor {
|
||||||
Future close() => (connection as PostgreSQLConnection).close();
|
Future close() => (connection as PostgreSQLConnection).close();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<List<List>> query(String query, [List<String> returningFields]) {
|
Future<List<List>> query(
|
||||||
|
String query, Map<String, dynamic> substitutionValues,
|
||||||
|
[List<String> returningFields]) {
|
||||||
if (returningFields != null) {
|
if (returningFields != null) {
|
||||||
var fields = returningFields.join(', ');
|
var fields = returningFields.join(', ');
|
||||||
var returning = 'RETURNING $fields';
|
var returning = 'RETURNING $fields';
|
||||||
query = '$query $returning';
|
query = '$query $returning';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Platform.environment.containsKey('STFU')) print('Running: $query');
|
if (!Platform.environment.containsKey('STFU')) {
|
||||||
return connection.query(query);
|
print('Running: $query');
|
||||||
|
if (substitutionValues.isNotEmpty) print('Values: $substitutionValues');
|
||||||
|
}
|
||||||
|
return connection.query(query, substitutionValues: substitutionValues);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
@ -9,6 +9,7 @@ part 'author.g.dart';
|
||||||
@serializable
|
@serializable
|
||||||
@orm
|
@orm
|
||||||
abstract class _Author extends Model {
|
abstract class _Author extends Model {
|
||||||
@Column(length: 255, indexType: IndexType.unique, defaultValue: 'Tobe Osakwe')
|
@Column(length: 255, indexType: IndexType.unique)
|
||||||
|
@DefaultValue('Tobe Osakwe')
|
||||||
String get name;
|
String get name;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ class AuthorMigration extends Migration {
|
||||||
up(Schema schema) {
|
up(Schema schema) {
|
||||||
schema.create('authors', (table) {
|
schema.create('authors', (table) {
|
||||||
table.serial('id')..primaryKey();
|
table.serial('id')..primaryKey();
|
||||||
table.varChar('name');
|
table.varChar('name')..defaultsTo('Tobe Osakwe');
|
||||||
table.timeStamp('created_at');
|
table.timeStamp('created_at');
|
||||||
table.timeStamp('updated_at');
|
table.timeStamp('updated_at');
|
||||||
});
|
});
|
||||||
|
@ -28,11 +28,14 @@ class AuthorMigration extends Migration {
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
class AuthorQuery extends Query<Author, AuthorQueryWhere> {
|
class AuthorQuery extends Query<Author, AuthorQueryWhere> {
|
||||||
|
AuthorQuery() {
|
||||||
|
_where = new AuthorQueryWhere(this);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final AuthorQueryValues values = new AuthorQueryValues();
|
final AuthorQueryValues values = new AuthorQueryValues();
|
||||||
|
|
||||||
@override
|
AuthorQueryWhere _where;
|
||||||
final AuthorQueryWhere where = new AuthorQueryWhere();
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
get tableName {
|
get tableName {
|
||||||
|
@ -44,9 +47,14 @@ class AuthorQuery extends Query<Author, AuthorQueryWhere> {
|
||||||
return const ['id', 'name', 'created_at', 'updated_at'];
|
return const ['id', 'name', 'created_at', 'updated_at'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
AuthorQueryWhere get where {
|
||||||
|
return _where;
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
AuthorQueryWhere newWhereClause() {
|
AuthorQueryWhere newWhereClause() {
|
||||||
return new AuthorQueryWhere();
|
return new AuthorQueryWhere(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Author parseRow(List row) {
|
static Author parseRow(List row) {
|
||||||
|
@ -66,17 +74,19 @@ class AuthorQuery extends Query<Author, AuthorQueryWhere> {
|
||||||
}
|
}
|
||||||
|
|
||||||
class AuthorQueryWhere extends QueryWhere {
|
class AuthorQueryWhere extends QueryWhere {
|
||||||
final NumericSqlExpressionBuilder<int> id =
|
AuthorQueryWhere(AuthorQuery query)
|
||||||
new NumericSqlExpressionBuilder<int>('id');
|
: id = new NumericSqlExpressionBuilder<int>(query, 'id'),
|
||||||
|
name = new StringSqlExpressionBuilder(query, 'name'),
|
||||||
|
createdAt = new DateTimeSqlExpressionBuilder(query, 'created_at'),
|
||||||
|
updatedAt = new DateTimeSqlExpressionBuilder(query, 'updated_at');
|
||||||
|
|
||||||
final StringSqlExpressionBuilder name =
|
final NumericSqlExpressionBuilder<int> id;
|
||||||
new StringSqlExpressionBuilder('name');
|
|
||||||
|
|
||||||
final DateTimeSqlExpressionBuilder createdAt =
|
final StringSqlExpressionBuilder name;
|
||||||
new DateTimeSqlExpressionBuilder('created_at');
|
|
||||||
|
|
||||||
final DateTimeSqlExpressionBuilder updatedAt =
|
final DateTimeSqlExpressionBuilder createdAt;
|
||||||
new DateTimeSqlExpressionBuilder('updated_at');
|
|
||||||
|
final DateTimeSqlExpressionBuilder updatedAt;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
get expressionBuilders {
|
get expressionBuilders {
|
||||||
|
@ -89,22 +99,22 @@ class AuthorQueryValues extends MapQueryValues {
|
||||||
return (values['id'] as int);
|
return (values['id'] as int);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set id(int value) => values['id'] = value;
|
set id(int value) => values['id'] = value;
|
||||||
String get name {
|
String get name {
|
||||||
return (values['name'] as String);
|
return (values['name'] as String);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set name(String value) => values['name'] = value;
|
set name(String value) => values['name'] = value;
|
||||||
DateTime get createdAt {
|
DateTime get createdAt {
|
||||||
return (values['created_at'] as DateTime);
|
return (values['created_at'] as DateTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set createdAt(DateTime value) => values['created_at'] = value;
|
set createdAt(DateTime value) => values['created_at'] = value;
|
||||||
DateTime get updatedAt {
|
DateTime get updatedAt {
|
||||||
return (values['updated_at'] as DateTime);
|
return (values['updated_at'] as DateTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set updatedAt(DateTime value) => values['updated_at'] = value;
|
set updatedAt(DateTime value) => values['updated_at'] = value;
|
||||||
void copyFrom(Author model) {
|
void copyFrom(Author model) {
|
||||||
values.addAll({
|
values.addAll({
|
||||||
'name': model.name,
|
'name': model.name,
|
||||||
|
@ -120,7 +130,7 @@ class AuthorQueryValues extends MapQueryValues {
|
||||||
|
|
||||||
@generatedSerializable
|
@generatedSerializable
|
||||||
class Author extends _Author {
|
class Author extends _Author {
|
||||||
Author({this.id, this.name, this.createdAt, this.updatedAt});
|
Author({this.id, this.name: 'Tobe Osakwe', this.createdAt, this.updatedAt});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final String id;
|
final String id;
|
||||||
|
@ -169,7 +179,7 @@ abstract class AuthorSerializer {
|
||||||
static Author fromMap(Map map) {
|
static Author fromMap(Map map) {
|
||||||
return new Author(
|
return new Author(
|
||||||
id: map['id'] as String,
|
id: map['id'] as String,
|
||||||
name: map['name'] as String,
|
name: map['name'] as String ?? 'Tobe Osakwe',
|
||||||
createdAt: map['created_at'] != null
|
createdAt: map['created_at'] != null
|
||||||
? (map['created_at'] is DateTime
|
? (map['created_at'] is DateTime
|
||||||
? (map['created_at'] as DateTime)
|
? (map['created_at'] as DateTime)
|
||||||
|
|
|
@ -31,6 +31,7 @@ class BookMigration extends Migration {
|
||||||
|
|
||||||
class BookQuery extends Query<Book, BookQueryWhere> {
|
class BookQuery extends Query<Book, BookQueryWhere> {
|
||||||
BookQuery() {
|
BookQuery() {
|
||||||
|
_where = new BookQueryWhere(this);
|
||||||
leftJoin('authors', 'author_id', 'id',
|
leftJoin('authors', 'author_id', 'id',
|
||||||
additionalFields: const ['name', 'created_at', 'updated_at']);
|
additionalFields: const ['name', 'created_at', 'updated_at']);
|
||||||
leftJoin('authors', 'partner_author_id', 'id',
|
leftJoin('authors', 'partner_author_id', 'id',
|
||||||
|
@ -40,8 +41,7 @@ class BookQuery extends Query<Book, BookQueryWhere> {
|
||||||
@override
|
@override
|
||||||
final BookQueryValues values = new BookQueryValues();
|
final BookQueryValues values = new BookQueryValues();
|
||||||
|
|
||||||
@override
|
BookQueryWhere _where;
|
||||||
final BookQueryWhere where = new BookQueryWhere();
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
get tableName {
|
get tableName {
|
||||||
|
@ -60,9 +60,14 @@ class BookQuery extends Query<Book, BookQueryWhere> {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
BookQueryWhere get where {
|
||||||
|
return _where;
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
BookQueryWhere newWhereClause() {
|
BookQueryWhere newWhereClause() {
|
||||||
return new BookQueryWhere();
|
return new BookQueryWhere(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Book parseRow(List row) {
|
static Book parseRow(List row) {
|
||||||
|
@ -100,23 +105,26 @@ class BookQuery extends Query<Book, BookQueryWhere> {
|
||||||
}
|
}
|
||||||
|
|
||||||
class BookQueryWhere extends QueryWhere {
|
class BookQueryWhere extends QueryWhere {
|
||||||
final NumericSqlExpressionBuilder<int> id =
|
BookQueryWhere(BookQuery query)
|
||||||
new NumericSqlExpressionBuilder<int>('id');
|
: id = new NumericSqlExpressionBuilder<int>(query, 'id'),
|
||||||
|
authorId = new NumericSqlExpressionBuilder<int>(query, 'author_id'),
|
||||||
|
partnerAuthorId =
|
||||||
|
new NumericSqlExpressionBuilder<int>(query, 'partner_author_id'),
|
||||||
|
name = new StringSqlExpressionBuilder(query, 'name'),
|
||||||
|
createdAt = new DateTimeSqlExpressionBuilder(query, 'created_at'),
|
||||||
|
updatedAt = new DateTimeSqlExpressionBuilder(query, 'updated_at');
|
||||||
|
|
||||||
final NumericSqlExpressionBuilder<int> authorId =
|
final NumericSqlExpressionBuilder<int> id;
|
||||||
new NumericSqlExpressionBuilder<int>('author_id');
|
|
||||||
|
|
||||||
final NumericSqlExpressionBuilder<int> partnerAuthorId =
|
final NumericSqlExpressionBuilder<int> authorId;
|
||||||
new NumericSqlExpressionBuilder<int>('partner_author_id');
|
|
||||||
|
|
||||||
final StringSqlExpressionBuilder name =
|
final NumericSqlExpressionBuilder<int> partnerAuthorId;
|
||||||
new StringSqlExpressionBuilder('name');
|
|
||||||
|
|
||||||
final DateTimeSqlExpressionBuilder createdAt =
|
final StringSqlExpressionBuilder name;
|
||||||
new DateTimeSqlExpressionBuilder('created_at');
|
|
||||||
|
|
||||||
final DateTimeSqlExpressionBuilder updatedAt =
|
final DateTimeSqlExpressionBuilder createdAt;
|
||||||
new DateTimeSqlExpressionBuilder('updated_at');
|
|
||||||
|
final DateTimeSqlExpressionBuilder updatedAt;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
get expressionBuilders {
|
get expressionBuilders {
|
||||||
|
@ -129,32 +137,32 @@ class BookQueryValues extends MapQueryValues {
|
||||||
return (values['id'] as int);
|
return (values['id'] as int);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set id(int value) => values['id'] = value;
|
set id(int value) => values['id'] = value;
|
||||||
int get authorId {
|
int get authorId {
|
||||||
return (values['author_id'] as int);
|
return (values['author_id'] as int);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set authorId(int value) => values['author_id'] = value;
|
set authorId(int value) => values['author_id'] = value;
|
||||||
int get partnerAuthorId {
|
int get partnerAuthorId {
|
||||||
return (values['partner_author_id'] as int);
|
return (values['partner_author_id'] as int);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set partnerAuthorId(int value) => values['partner_author_id'] = value;
|
set partnerAuthorId(int value) => values['partner_author_id'] = value;
|
||||||
String get name {
|
String get name {
|
||||||
return (values['name'] as String);
|
return (values['name'] as String);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set name(String value) => values['name'] = value;
|
set name(String value) => values['name'] = value;
|
||||||
DateTime get createdAt {
|
DateTime get createdAt {
|
||||||
return (values['created_at'] as DateTime);
|
return (values['created_at'] as DateTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set createdAt(DateTime value) => values['created_at'] = value;
|
set createdAt(DateTime value) => values['created_at'] = value;
|
||||||
DateTime get updatedAt {
|
DateTime get updatedAt {
|
||||||
return (values['updated_at'] as DateTime);
|
return (values['updated_at'] as DateTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set updatedAt(DateTime value) => values['updated_at'] = value;
|
set updatedAt(DateTime value) => values['updated_at'] = value;
|
||||||
void copyFrom(Book model) {
|
void copyFrom(Book model) {
|
||||||
values.addAll({
|
values.addAll({
|
||||||
'name': model.name,
|
'name': model.name,
|
||||||
|
|
|
@ -31,11 +31,14 @@ class CarMigration extends Migration {
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
class CarQuery extends Query<Car, CarQueryWhere> {
|
class CarQuery extends Query<Car, CarQueryWhere> {
|
||||||
|
CarQuery() {
|
||||||
|
_where = new CarQueryWhere(this);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final CarQueryValues values = new CarQueryValues();
|
final CarQueryValues values = new CarQueryValues();
|
||||||
|
|
||||||
@override
|
CarQueryWhere _where;
|
||||||
final CarQueryWhere where = new CarQueryWhere();
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
get tableName {
|
get tableName {
|
||||||
|
@ -55,9 +58,14 @@ class CarQuery extends Query<Car, CarQueryWhere> {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
CarQueryWhere get where {
|
||||||
|
return _where;
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
CarQueryWhere newWhereClause() {
|
CarQueryWhere newWhereClause() {
|
||||||
return new CarQueryWhere();
|
return new CarQueryWhere(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Car parseRow(List row) {
|
static Car parseRow(List row) {
|
||||||
|
@ -80,26 +88,29 @@ class CarQuery extends Query<Car, CarQueryWhere> {
|
||||||
}
|
}
|
||||||
|
|
||||||
class CarQueryWhere extends QueryWhere {
|
class CarQueryWhere extends QueryWhere {
|
||||||
final NumericSqlExpressionBuilder<int> id =
|
CarQueryWhere(CarQuery query)
|
||||||
new NumericSqlExpressionBuilder<int>('id');
|
: id = new NumericSqlExpressionBuilder<int>(query, 'id'),
|
||||||
|
make = new StringSqlExpressionBuilder(query, 'make'),
|
||||||
|
description = new StringSqlExpressionBuilder(query, 'description'),
|
||||||
|
familyFriendly =
|
||||||
|
new BooleanSqlExpressionBuilder(query, 'family_friendly'),
|
||||||
|
recalledAt = new DateTimeSqlExpressionBuilder(query, 'recalled_at'),
|
||||||
|
createdAt = new DateTimeSqlExpressionBuilder(query, 'created_at'),
|
||||||
|
updatedAt = new DateTimeSqlExpressionBuilder(query, 'updated_at');
|
||||||
|
|
||||||
final StringSqlExpressionBuilder make =
|
final NumericSqlExpressionBuilder<int> id;
|
||||||
new StringSqlExpressionBuilder('make');
|
|
||||||
|
|
||||||
final StringSqlExpressionBuilder description =
|
final StringSqlExpressionBuilder make;
|
||||||
new StringSqlExpressionBuilder('description');
|
|
||||||
|
|
||||||
final BooleanSqlExpressionBuilder familyFriendly =
|
final StringSqlExpressionBuilder description;
|
||||||
new BooleanSqlExpressionBuilder('family_friendly');
|
|
||||||
|
|
||||||
final DateTimeSqlExpressionBuilder recalledAt =
|
final BooleanSqlExpressionBuilder familyFriendly;
|
||||||
new DateTimeSqlExpressionBuilder('recalled_at');
|
|
||||||
|
|
||||||
final DateTimeSqlExpressionBuilder createdAt =
|
final DateTimeSqlExpressionBuilder recalledAt;
|
||||||
new DateTimeSqlExpressionBuilder('created_at');
|
|
||||||
|
|
||||||
final DateTimeSqlExpressionBuilder updatedAt =
|
final DateTimeSqlExpressionBuilder createdAt;
|
||||||
new DateTimeSqlExpressionBuilder('updated_at');
|
|
||||||
|
final DateTimeSqlExpressionBuilder updatedAt;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
get expressionBuilders {
|
get expressionBuilders {
|
||||||
|
@ -120,37 +131,37 @@ class CarQueryValues extends MapQueryValues {
|
||||||
return (values['id'] as int);
|
return (values['id'] as int);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set id(int value) => values['id'] = value;
|
set id(int value) => values['id'] = value;
|
||||||
String get make {
|
String get make {
|
||||||
return (values['make'] as String);
|
return (values['make'] as String);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set make(String value) => values['make'] = value;
|
set make(String value) => values['make'] = value;
|
||||||
String get description {
|
String get description {
|
||||||
return (values['description'] as String);
|
return (values['description'] as String);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set description(String value) => values['description'] = value;
|
set description(String value) => values['description'] = value;
|
||||||
bool get familyFriendly {
|
bool get familyFriendly {
|
||||||
return (values['family_friendly'] as bool);
|
return (values['family_friendly'] as bool);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set familyFriendly(bool value) => values['family_friendly'] = value;
|
set familyFriendly(bool value) => values['family_friendly'] = value;
|
||||||
DateTime get recalledAt {
|
DateTime get recalledAt {
|
||||||
return (values['recalled_at'] as DateTime);
|
return (values['recalled_at'] as DateTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set recalledAt(DateTime value) => values['recalled_at'] = value;
|
set recalledAt(DateTime value) => values['recalled_at'] = value;
|
||||||
DateTime get createdAt {
|
DateTime get createdAt {
|
||||||
return (values['created_at'] as DateTime);
|
return (values['created_at'] as DateTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set createdAt(DateTime value) => values['created_at'] = value;
|
set createdAt(DateTime value) => values['created_at'] = value;
|
||||||
DateTime get updatedAt {
|
DateTime get updatedAt {
|
||||||
return (values['updated_at'] as DateTime);
|
return (values['updated_at'] as DateTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set updatedAt(DateTime value) => values['updated_at'] = value;
|
set updatedAt(DateTime value) => values['updated_at'] = value;
|
||||||
void copyFrom(Car model) {
|
void copyFrom(Car model) {
|
||||||
values.addAll({
|
values.addAll({
|
||||||
'make': model.make,
|
'make': model.make,
|
||||||
|
|
|
@ -27,11 +27,14 @@ class CustomerMigration extends Migration {
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
class CustomerQuery extends Query<Customer, CustomerQueryWhere> {
|
class CustomerQuery extends Query<Customer, CustomerQueryWhere> {
|
||||||
|
CustomerQuery() {
|
||||||
|
_where = new CustomerQueryWhere(this);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final CustomerQueryValues values = new CustomerQueryValues();
|
final CustomerQueryValues values = new CustomerQueryValues();
|
||||||
|
|
||||||
@override
|
CustomerQueryWhere _where;
|
||||||
final CustomerQueryWhere where = new CustomerQueryWhere();
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
get tableName {
|
get tableName {
|
||||||
|
@ -43,9 +46,14 @@ class CustomerQuery extends Query<Customer, CustomerQueryWhere> {
|
||||||
return const ['id', 'created_at', 'updated_at'];
|
return const ['id', 'created_at', 'updated_at'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
CustomerQueryWhere get where {
|
||||||
|
return _where;
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
CustomerQueryWhere newWhereClause() {
|
CustomerQueryWhere newWhereClause() {
|
||||||
return new CustomerQueryWhere();
|
return new CustomerQueryWhere(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Customer parseRow(List row) {
|
static Customer parseRow(List row) {
|
||||||
|
@ -64,14 +72,16 @@ class CustomerQuery extends Query<Customer, CustomerQueryWhere> {
|
||||||
}
|
}
|
||||||
|
|
||||||
class CustomerQueryWhere extends QueryWhere {
|
class CustomerQueryWhere extends QueryWhere {
|
||||||
final NumericSqlExpressionBuilder<int> id =
|
CustomerQueryWhere(CustomerQuery query)
|
||||||
new NumericSqlExpressionBuilder<int>('id');
|
: id = new NumericSqlExpressionBuilder<int>(query, 'id'),
|
||||||
|
createdAt = new DateTimeSqlExpressionBuilder(query, 'created_at'),
|
||||||
|
updatedAt = new DateTimeSqlExpressionBuilder(query, 'updated_at');
|
||||||
|
|
||||||
final DateTimeSqlExpressionBuilder createdAt =
|
final NumericSqlExpressionBuilder<int> id;
|
||||||
new DateTimeSqlExpressionBuilder('created_at');
|
|
||||||
|
|
||||||
final DateTimeSqlExpressionBuilder updatedAt =
|
final DateTimeSqlExpressionBuilder createdAt;
|
||||||
new DateTimeSqlExpressionBuilder('updated_at');
|
|
||||||
|
final DateTimeSqlExpressionBuilder updatedAt;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
get expressionBuilders {
|
get expressionBuilders {
|
||||||
|
@ -84,17 +94,17 @@ class CustomerQueryValues extends MapQueryValues {
|
||||||
return (values['id'] as int);
|
return (values['id'] as int);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set id(int value) => values['id'] = value;
|
set id(int value) => values['id'] = value;
|
||||||
DateTime get createdAt {
|
DateTime get createdAt {
|
||||||
return (values['created_at'] as DateTime);
|
return (values['created_at'] as DateTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set createdAt(DateTime value) => values['created_at'] = value;
|
set createdAt(DateTime value) => values['created_at'] = value;
|
||||||
DateTime get updatedAt {
|
DateTime get updatedAt {
|
||||||
return (values['updated_at'] as DateTime);
|
return (values['updated_at'] as DateTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set updatedAt(DateTime value) => values['updated_at'] = value;
|
set updatedAt(DateTime value) => values['updated_at'] = value;
|
||||||
void copyFrom(Customer model) {
|
void copyFrom(Customer model) {
|
||||||
values
|
values
|
||||||
.addAll({'created_at': model.createdAt, 'updated_at': model.updatedAt});
|
.addAll({'created_at': model.createdAt, 'updated_at': model.updatedAt});
|
||||||
|
|
|
@ -29,11 +29,14 @@ class FootMigration extends Migration {
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
class FootQuery extends Query<Foot, FootQueryWhere> {
|
class FootQuery extends Query<Foot, FootQueryWhere> {
|
||||||
|
FootQuery() {
|
||||||
|
_where = new FootQueryWhere(this);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final FootQueryValues values = new FootQueryValues();
|
final FootQueryValues values = new FootQueryValues();
|
||||||
|
|
||||||
@override
|
FootQueryWhere _where;
|
||||||
final FootQueryWhere where = new FootQueryWhere();
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
get tableName {
|
get tableName {
|
||||||
|
@ -45,9 +48,14 @@ class FootQuery extends Query<Foot, FootQueryWhere> {
|
||||||
return const ['id', 'leg_id', 'n_toes', 'created_at', 'updated_at'];
|
return const ['id', 'leg_id', 'n_toes', 'created_at', 'updated_at'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
FootQueryWhere get where {
|
||||||
|
return _where;
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
FootQueryWhere newWhereClause() {
|
FootQueryWhere newWhereClause() {
|
||||||
return new FootQueryWhere();
|
return new FootQueryWhere(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Foot parseRow(List row) {
|
static Foot parseRow(List row) {
|
||||||
|
@ -68,20 +76,22 @@ class FootQuery extends Query<Foot, FootQueryWhere> {
|
||||||
}
|
}
|
||||||
|
|
||||||
class FootQueryWhere extends QueryWhere {
|
class FootQueryWhere extends QueryWhere {
|
||||||
final NumericSqlExpressionBuilder<int> id =
|
FootQueryWhere(FootQuery query)
|
||||||
new NumericSqlExpressionBuilder<int>('id');
|
: id = new NumericSqlExpressionBuilder<int>(query, 'id'),
|
||||||
|
legId = new NumericSqlExpressionBuilder<int>(query, 'leg_id'),
|
||||||
|
nToes = new NumericSqlExpressionBuilder<int>(query, 'n_toes'),
|
||||||
|
createdAt = new DateTimeSqlExpressionBuilder(query, 'created_at'),
|
||||||
|
updatedAt = new DateTimeSqlExpressionBuilder(query, 'updated_at');
|
||||||
|
|
||||||
final NumericSqlExpressionBuilder<int> legId =
|
final NumericSqlExpressionBuilder<int> id;
|
||||||
new NumericSqlExpressionBuilder<int>('leg_id');
|
|
||||||
|
|
||||||
final NumericSqlExpressionBuilder<int> nToes =
|
final NumericSqlExpressionBuilder<int> legId;
|
||||||
new NumericSqlExpressionBuilder<int>('n_toes');
|
|
||||||
|
|
||||||
final DateTimeSqlExpressionBuilder createdAt =
|
final NumericSqlExpressionBuilder<int> nToes;
|
||||||
new DateTimeSqlExpressionBuilder('created_at');
|
|
||||||
|
|
||||||
final DateTimeSqlExpressionBuilder updatedAt =
|
final DateTimeSqlExpressionBuilder createdAt;
|
||||||
new DateTimeSqlExpressionBuilder('updated_at');
|
|
||||||
|
final DateTimeSqlExpressionBuilder updatedAt;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
get expressionBuilders {
|
get expressionBuilders {
|
||||||
|
@ -94,27 +104,27 @@ class FootQueryValues extends MapQueryValues {
|
||||||
return (values['id'] as int);
|
return (values['id'] as int);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set id(int value) => values['id'] = value;
|
set id(int value) => values['id'] = value;
|
||||||
int get legId {
|
int get legId {
|
||||||
return (values['leg_id'] as int);
|
return (values['leg_id'] as int);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set legId(int value) => values['leg_id'] = value;
|
set legId(int value) => values['leg_id'] = value;
|
||||||
int get nToes {
|
int get nToes {
|
||||||
return (values['n_toes'] as int);
|
return (values['n_toes'] as int);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set nToes(int value) => values['n_toes'] = value;
|
set nToes(int value) => values['n_toes'] = value;
|
||||||
DateTime get createdAt {
|
DateTime get createdAt {
|
||||||
return (values['created_at'] as DateTime);
|
return (values['created_at'] as DateTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set createdAt(DateTime value) => values['created_at'] = value;
|
set createdAt(DateTime value) => values['created_at'] = value;
|
||||||
DateTime get updatedAt {
|
DateTime get updatedAt {
|
||||||
return (values['updated_at'] as DateTime);
|
return (values['updated_at'] as DateTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set updatedAt(DateTime value) => values['updated_at'] = value;
|
set updatedAt(DateTime value) => values['updated_at'] = value;
|
||||||
void copyFrom(Foot model) {
|
void copyFrom(Foot model) {
|
||||||
values.addAll({
|
values.addAll({
|
||||||
'leg_id': model.legId,
|
'leg_id': model.legId,
|
||||||
|
|
|
@ -29,11 +29,14 @@ class FruitMigration extends Migration {
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
class FruitQuery extends Query<Fruit, FruitQueryWhere> {
|
class FruitQuery extends Query<Fruit, FruitQueryWhere> {
|
||||||
|
FruitQuery() {
|
||||||
|
_where = new FruitQueryWhere(this);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final FruitQueryValues values = new FruitQueryValues();
|
final FruitQueryValues values = new FruitQueryValues();
|
||||||
|
|
||||||
@override
|
FruitQueryWhere _where;
|
||||||
final FruitQueryWhere where = new FruitQueryWhere();
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
get tableName {
|
get tableName {
|
||||||
|
@ -45,9 +48,14 @@ class FruitQuery extends Query<Fruit, FruitQueryWhere> {
|
||||||
return const ['id', 'tree_id', 'common_name', 'created_at', 'updated_at'];
|
return const ['id', 'tree_id', 'common_name', 'created_at', 'updated_at'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
FruitQueryWhere get where {
|
||||||
|
return _where;
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
FruitQueryWhere newWhereClause() {
|
FruitQueryWhere newWhereClause() {
|
||||||
return new FruitQueryWhere();
|
return new FruitQueryWhere(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Fruit parseRow(List row) {
|
static Fruit parseRow(List row) {
|
||||||
|
@ -68,20 +76,22 @@ class FruitQuery extends Query<Fruit, FruitQueryWhere> {
|
||||||
}
|
}
|
||||||
|
|
||||||
class FruitQueryWhere extends QueryWhere {
|
class FruitQueryWhere extends QueryWhere {
|
||||||
final NumericSqlExpressionBuilder<int> id =
|
FruitQueryWhere(FruitQuery query)
|
||||||
new NumericSqlExpressionBuilder<int>('id');
|
: id = new NumericSqlExpressionBuilder<int>(query, 'id'),
|
||||||
|
treeId = new NumericSqlExpressionBuilder<int>(query, 'tree_id'),
|
||||||
|
commonName = new StringSqlExpressionBuilder(query, 'common_name'),
|
||||||
|
createdAt = new DateTimeSqlExpressionBuilder(query, 'created_at'),
|
||||||
|
updatedAt = new DateTimeSqlExpressionBuilder(query, 'updated_at');
|
||||||
|
|
||||||
final NumericSqlExpressionBuilder<int> treeId =
|
final NumericSqlExpressionBuilder<int> id;
|
||||||
new NumericSqlExpressionBuilder<int>('tree_id');
|
|
||||||
|
|
||||||
final StringSqlExpressionBuilder commonName =
|
final NumericSqlExpressionBuilder<int> treeId;
|
||||||
new StringSqlExpressionBuilder('common_name');
|
|
||||||
|
|
||||||
final DateTimeSqlExpressionBuilder createdAt =
|
final StringSqlExpressionBuilder commonName;
|
||||||
new DateTimeSqlExpressionBuilder('created_at');
|
|
||||||
|
|
||||||
final DateTimeSqlExpressionBuilder updatedAt =
|
final DateTimeSqlExpressionBuilder createdAt;
|
||||||
new DateTimeSqlExpressionBuilder('updated_at');
|
|
||||||
|
final DateTimeSqlExpressionBuilder updatedAt;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
get expressionBuilders {
|
get expressionBuilders {
|
||||||
|
@ -94,27 +104,27 @@ class FruitQueryValues extends MapQueryValues {
|
||||||
return (values['id'] as int);
|
return (values['id'] as int);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set id(int value) => values['id'] = value;
|
set id(int value) => values['id'] = value;
|
||||||
int get treeId {
|
int get treeId {
|
||||||
return (values['tree_id'] as int);
|
return (values['tree_id'] as int);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set treeId(int value) => values['tree_id'] = value;
|
set treeId(int value) => values['tree_id'] = value;
|
||||||
String get commonName {
|
String get commonName {
|
||||||
return (values['common_name'] as String);
|
return (values['common_name'] as String);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set commonName(String value) => values['common_name'] = value;
|
set commonName(String value) => values['common_name'] = value;
|
||||||
DateTime get createdAt {
|
DateTime get createdAt {
|
||||||
return (values['created_at'] as DateTime);
|
return (values['created_at'] as DateTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set createdAt(DateTime value) => values['created_at'] = value;
|
set createdAt(DateTime value) => values['created_at'] = value;
|
||||||
DateTime get updatedAt {
|
DateTime get updatedAt {
|
||||||
return (values['updated_at'] as DateTime);
|
return (values['updated_at'] as DateTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set updatedAt(DateTime value) => values['updated_at'] = value;
|
set updatedAt(DateTime value) => values['updated_at'] = value;
|
||||||
void copyFrom(Fruit model) {
|
void copyFrom(Fruit model) {
|
||||||
values.addAll({
|
values.addAll({
|
||||||
'tree_id': model.treeId,
|
'tree_id': model.treeId,
|
||||||
|
|
|
@ -29,6 +29,7 @@ class LegMigration extends Migration {
|
||||||
|
|
||||||
class LegQuery extends Query<Leg, LegQueryWhere> {
|
class LegQuery extends Query<Leg, LegQueryWhere> {
|
||||||
LegQuery() {
|
LegQuery() {
|
||||||
|
_where = new LegQueryWhere(this);
|
||||||
leftJoin('feet', 'id', 'leg_id', additionalFields: const [
|
leftJoin('feet', 'id', 'leg_id', additionalFields: const [
|
||||||
'leg_id',
|
'leg_id',
|
||||||
'n_toes',
|
'n_toes',
|
||||||
|
@ -40,8 +41,7 @@ class LegQuery extends Query<Leg, LegQueryWhere> {
|
||||||
@override
|
@override
|
||||||
final LegQueryValues values = new LegQueryValues();
|
final LegQueryValues values = new LegQueryValues();
|
||||||
|
|
||||||
@override
|
LegQueryWhere _where;
|
||||||
final LegQueryWhere where = new LegQueryWhere();
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
get tableName {
|
get tableName {
|
||||||
|
@ -53,9 +53,14 @@ class LegQuery extends Query<Leg, LegQueryWhere> {
|
||||||
return const ['id', 'name', 'created_at', 'updated_at'];
|
return const ['id', 'name', 'created_at', 'updated_at'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
LegQueryWhere get where {
|
||||||
|
return _where;
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
LegQueryWhere newWhereClause() {
|
LegQueryWhere newWhereClause() {
|
||||||
return new LegQueryWhere();
|
return new LegQueryWhere(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Leg parseRow(List row) {
|
static Leg parseRow(List row) {
|
||||||
|
@ -88,17 +93,19 @@ class LegQuery extends Query<Leg, LegQueryWhere> {
|
||||||
}
|
}
|
||||||
|
|
||||||
class LegQueryWhere extends QueryWhere {
|
class LegQueryWhere extends QueryWhere {
|
||||||
final NumericSqlExpressionBuilder<int> id =
|
LegQueryWhere(LegQuery query)
|
||||||
new NumericSqlExpressionBuilder<int>('id');
|
: id = new NumericSqlExpressionBuilder<int>(query, 'id'),
|
||||||
|
name = new StringSqlExpressionBuilder(query, 'name'),
|
||||||
|
createdAt = new DateTimeSqlExpressionBuilder(query, 'created_at'),
|
||||||
|
updatedAt = new DateTimeSqlExpressionBuilder(query, 'updated_at');
|
||||||
|
|
||||||
final StringSqlExpressionBuilder name =
|
final NumericSqlExpressionBuilder<int> id;
|
||||||
new StringSqlExpressionBuilder('name');
|
|
||||||
|
|
||||||
final DateTimeSqlExpressionBuilder createdAt =
|
final StringSqlExpressionBuilder name;
|
||||||
new DateTimeSqlExpressionBuilder('created_at');
|
|
||||||
|
|
||||||
final DateTimeSqlExpressionBuilder updatedAt =
|
final DateTimeSqlExpressionBuilder createdAt;
|
||||||
new DateTimeSqlExpressionBuilder('updated_at');
|
|
||||||
|
final DateTimeSqlExpressionBuilder updatedAt;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
get expressionBuilders {
|
get expressionBuilders {
|
||||||
|
@ -111,22 +118,22 @@ class LegQueryValues extends MapQueryValues {
|
||||||
return (values['id'] as int);
|
return (values['id'] as int);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set id(int value) => values['id'] = value;
|
set id(int value) => values['id'] = value;
|
||||||
String get name {
|
String get name {
|
||||||
return (values['name'] as String);
|
return (values['name'] as String);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set name(String value) => values['name'] = value;
|
set name(String value) => values['name'] = value;
|
||||||
DateTime get createdAt {
|
DateTime get createdAt {
|
||||||
return (values['created_at'] as DateTime);
|
return (values['created_at'] as DateTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set createdAt(DateTime value) => values['created_at'] = value;
|
set createdAt(DateTime value) => values['created_at'] = value;
|
||||||
DateTime get updatedAt {
|
DateTime get updatedAt {
|
||||||
return (values['updated_at'] as DateTime);
|
return (values['updated_at'] as DateTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set updatedAt(DateTime value) => values['updated_at'] = value;
|
set updatedAt(DateTime value) => values['updated_at'] = value;
|
||||||
void copyFrom(Leg model) {
|
void copyFrom(Leg model) {
|
||||||
values.addAll({
|
values.addAll({
|
||||||
'name': model.name,
|
'name': model.name,
|
||||||
|
|
|
@ -31,11 +31,14 @@ class OrderMigration extends Migration {
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
class OrderQuery extends Query<Order, OrderQueryWhere> {
|
class OrderQuery extends Query<Order, OrderQueryWhere> {
|
||||||
|
OrderQuery() {
|
||||||
|
_where = new OrderQueryWhere(this);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final OrderQueryValues values = new OrderQueryValues();
|
final OrderQueryValues values = new OrderQueryValues();
|
||||||
|
|
||||||
@override
|
OrderQueryWhere _where;
|
||||||
final OrderQueryWhere where = new OrderQueryWhere();
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
get tableName {
|
get tableName {
|
||||||
|
@ -55,9 +58,14 @@ class OrderQuery extends Query<Order, OrderQueryWhere> {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
OrderQueryWhere get where {
|
||||||
|
return _where;
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
OrderQueryWhere newWhereClause() {
|
OrderQueryWhere newWhereClause() {
|
||||||
return new OrderQueryWhere();
|
return new OrderQueryWhere(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Order parseRow(List row) {
|
static Order parseRow(List row) {
|
||||||
|
@ -80,26 +88,28 @@ class OrderQuery extends Query<Order, OrderQueryWhere> {
|
||||||
}
|
}
|
||||||
|
|
||||||
class OrderQueryWhere extends QueryWhere {
|
class OrderQueryWhere extends QueryWhere {
|
||||||
final NumericSqlExpressionBuilder<int> id =
|
OrderQueryWhere(OrderQuery query)
|
||||||
new NumericSqlExpressionBuilder<int>('id');
|
: id = new NumericSqlExpressionBuilder<int>(query, 'id'),
|
||||||
|
customerId = new NumericSqlExpressionBuilder<int>(query, 'customer_id'),
|
||||||
|
employeeId = new NumericSqlExpressionBuilder<int>(query, 'employee_id'),
|
||||||
|
orderDate = new DateTimeSqlExpressionBuilder(query, 'order_date'),
|
||||||
|
shipperId = new NumericSqlExpressionBuilder<int>(query, 'shipper_id'),
|
||||||
|
createdAt = new DateTimeSqlExpressionBuilder(query, 'created_at'),
|
||||||
|
updatedAt = new DateTimeSqlExpressionBuilder(query, 'updated_at');
|
||||||
|
|
||||||
final NumericSqlExpressionBuilder<int> customerId =
|
final NumericSqlExpressionBuilder<int> id;
|
||||||
new NumericSqlExpressionBuilder<int>('customer_id');
|
|
||||||
|
|
||||||
final NumericSqlExpressionBuilder<int> employeeId =
|
final NumericSqlExpressionBuilder<int> customerId;
|
||||||
new NumericSqlExpressionBuilder<int>('employee_id');
|
|
||||||
|
|
||||||
final DateTimeSqlExpressionBuilder orderDate =
|
final NumericSqlExpressionBuilder<int> employeeId;
|
||||||
new DateTimeSqlExpressionBuilder('order_date');
|
|
||||||
|
|
||||||
final NumericSqlExpressionBuilder<int> shipperId =
|
final DateTimeSqlExpressionBuilder orderDate;
|
||||||
new NumericSqlExpressionBuilder<int>('shipper_id');
|
|
||||||
|
|
||||||
final DateTimeSqlExpressionBuilder createdAt =
|
final NumericSqlExpressionBuilder<int> shipperId;
|
||||||
new DateTimeSqlExpressionBuilder('created_at');
|
|
||||||
|
|
||||||
final DateTimeSqlExpressionBuilder updatedAt =
|
final DateTimeSqlExpressionBuilder createdAt;
|
||||||
new DateTimeSqlExpressionBuilder('updated_at');
|
|
||||||
|
final DateTimeSqlExpressionBuilder updatedAt;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
get expressionBuilders {
|
get expressionBuilders {
|
||||||
|
@ -120,37 +130,37 @@ class OrderQueryValues extends MapQueryValues {
|
||||||
return (values['id'] as int);
|
return (values['id'] as int);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set id(int value) => values['id'] = value;
|
set id(int value) => values['id'] = value;
|
||||||
int get customerId {
|
int get customerId {
|
||||||
return (values['customer_id'] as int);
|
return (values['customer_id'] as int);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set customerId(int value) => values['customer_id'] = value;
|
set customerId(int value) => values['customer_id'] = value;
|
||||||
int get employeeId {
|
int get employeeId {
|
||||||
return (values['employee_id'] as int);
|
return (values['employee_id'] as int);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set employeeId(int value) => values['employee_id'] = value;
|
set employeeId(int value) => values['employee_id'] = value;
|
||||||
DateTime get orderDate {
|
DateTime get orderDate {
|
||||||
return (values['order_date'] as DateTime);
|
return (values['order_date'] as DateTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set orderDate(DateTime value) => values['order_date'] = value;
|
set orderDate(DateTime value) => values['order_date'] = value;
|
||||||
int get shipperId {
|
int get shipperId {
|
||||||
return (values['shipper_id'] as int);
|
return (values['shipper_id'] as int);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set shipperId(int value) => values['shipper_id'] = value;
|
set shipperId(int value) => values['shipper_id'] = value;
|
||||||
DateTime get createdAt {
|
DateTime get createdAt {
|
||||||
return (values['created_at'] as DateTime);
|
return (values['created_at'] as DateTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set createdAt(DateTime value) => values['created_at'] = value;
|
set createdAt(DateTime value) => values['created_at'] = value;
|
||||||
DateTime get updatedAt {
|
DateTime get updatedAt {
|
||||||
return (values['updated_at'] as DateTime);
|
return (values['updated_at'] as DateTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set updatedAt(DateTime value) => values['updated_at'] = value;
|
set updatedAt(DateTime value) => values['updated_at'] = value;
|
||||||
void copyFrom(Order model) {
|
void copyFrom(Order model) {
|
||||||
values.addAll({
|
values.addAll({
|
||||||
'customer_id': model.customerId,
|
'customer_id': model.customerId,
|
||||||
|
|
|
@ -28,13 +28,14 @@ class TreeMigration extends Migration {
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
class TreeQuery extends Query<Tree, TreeQueryWhere> {
|
class TreeQuery extends Query<Tree, TreeQueryWhere> {
|
||||||
TreeQuery() {}
|
TreeQuery() {
|
||||||
|
_where = new TreeQueryWhere(this);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final TreeQueryValues values = new TreeQueryValues();
|
final TreeQueryValues values = new TreeQueryValues();
|
||||||
|
|
||||||
@override
|
TreeQueryWhere _where;
|
||||||
final TreeQueryWhere where = new TreeQueryWhere();
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
get tableName {
|
get tableName {
|
||||||
|
@ -46,9 +47,14 @@ class TreeQuery extends Query<Tree, TreeQueryWhere> {
|
||||||
return const ['id', 'rings', 'created_at', 'updated_at'];
|
return const ['id', 'rings', 'created_at', 'updated_at'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
TreeQueryWhere get where {
|
||||||
|
return _where;
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
TreeQueryWhere newWhereClause() {
|
TreeQueryWhere newWhereClause() {
|
||||||
return new TreeQueryWhere();
|
return new TreeQueryWhere(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Tree parseRow(List row) {
|
static Tree parseRow(List row) {
|
||||||
|
@ -110,17 +116,19 @@ class TreeQuery extends Query<Tree, TreeQueryWhere> {
|
||||||
}
|
}
|
||||||
|
|
||||||
class TreeQueryWhere extends QueryWhere {
|
class TreeQueryWhere extends QueryWhere {
|
||||||
final NumericSqlExpressionBuilder<int> id =
|
TreeQueryWhere(TreeQuery query)
|
||||||
new NumericSqlExpressionBuilder<int>('id');
|
: id = new NumericSqlExpressionBuilder<int>(query, 'id'),
|
||||||
|
rings = new NumericSqlExpressionBuilder<int>(query, 'rings'),
|
||||||
|
createdAt = new DateTimeSqlExpressionBuilder(query, 'created_at'),
|
||||||
|
updatedAt = new DateTimeSqlExpressionBuilder(query, 'updated_at');
|
||||||
|
|
||||||
final NumericSqlExpressionBuilder<int> rings =
|
final NumericSqlExpressionBuilder<int> id;
|
||||||
new NumericSqlExpressionBuilder<int>('rings');
|
|
||||||
|
|
||||||
final DateTimeSqlExpressionBuilder createdAt =
|
final NumericSqlExpressionBuilder<int> rings;
|
||||||
new DateTimeSqlExpressionBuilder('created_at');
|
|
||||||
|
|
||||||
final DateTimeSqlExpressionBuilder updatedAt =
|
final DateTimeSqlExpressionBuilder createdAt;
|
||||||
new DateTimeSqlExpressionBuilder('updated_at');
|
|
||||||
|
final DateTimeSqlExpressionBuilder updatedAt;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
get expressionBuilders {
|
get expressionBuilders {
|
||||||
|
@ -133,22 +141,22 @@ class TreeQueryValues extends MapQueryValues {
|
||||||
return (values['id'] as int);
|
return (values['id'] as int);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set id(int value) => values['id'] = value;
|
set id(int value) => values['id'] = value;
|
||||||
int get rings {
|
int get rings {
|
||||||
return (values['rings'] as int);
|
return (values['rings'] as int);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set rings(int value) => values['rings'] = value;
|
set rings(int value) => values['rings'] = value;
|
||||||
DateTime get createdAt {
|
DateTime get createdAt {
|
||||||
return (values['created_at'] as DateTime);
|
return (values['created_at'] as DateTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set createdAt(DateTime value) => values['created_at'] = value;
|
set createdAt(DateTime value) => values['created_at'] = value;
|
||||||
DateTime get updatedAt {
|
DateTime get updatedAt {
|
||||||
return (values['updated_at'] as DateTime);
|
return (values['updated_at'] as DateTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set updatedAt(DateTime value) => values['updated_at'] = value;
|
set updatedAt(DateTime value) => values['updated_at'] = value;
|
||||||
void copyFrom(Tree model) {
|
void copyFrom(Tree model) {
|
||||||
values.addAll({
|
values.addAll({
|
||||||
'rings': model.rings,
|
'rings': model.rings,
|
||||||
|
|
|
@ -63,13 +63,14 @@ class UserRoleMigration extends Migration {
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
class UserQuery extends Query<User, UserQueryWhere> {
|
class UserQuery extends Query<User, UserQueryWhere> {
|
||||||
UserQuery() {}
|
UserQuery() {
|
||||||
|
_where = new UserQueryWhere(this);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final UserQueryValues values = new UserQueryValues();
|
final UserQueryValues values = new UserQueryValues();
|
||||||
|
|
||||||
@override
|
UserQueryWhere _where;
|
||||||
final UserQueryWhere where = new UserQueryWhere();
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
get tableName {
|
get tableName {
|
||||||
|
@ -88,9 +89,14 @@ class UserQuery extends Query<User, UserQueryWhere> {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
UserQueryWhere get where {
|
||||||
|
return _where;
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
UserQueryWhere newWhereClause() {
|
UserQueryWhere newWhereClause() {
|
||||||
return new UserQueryWhere();
|
return new UserQueryWhere(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
static User parseRow(List row) {
|
static User parseRow(List row) {
|
||||||
|
@ -154,23 +160,25 @@ class UserQuery extends Query<User, UserQueryWhere> {
|
||||||
}
|
}
|
||||||
|
|
||||||
class UserQueryWhere extends QueryWhere {
|
class UserQueryWhere extends QueryWhere {
|
||||||
final NumericSqlExpressionBuilder<int> id =
|
UserQueryWhere(UserQuery query)
|
||||||
new NumericSqlExpressionBuilder<int>('id');
|
: id = new NumericSqlExpressionBuilder<int>(query, 'id'),
|
||||||
|
username = new StringSqlExpressionBuilder(query, 'username'),
|
||||||
|
password = new StringSqlExpressionBuilder(query, 'password'),
|
||||||
|
email = new StringSqlExpressionBuilder(query, 'email'),
|
||||||
|
createdAt = new DateTimeSqlExpressionBuilder(query, 'created_at'),
|
||||||
|
updatedAt = new DateTimeSqlExpressionBuilder(query, 'updated_at');
|
||||||
|
|
||||||
final StringSqlExpressionBuilder username =
|
final NumericSqlExpressionBuilder<int> id;
|
||||||
new StringSqlExpressionBuilder('username');
|
|
||||||
|
|
||||||
final StringSqlExpressionBuilder password =
|
final StringSqlExpressionBuilder username;
|
||||||
new StringSqlExpressionBuilder('password');
|
|
||||||
|
|
||||||
final StringSqlExpressionBuilder email =
|
final StringSqlExpressionBuilder password;
|
||||||
new StringSqlExpressionBuilder('email');
|
|
||||||
|
|
||||||
final DateTimeSqlExpressionBuilder createdAt =
|
final StringSqlExpressionBuilder email;
|
||||||
new DateTimeSqlExpressionBuilder('created_at');
|
|
||||||
|
|
||||||
final DateTimeSqlExpressionBuilder updatedAt =
|
final DateTimeSqlExpressionBuilder createdAt;
|
||||||
new DateTimeSqlExpressionBuilder('updated_at');
|
|
||||||
|
final DateTimeSqlExpressionBuilder updatedAt;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
get expressionBuilders {
|
get expressionBuilders {
|
||||||
|
@ -183,32 +191,32 @@ class UserQueryValues extends MapQueryValues {
|
||||||
return (values['id'] as int);
|
return (values['id'] as int);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set id(int value) => values['id'] = value;
|
set id(int value) => values['id'] = value;
|
||||||
String get username {
|
String get username {
|
||||||
return (values['username'] as String);
|
return (values['username'] as String);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set username(String value) => values['username'] = value;
|
set username(String value) => values['username'] = value;
|
||||||
String get password {
|
String get password {
|
||||||
return (values['password'] as String);
|
return (values['password'] as String);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set password(String value) => values['password'] = value;
|
set password(String value) => values['password'] = value;
|
||||||
String get email {
|
String get email {
|
||||||
return (values['email'] as String);
|
return (values['email'] as String);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set email(String value) => values['email'] = value;
|
set email(String value) => values['email'] = value;
|
||||||
DateTime get createdAt {
|
DateTime get createdAt {
|
||||||
return (values['created_at'] as DateTime);
|
return (values['created_at'] as DateTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set createdAt(DateTime value) => values['created_at'] = value;
|
set createdAt(DateTime value) => values['created_at'] = value;
|
||||||
DateTime get updatedAt {
|
DateTime get updatedAt {
|
||||||
return (values['updated_at'] as DateTime);
|
return (values['updated_at'] as DateTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set updatedAt(DateTime value) => values['updated_at'] = value;
|
set updatedAt(DateTime value) => values['updated_at'] = value;
|
||||||
void copyFrom(User model) {
|
void copyFrom(User model) {
|
||||||
values.addAll({
|
values.addAll({
|
||||||
'username': model.username,
|
'username': model.username,
|
||||||
|
@ -221,13 +229,14 @@ class UserQueryValues extends MapQueryValues {
|
||||||
}
|
}
|
||||||
|
|
||||||
class RoleQuery extends Query<Role, RoleQueryWhere> {
|
class RoleQuery extends Query<Role, RoleQueryWhere> {
|
||||||
RoleQuery() {}
|
RoleQuery() {
|
||||||
|
_where = new RoleQueryWhere(this);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final RoleQueryValues values = new RoleQueryValues();
|
final RoleQueryValues values = new RoleQueryValues();
|
||||||
|
|
||||||
@override
|
RoleQueryWhere _where;
|
||||||
final RoleQueryWhere where = new RoleQueryWhere();
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
get tableName {
|
get tableName {
|
||||||
|
@ -239,9 +248,14 @@ class RoleQuery extends Query<Role, RoleQueryWhere> {
|
||||||
return const ['id', 'name', 'created_at', 'updated_at'];
|
return const ['id', 'name', 'created_at', 'updated_at'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
RoleQueryWhere get where {
|
||||||
|
return _where;
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
RoleQueryWhere newWhereClause() {
|
RoleQueryWhere newWhereClause() {
|
||||||
return new RoleQueryWhere();
|
return new RoleQueryWhere(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Role parseRow(List row) {
|
static Role parseRow(List row) {
|
||||||
|
@ -303,17 +317,19 @@ class RoleQuery extends Query<Role, RoleQueryWhere> {
|
||||||
}
|
}
|
||||||
|
|
||||||
class RoleQueryWhere extends QueryWhere {
|
class RoleQueryWhere extends QueryWhere {
|
||||||
final NumericSqlExpressionBuilder<int> id =
|
RoleQueryWhere(RoleQuery query)
|
||||||
new NumericSqlExpressionBuilder<int>('id');
|
: id = new NumericSqlExpressionBuilder<int>(query, 'id'),
|
||||||
|
name = new StringSqlExpressionBuilder(query, 'name'),
|
||||||
|
createdAt = new DateTimeSqlExpressionBuilder(query, 'created_at'),
|
||||||
|
updatedAt = new DateTimeSqlExpressionBuilder(query, 'updated_at');
|
||||||
|
|
||||||
final StringSqlExpressionBuilder name =
|
final NumericSqlExpressionBuilder<int> id;
|
||||||
new StringSqlExpressionBuilder('name');
|
|
||||||
|
|
||||||
final DateTimeSqlExpressionBuilder createdAt =
|
final StringSqlExpressionBuilder name;
|
||||||
new DateTimeSqlExpressionBuilder('created_at');
|
|
||||||
|
|
||||||
final DateTimeSqlExpressionBuilder updatedAt =
|
final DateTimeSqlExpressionBuilder createdAt;
|
||||||
new DateTimeSqlExpressionBuilder('updated_at');
|
|
||||||
|
final DateTimeSqlExpressionBuilder updatedAt;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
get expressionBuilders {
|
get expressionBuilders {
|
||||||
|
@ -326,22 +342,22 @@ class RoleQueryValues extends MapQueryValues {
|
||||||
return (values['id'] as int);
|
return (values['id'] as int);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set id(int value) => values['id'] = value;
|
set id(int value) => values['id'] = value;
|
||||||
String get name {
|
String get name {
|
||||||
return (values['name'] as String);
|
return (values['name'] as String);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set name(String value) => values['name'] = value;
|
set name(String value) => values['name'] = value;
|
||||||
DateTime get createdAt {
|
DateTime get createdAt {
|
||||||
return (values['created_at'] as DateTime);
|
return (values['created_at'] as DateTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set createdAt(DateTime value) => values['created_at'] = value;
|
set createdAt(DateTime value) => values['created_at'] = value;
|
||||||
DateTime get updatedAt {
|
DateTime get updatedAt {
|
||||||
return (values['updated_at'] as DateTime);
|
return (values['updated_at'] as DateTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set updatedAt(DateTime value) => values['updated_at'] = value;
|
set updatedAt(DateTime value) => values['updated_at'] = value;
|
||||||
void copyFrom(Role model) {
|
void copyFrom(Role model) {
|
||||||
values.addAll({
|
values.addAll({
|
||||||
'name': model.name,
|
'name': model.name,
|
||||||
|
@ -353,6 +369,7 @@ class RoleQueryValues extends MapQueryValues {
|
||||||
|
|
||||||
class UserRoleQuery extends Query<UserRole, UserRoleQueryWhere> {
|
class UserRoleQuery extends Query<UserRole, UserRoleQueryWhere> {
|
||||||
UserRoleQuery() {
|
UserRoleQuery() {
|
||||||
|
_where = new UserRoleQueryWhere(this);
|
||||||
leftJoin('users', 'user_id', 'id', additionalFields: const [
|
leftJoin('users', 'user_id', 'id', additionalFields: const [
|
||||||
'username',
|
'username',
|
||||||
'password',
|
'password',
|
||||||
|
@ -367,8 +384,7 @@ class UserRoleQuery extends Query<UserRole, UserRoleQueryWhere> {
|
||||||
@override
|
@override
|
||||||
final UserRoleQueryValues values = new UserRoleQueryValues();
|
final UserRoleQueryValues values = new UserRoleQueryValues();
|
||||||
|
|
||||||
@override
|
UserRoleQueryWhere _where;
|
||||||
final UserRoleQueryWhere where = new UserRoleQueryWhere();
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
get tableName {
|
get tableName {
|
||||||
|
@ -380,9 +396,14 @@ class UserRoleQuery extends Query<UserRole, UserRoleQueryWhere> {
|
||||||
return const ['id', 'user_id', 'role_id'];
|
return const ['id', 'user_id', 'role_id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
UserRoleQueryWhere get where {
|
||||||
|
return _where;
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
UserRoleQueryWhere newWhereClause() {
|
UserRoleQueryWhere newWhereClause() {
|
||||||
return new UserRoleQueryWhere();
|
return new UserRoleQueryWhere(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
static UserRole parseRow(List row) {
|
static UserRole parseRow(List row) {
|
||||||
|
@ -412,14 +433,16 @@ class UserRoleQuery extends Query<UserRole, UserRoleQueryWhere> {
|
||||||
}
|
}
|
||||||
|
|
||||||
class UserRoleQueryWhere extends QueryWhere {
|
class UserRoleQueryWhere extends QueryWhere {
|
||||||
final NumericSqlExpressionBuilder<int> id =
|
UserRoleQueryWhere(UserRoleQuery query)
|
||||||
new NumericSqlExpressionBuilder<int>('id');
|
: id = new NumericSqlExpressionBuilder<int>(query, 'id'),
|
||||||
|
userId = new NumericSqlExpressionBuilder<int>(query, 'user_id'),
|
||||||
|
roleId = new NumericSqlExpressionBuilder<int>(query, 'role_id');
|
||||||
|
|
||||||
final NumericSqlExpressionBuilder<int> userId =
|
final NumericSqlExpressionBuilder<int> id;
|
||||||
new NumericSqlExpressionBuilder<int>('user_id');
|
|
||||||
|
|
||||||
final NumericSqlExpressionBuilder<int> roleId =
|
final NumericSqlExpressionBuilder<int> userId;
|
||||||
new NumericSqlExpressionBuilder<int>('role_id');
|
|
||||||
|
final NumericSqlExpressionBuilder<int> roleId;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
get expressionBuilders {
|
get expressionBuilders {
|
||||||
|
@ -432,17 +455,17 @@ class UserRoleQueryValues extends MapQueryValues {
|
||||||
return (values['id'] as int);
|
return (values['id'] as int);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set id(int value) => values['id'] = value;
|
set id(int value) => values['id'] = value;
|
||||||
int get userId {
|
int get userId {
|
||||||
return (values['user_id'] as int);
|
return (values['user_id'] as int);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set userId(int value) => values['user_id'] = value;
|
set userId(int value) => values['user_id'] = value;
|
||||||
int get roleId {
|
int get roleId {
|
||||||
return (values['role_id'] as int);
|
return (values['role_id'] as int);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set roleId(int value) => values['role_id'] = value;
|
set roleId(int value) => values['role_id'] = value;
|
||||||
void copyFrom(UserRole model) {
|
void copyFrom(UserRole model) {
|
||||||
values.addAll({'id': model.id});
|
values.addAll({'id': model.id});
|
||||||
if (model.user != null) {
|
if (model.user != null) {
|
||||||
|
|
|
@ -78,7 +78,7 @@ main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('union', () async {
|
test('union', () async {
|
||||||
var query1 = new CarQuery()..where.make.like('%Fer%');
|
var query1 = new CarQuery()..where.make.like((_) => '%Fer%');
|
||||||
var query2 = new CarQuery()..where.familyFriendly.isTrue;
|
var query2 = new CarQuery()..where.familyFriendly.isTrue;
|
||||||
var query3 = new CarQuery()..where.description.equals('Submarine');
|
var query3 = new CarQuery()..where.description.equals('Submarine');
|
||||||
var union = query1.union(query2).unionAll(query3);
|
var union = query1.union(query2).unionAll(query3);
|
||||||
|
@ -89,7 +89,7 @@ main() {
|
||||||
|
|
||||||
test('or clause', () async {
|
test('or clause', () async {
|
||||||
var query = new CarQuery()
|
var query = new CarQuery()
|
||||||
..where.make.like('Fer%')
|
..where.make.like((_) => 'Fer%')
|
||||||
..orWhere((where) => where
|
..orWhere((where) => where
|
||||||
..familyFriendly.isTrue
|
..familyFriendly.isTrue
|
||||||
..make.equals('Honda'));
|
..make.equals('Honda'));
|
||||||
|
|
Loading…
Reference in a new issue