Remove flutter component from main sally library

This commit is contained in:
Simon Binder 2019-02-10 14:23:48 +01:00
parent 93ed36d157
commit b6b4f2abfc
25 changed files with 641 additions and 39 deletions

View File

@ -2,10 +2,25 @@
<library name="Dart Packages" type="DartPackagesLibraryType">
<properties>
<option name="packageNameToDirsMap">
<entry key="analyzer">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/analyzer-0.35.0/lib" />
</list>
</value>
</entry>
<entry key="args">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/args-1.5.1/lib" />
</list>
</value>
</entry>
<entry key="async">
<value>
<list>
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/async-2.0.8/lib" />
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/async-2.0.8/lib" />
</list>
</value>
</entry>
@ -13,6 +28,7 @@
<value>
<list>
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/boolean_selector-1.0.4/lib" />
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/boolean_selector-1.0.4/lib" />
</list>
</value>
</entry>
@ -20,6 +36,7 @@
<value>
<list>
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/charcode-1.1.2/lib" />
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/charcode-1.1.2/lib" />
</list>
</value>
</entry>
@ -27,6 +44,28 @@
<value>
<list>
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/collection-1.14.11/lib" />
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/collection-1.14.11/lib" />
</list>
</value>
</entry>
<entry key="convert">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/convert-2.1.1/lib" />
</list>
</value>
</entry>
<entry key="crypto">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/crypto-2.0.6/lib" />
</list>
</value>
</entry>
<entry key="csslib">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/csslib-0.14.6/lib" />
</list>
</value>
</entry>
@ -44,10 +83,88 @@
</list>
</value>
</entry>
<entry key="front_end">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/front_end-0.1.10/lib" />
</list>
</value>
</entry>
<entry key="glob">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/glob-1.1.7/lib" />
</list>
</value>
</entry>
<entry key="html">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/html-0.13.3+3/lib" />
</list>
</value>
</entry>
<entry key="http">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/http-0.12.0+1/lib" />
</list>
</value>
</entry>
<entry key="http_multi_server">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/http_multi_server-2.0.5/lib" />
</list>
</value>
</entry>
<entry key="http_parser">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/http_parser-3.1.3/lib" />
</list>
</value>
</entry>
<entry key="io">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/io-0.3.3/lib" />
</list>
</value>
</entry>
<entry key="js">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/js-0.6.1+1/lib" />
</list>
</value>
</entry>
<entry key="json_rpc_2">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/json_rpc_2-2.0.9/lib" />
</list>
</value>
</entry>
<entry key="kernel">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/kernel-0.3.10/lib" />
</list>
</value>
</entry>
<entry key="logging">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/logging-0.11.3+2/lib" />
</list>
</value>
</entry>
<entry key="matcher">
<value>
<list>
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/matcher-0.12.3+1/lib" />
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/matcher-0.12.3+1/lib" />
</list>
</value>
</entry>
@ -55,13 +172,49 @@
<value>
<list>
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/meta-1.1.6/lib" />
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/meta-1.1.7/lib" />
</list>
</value>
</entry>
<entry key="mime">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/mime-0.9.6+2/lib" />
</list>
</value>
</entry>
<entry key="mockito">
<value>
<list>
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/mockito-4.0.0/lib" />
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/mockito-4.0.0/lib" />
</list>
</value>
</entry>
<entry key="multi_server_socket">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/multi_server_socket-1.0.2/lib" />
</list>
</value>
</entry>
<entry key="node_preamble">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/node_preamble-1.4.4/lib" />
</list>
</value>
</entry>
<entry key="package_config">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/package_config-1.0.5/lib" />
</list>
</value>
</entry>
<entry key="package_resolver">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/package_resolver-1.0.6/lib" />
</list>
</value>
</entry>
@ -69,6 +222,35 @@
<value>
<list>
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/path-1.6.2/lib" />
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/path-1.6.2/lib" />
</list>
</value>
</entry>
<entry key="pedantic">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/pedantic-1.4.0/lib" />
</list>
</value>
</entry>
<entry key="plugin">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/plugin-0.2.0+3/lib" />
</list>
</value>
</entry>
<entry key="pool">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/pool-1.4.0/lib" />
</list>
</value>
</entry>
<entry key="pub_semver">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/pub_semver-1.4.2/lib" />
</list>
</value>
</entry>
@ -79,6 +261,34 @@
</list>
</value>
</entry>
<entry key="shelf">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/shelf-0.7.4/lib" />
</list>
</value>
</entry>
<entry key="shelf_packages_handler">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/shelf_packages_handler-1.0.4/lib" />
</list>
</value>
</entry>
<entry key="shelf_static">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/shelf_static-0.2.8/lib" />
</list>
</value>
</entry>
<entry key="shelf_web_socket">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/shelf_web_socket-0.2.2+4/lib" />
</list>
</value>
</entry>
<entry key="sky_engine">
<value>
<list>
@ -86,10 +296,25 @@
</list>
</value>
</entry>
<entry key="source_map_stack_trace">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/source_map_stack_trace-1.1.5/lib" />
</list>
</value>
</entry>
<entry key="source_maps">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/source_maps-0.10.8/lib" />
</list>
</value>
</entry>
<entry key="source_span">
<value>
<list>
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/source_span-1.4.1/lib" />
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/source_span-1.5.4/lib" />
</list>
</value>
</entry>
@ -104,6 +329,7 @@
<value>
<list>
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/stack_trace-1.9.3/lib" />
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/stack_trace-1.9.3/lib" />
</list>
</value>
</entry>
@ -111,6 +337,7 @@
<value>
<list>
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/stream_channel-1.6.8/lib" />
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/stream_channel-1.6.8/lib" />
</list>
</value>
</entry>
@ -118,6 +345,7 @@
<value>
<list>
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/string_scanner-1.0.4/lib" />
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/string_scanner-1.0.4/lib" />
</list>
</value>
</entry>
@ -132,6 +360,14 @@
<value>
<list>
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/term_glyph-1.0.1/lib" />
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/term_glyph-1.1.0/lib" />
</list>
</value>
</entry>
<entry key="test">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/test-1.5.3/lib" />
</list>
</value>
</entry>
@ -139,6 +375,14 @@
<value>
<list>
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/test_api-0.2.1/lib" />
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/test_api-0.2.2/lib" />
</list>
</value>
</entry>
<entry key="test_core">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/test_core-0.2.1+1/lib" />
</list>
</value>
</entry>
@ -146,6 +390,14 @@
<value>
<list>
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/typed_data-1.1.6/lib" />
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/typed_data-1.1.6/lib" />
</list>
</value>
</entry>
<entry key="utf">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/utf-0.9.0+5/lib" />
</list>
</value>
</entry>
@ -156,16 +408,96 @@
</list>
</value>
</entry>
<entry key="vm_service_client">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/vm_service_client-0.2.6/lib" />
</list>
</value>
</entry>
<entry key="watcher">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/watcher-0.9.7+10/lib" />
</list>
</value>
</entry>
<entry key="web_socket_channel">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/web_socket_channel-1.0.9/lib" />
</list>
</value>
</entry>
<entry key="yaml">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/yaml-2.1.15/lib" />
</list>
</value>
</entry>
</option>
</properties>
<CLASSES>
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/analyzer-0.35.0/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/args-1.5.1/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/async-2.0.8/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/boolean_selector-1.0.4/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/charcode-1.1.2/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/collection-1.14.11/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/convert-2.1.1/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/crypto-2.0.6/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/csslib-0.14.6/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/front_end-0.1.10/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/glob-1.1.7/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/html-0.13.3+3/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/http-0.12.0+1/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/http_multi_server-2.0.5/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/http_parser-3.1.3/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/io-0.3.3/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/js-0.6.1+1/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/json_rpc_2-2.0.9/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/kernel-0.3.10/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/logging-0.11.3+2/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/matcher-0.12.3+1/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/meta-1.1.7/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/mime-0.9.6+2/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/mockito-4.0.0/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/multi_server_socket-1.0.2/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/node_preamble-1.4.4/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/package_config-1.0.5/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/package_resolver-1.0.6/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/path-1.6.2/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/pedantic-1.4.0/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/plugin-0.2.0+3/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/pool-1.4.0/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/pub_semver-1.4.2/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/shelf-0.7.4/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/shelf_packages_handler-1.0.4/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/shelf_static-0.2.8/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/shelf_web_socket-0.2.2+4/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/source_map_stack_trace-1.1.5/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/source_maps-0.10.8/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/source_span-1.5.4/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/stack_trace-1.9.3/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/stream_channel-1.6.8/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/string_scanner-1.0.4/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/term_glyph-1.1.0/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/test-1.5.3/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/test_api-0.2.2/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/test_core-0.2.1+1/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/typed_data-1.1.6/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/utf-0.9.0+5/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/vm_service_client-0.2.6/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/watcher-0.9.7+10/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/web_socket_channel-1.0.9/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/yaml-2.1.15/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/async-2.0.8/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/boolean_selector-1.0.4/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/charcode-1.1.2/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/collection-1.14.11/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/matcher-0.12.3+1/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/meta-1.1.6/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/mockito-4.0.0/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/path-1.6.2/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/quiver-2.0.1/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/source_span-1.4.1/lib" />

View File

@ -3,6 +3,7 @@
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/sally/sally.iml" filepath="$PROJECT_DIR$/sally/sally.iml" />
<module fileurl="file://$PROJECT_DIR$/sally_flutter/sally_flutter.iml" filepath="$PROJECT_DIR$/sally_flutter/sally_flutter.iml" />
<module fileurl="file://$PROJECT_DIR$/sally_generator/sally_generator.iml" filepath="$PROJECT_DIR$/sally_generator/sally_generator.iml" />
</modules>
</component>

View File

@ -32,11 +32,9 @@ class PrimaryKey {}
/// used.
/// {@template}
class DataClassName {
final String name;
/// Customize the data class name for a given table.
/// {@macro sally:custom_data_class}
const DataClassName(this.name);
}

View File

@ -1,8 +1,6 @@
/// Throws when one attempts to insert or update invalid data into a table.
class InvalidDataException implements Exception {
final String message;
InvalidDataException(this.message);
}
}

View File

@ -34,7 +34,7 @@ abstract class GeneratedDatabase {
}
InsertStatement<T> into<T>(TableInfo<dynamic, T> table) =>
InsertStatement<T>(this, table);
InsertStatement<T>(this, table);
SelectStatement<Table, ReturnType> select<Table, ReturnType>(
TableInfo<Table, ReturnType> table) {

View File

@ -1,2 +1,2 @@
export 'bools.dart' show and, or, not;
export 'variables.dart';
export 'variables.dart';

View File

@ -3,7 +3,6 @@ import 'package:sally/sally.dart';
import 'package:sally/src/runtime/components/component.dart';
class InsertStatement<DataClass> {
@protected
final GeneratedDatabase database;
@protected
@ -14,18 +13,17 @@ class InsertStatement<DataClass> {
Future<void> insert(DataClass entity) async {
table.validateIntegrity(entity, true);
final map = table
.entityToSql(entity)
..removeWhere((_, value) => value == null);
final map = table.entityToSql(entity)
..removeWhere((_, value) => value == null);
final ctx = GenerationContext(database);
ctx.buffer
..write('INSERT INTO ')
..write(table.$tableName)
..write(' (')
..write(map.keys.join(', '))
..write(') ')
..write('VALUES (');
..write('INSERT INTO ')
..write(table.$tableName)
..write(' (')
..write(map.keys.join(', '))
..write(') ')
..write('VALUES (');
var first = true;
for (var variable in map.values) {
@ -44,4 +42,4 @@ class InsertStatement<DataClass> {
// TODO insert multiple values
}
}

View File

@ -18,6 +18,7 @@ abstract class TableInfo<TableDsl, DataClass> {
/// During insertion mode, fields that have a default value or are
/// auto-incrementing are allowed to be null as they will be set by sqlite.
void validateIntegrity(DataClass instance, bool isInserting) => null;
/// Maps the given data class into a map that can be inserted into sql. The
/// keys should represent the column name in sql, the values the corresponding
/// values of the field.

View File

@ -9,11 +9,7 @@ environment:
dependencies:
meta: '>= 1.0.0 <2.0.0'
sqflite: ^1.1.0
flutter:
sdk: flutter
dev_dependencies:
flutter_test:
sdk: flutter
test:
mockito: ^4.0.0

View File

@ -38,6 +38,7 @@ class GeneratedUsersTable extends Users with TableInfo<Users, UserDataObject> {
UserDataObject map(Map<String, dynamic> data) {
return null;
}
@override
Map<String, Variable> entityToSql(UserDataObject d) {
final map = <String, Variable>{};

View File

@ -25,7 +25,8 @@ void main() {
test('generates CREATE TABLE statements', () {
migrator.createAllTables();
verify(executor.call('CREATE TABLE IF NOT EXISTS users (id INTEGER NOT NULL , name VARCHAR NOT NULL , is_awesome BOOLEAN NULL CHECK (is_awesome in (0, 1)))'));
verify(executor.call(
'CREATE TABLE IF NOT EXISTS users (id INTEGER NOT NULL , name VARCHAR NOT NULL , is_awesome BOOLEAN NULL CHECK (is_awesome in (0, 1)))'));
});
test('generates DROP TABLE statements', () {
@ -37,6 +38,7 @@ void main() {
test('generates ALTER TABLE statements to add columns', () {
migrator.addColumn(db.users, db.users.isAwesome);
verify(executor.call('ALTER TABLE users ADD COLUMN is_awesome BOOLEAN NULL CHECK (is_awesome in (0, 1))'));
verify(executor.call(
'ALTER TABLE users ADD COLUMN is_awesome BOOLEAN NULL CHECK (is_awesome in (0, 1))'));
});
}
}

View File

@ -77,7 +77,8 @@ void main() {
test('with full data', () {
db.into(db.users).insert(UserDataObject(10, 'User'));
verify(executor.runInsert('INSERT INTO users (id, name) VALUES (?, ?)', [10, 'User']));
verify(executor.runInsert(
'INSERT INTO users (id, name) VALUES (?, ?)', [10, 'User']));
});
});
}

View File

@ -0,0 +1 @@
sqflite=/home/simon/Android/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.1.0/

10
sally_flutter/.gitignore vendored Normal file
View File

@ -0,0 +1,10 @@
.DS_Store
.dart_tool/
.packages
.pub/
build/
ios/.generated/
ios/Flutter/Generated.xcconfig
ios/Runner/GeneratedPluginRegistrant.*

10
sally_flutter/.metadata Normal file
View File

@ -0,0 +1,10 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.
version:
revision: 5391447fae6209bb21a89e6a5a6583cac1af9b4b
channel: stable
project_type: package

View File

@ -0,0 +1,3 @@
## [0.0.1] - TODO: Add release date.
* TODO: Describe initial release.

1
sally_flutter/LICENSE Normal file
View File

@ -0,0 +1 @@
TODO: Add your license here.

14
sally_flutter/README.md Normal file
View File

@ -0,0 +1,14 @@
# sally_flutter
Flutter implementation for the sally database
## Getting Started
This project is a starting point for a Dart
[package](https://flutter.io/developing-packages/),
a library module containing code that can be shared easily across
multiple Flutter or Dart projects.
For help getting started with Flutter, view our
[online documentation](https://flutter.io/docs), which offers tutorials,
samples, guidance on mobile development, and a full API reference.

View File

@ -0,0 +1,25 @@
package io.flutter.plugins;
import io.flutter.plugin.common.PluginRegistry;
import com.tekartik.sqflite.SqflitePlugin;
/**
* Generated file. Do not edit.
*/
public final class GeneratedPluginRegistrant {
public static void registerWith(PluginRegistry registry) {
if (alreadyRegisteredWith(registry)) {
return;
}
SqflitePlugin.registerWith(registry.registrarFor("com.tekartik.sqflite.SqflitePlugin"));
}
private static boolean alreadyRegisteredWith(PluginRegistry registry) {
final String key = GeneratedPluginRegistrant.class.getCanonicalName();
if (registry.hasPlugin(key)) {
return true;
}
registry.registrarFor(key);
return false;
}
}

View File

@ -9,6 +9,8 @@ import 'package:path/path.dart';
import 'package:sally/sally.dart';
import 'package:sqflite/sqflite.dart';
export 'package:sally/sally.dart';
/// A query executor that uses sqlfite internally.
class FlutterQueryExecutor extends QueryExecutor {
final bool _inDbPath;

153
sally_flutter/pubspec.lock Normal file
View File

@ -0,0 +1,153 @@
# Generated by pub
# See https://www.dartlang.org/tools/pub/glossary#lockfile
packages:
async:
dependency: transitive
description:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.8"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.4"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.2"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.14.11"
flutter:
dependency: "direct main"
description: flutter
source: sdk
version: "0.0.0"
flutter_test:
dependency: "direct dev"
description: flutter
source: sdk
version: "0.0.0"
matcher:
dependency: transitive
description:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.3+1"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.6"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.2"
quiver:
dependency: transitive
description:
name: quiver
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
sally:
dependency: "direct main"
description:
path: "../sally"
relative: true
source: path
version: "0.0.0"
sky_engine:
dependency: transitive
description: flutter
source: sdk
version: "0.0.99"
source_span:
dependency: transitive
description:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.4.1"
sqflite:
dependency: "direct main"
description:
name: sqflite
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.3"
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.8"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.4"
synchronized:
dependency: transitive
description:
name: synchronized
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.3+2"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.1"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.6"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.8"
sdks:
dart: ">=2.0.0 <3.0.0"

View File

@ -0,0 +1,56 @@
name: sally_flutter
description: Flutter implementation for the sally database
version: 0.0.1
author:
homepage:
environment:
sdk: ">=2.0.0-dev.68.0 <3.0.0"
dependencies:
sally:
path: ../sally
sqflite:
flutter:
sdk: flutter
dev_dependencies:
flutter_test:
sdk: flutter
# For information on the generic Dart part of this file, see the
# following page: https://www.dartlang.org/tools/pub/pubspec
# The following section is specific to Flutter.
flutter:
# To add assets to your package, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
#
# For details regarding assets in packages, see
# https://flutter.io/assets-and-images/#from-packages
#
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.io/assets-and-images/#resolution-aware.
# To add custom fonts to your package, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts in packages, see
# https://flutter.io/custom-fonts/#from-packages

View File

@ -57,10 +57,10 @@ class SpecifiedColumn {
}[type];
String get sqlTypeName => {
ColumnType.boolean: 'BoolType',
ColumnType.text: 'StringType',
ColumnType.integer: 'IntType'
}[type];
ColumnType.boolean: 'BoolType',
ColumnType.text: 'StringType',
ColumnType.integer: 'IntType'
}[type];
const SpecifiedColumn(
{this.type,

View File

@ -30,10 +30,7 @@ class TableParser extends ParserBase {
if (nameAnnotation == null) {
return dataClassNameForClassName(element.name);
} else {
return nameAnnotation
.constantValue
.getField('name')
.toStringValue();
return nameAnnotation.constantValue.getField('name').toStringValue();
}
}

View File

@ -49,7 +49,8 @@ class TableWriter {
'@override\nList<GeneratedColumn> get \$columns => [$columnsWithGetters];\n')
..write('@override\n$tableDslName get asDslTable => this;\n')
..write('@override\nString get \$tableName => \'${table.sqlName}\';\n')
..write('@override\nvoid validateIntegrity($dataClass instance, bool isInserting) => null;');
..write(
'@override\nvoid validateIntegrity($dataClass instance, bool isInserting) => null;');
// todo replace set syntax with literal once dart supports it
// write primary key getter: Set<Column> get $primaryKey => Set().add(id);
@ -104,7 +105,8 @@ class TableWriter {
void _writeReverseMappingMethod(StringBuffer buffer) {
// Map<String, Variable> entityToSql(User d) {
buffer
..write('@override\nMap<String, Variable> entityToSql(${table.dartTypeName} d) {\n')
..write(
'@override\nMap<String, Variable> entityToSql(${table.dartTypeName} d) {\n')
..write('final map = <String, Variable> {};');
for (var column in table.columns) {