mirror of https://github.com/AMT-Cheif/drift.git
Delete old example file
This commit is contained in:
parent
2713b3fc2a
commit
61ab4aaa24
|
@ -2,7 +2,6 @@
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ProjectModuleManager">
|
<component name="ProjectModuleManager">
|
||||||
<modules>
|
<modules>
|
||||||
<module fileurl="file://$PROJECT_DIR$/example/example.iml" filepath="$PROJECT_DIR$/example/example.iml" />
|
|
||||||
<module fileurl="file://$PROJECT_DIR$/sally/sally.iml" filepath="$PROJECT_DIR$/sally/sally.iml" />
|
<module fileurl="file://$PROJECT_DIR$/sally/sally.iml" filepath="$PROJECT_DIR$/sally/sally.iml" />
|
||||||
<module fileurl="file://$PROJECT_DIR$/sally_generator/sally_generator.iml" filepath="$PROJECT_DIR$/sally_generator/sally_generator.iml" />
|
<module fileurl="file://$PROJECT_DIR$/sally_generator/sally_generator.iml" filepath="$PROJECT_DIR$/sally_generator/sally_generator.iml" />
|
||||||
</modules>
|
</modules>
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
sqflite=/home/simon/Android/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.1.0/
|
|
|
@ -1,107 +0,0 @@
|
||||||
|
|
||||||
# Created by https://www.gitignore.io/api/dart,intellij
|
|
||||||
# Edit at https://www.gitignore.io/?templates=dart,intellij
|
|
||||||
|
|
||||||
### Dart ###
|
|
||||||
# See https://www.dartlang.org/guides/libraries/private-files
|
|
||||||
|
|
||||||
# Files and directories created by pub
|
|
||||||
.dart_tool/
|
|
||||||
.packages
|
|
||||||
build/
|
|
||||||
# If you're building an application, you may want to check-in your pubspec.lock
|
|
||||||
pubspec.lock
|
|
||||||
|
|
||||||
# Directory created by dartdoc
|
|
||||||
# If you don't generate documentation locally you can remove this line.
|
|
||||||
doc/api/
|
|
||||||
|
|
||||||
# Avoid committing generated Javascript files:
|
|
||||||
*.dart.js
|
|
||||||
*.info.json # Produced by the --dump-info flag.
|
|
||||||
*.js # When generated by dart2js. Don't specify *.js if your
|
|
||||||
# project includes source files written in JavaScript.
|
|
||||||
*.js_
|
|
||||||
*.js.deps
|
|
||||||
*.js.map
|
|
||||||
|
|
||||||
### Intellij ###
|
|
||||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
|
|
||||||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
|
||||||
|
|
||||||
# User-specific stuff
|
|
||||||
.idea/**/workspace.xml
|
|
||||||
.idea/**/tasks.xml
|
|
||||||
.idea/**/usage.statistics.xml
|
|
||||||
.idea/**/dictionaries
|
|
||||||
.idea/**/shelf
|
|
||||||
|
|
||||||
# Generated files
|
|
||||||
.idea/**/contentModel.xml
|
|
||||||
|
|
||||||
# Sensitive or high-churn files
|
|
||||||
.idea/**/dataSources/
|
|
||||||
.idea/**/dataSources.ids
|
|
||||||
.idea/**/dataSources.local.xml
|
|
||||||
.idea/**/sqlDataSources.xml
|
|
||||||
.idea/**/dynamic.xml
|
|
||||||
.idea/**/uiDesigner.xml
|
|
||||||
.idea/**/dbnavigator.xml
|
|
||||||
|
|
||||||
# Gradle
|
|
||||||
.idea/**/gradle.xml
|
|
||||||
.idea/**/libraries
|
|
||||||
|
|
||||||
# Gradle and Maven with auto-import
|
|
||||||
# When using Gradle or Maven with auto-import, you should exclude module files,
|
|
||||||
# since they will be recreated, and may cause churn. Uncomment if using
|
|
||||||
# auto-import.
|
|
||||||
# .idea/modules.xml
|
|
||||||
# .idea/*.iml
|
|
||||||
# .idea/modules
|
|
||||||
|
|
||||||
# CMake
|
|
||||||
cmake-build-*/
|
|
||||||
|
|
||||||
# Mongo Explorer plugin
|
|
||||||
.idea/**/mongoSettings.xml
|
|
||||||
|
|
||||||
# File-based project format
|
|
||||||
*.iws
|
|
||||||
|
|
||||||
# IntelliJ
|
|
||||||
out/
|
|
||||||
|
|
||||||
# mpeltonen/sbt-idea plugin
|
|
||||||
.idea_modules/
|
|
||||||
|
|
||||||
# JIRA plugin
|
|
||||||
atlassian-ide-plugin.xml
|
|
||||||
|
|
||||||
# Cursive Clojure plugin
|
|
||||||
.idea/replstate.xml
|
|
||||||
|
|
||||||
# Crashlytics plugin (for Android Studio and IntelliJ)
|
|
||||||
com_crashlytics_export_strings.xml
|
|
||||||
crashlytics.properties
|
|
||||||
crashlytics-build.properties
|
|
||||||
fabric.properties
|
|
||||||
|
|
||||||
# Editor-based Rest Client
|
|
||||||
.idea/httpRequests
|
|
||||||
|
|
||||||
# Android studio 3.1+ serialized cache file
|
|
||||||
.idea/caches/build_file_checksums.ser
|
|
||||||
|
|
||||||
### Intellij Patch ###
|
|
||||||
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
|
|
||||||
|
|
||||||
# *.iml
|
|
||||||
# modules.xml
|
|
||||||
# .idea/misc.xml
|
|
||||||
# *.ipr
|
|
||||||
|
|
||||||
# Sonarlint plugin
|
|
||||||
.idea/sonarlint
|
|
||||||
|
|
||||||
# End of https://www.gitignore.io/api/dart,intellij
|
|
|
@ -1,3 +0,0 @@
|
||||||
## 1.0.0
|
|
||||||
|
|
||||||
- Initial version, created by Stagehand
|
|
|
@ -1,21 +0,0 @@
|
||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2019 Simon Binder
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
|
@ -1,4 +0,0 @@
|
||||||
A sample command-line application.
|
|
||||||
|
|
||||||
Created from templates made available by Stagehand under a BSD-style
|
|
||||||
[license](https://github.com/dart-lang/stagehand/blob/master/LICENSE).
|
|
|
@ -1,25 +0,0 @@
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,14 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<module type="WEB_MODULE" version="4">
|
|
||||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
|
||||||
<exclude-output />
|
|
||||||
<content url="file://$MODULE_DIR$">
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/.dart_tool" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/.pub" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build" />
|
|
||||||
</content>
|
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
|
||||||
<orderEntry type="library" name="Dart SDK" level="project" />
|
|
||||||
<orderEntry type="library" name="Dart Packages" level="project" />
|
|
||||||
</component>
|
|
||||||
</module>
|
|
|
@ -1,14 +0,0 @@
|
||||||
//
|
|
||||||
// Generated file. Do not edit.
|
|
||||||
//
|
|
||||||
|
|
||||||
#ifndef GeneratedPluginRegistrant_h
|
|
||||||
#define GeneratedPluginRegistrant_h
|
|
||||||
|
|
||||||
#import <Flutter/Flutter.h>
|
|
||||||
|
|
||||||
@interface GeneratedPluginRegistrant : NSObject
|
|
||||||
+ (void)registerWithRegistry:(NSObject<FlutterPluginRegistry>*)registry;
|
|
||||||
@end
|
|
||||||
|
|
||||||
#endif /* GeneratedPluginRegistrant_h */
|
|
|
@ -1,14 +0,0 @@
|
||||||
//
|
|
||||||
// Generated file. Do not edit.
|
|
||||||
//
|
|
||||||
|
|
||||||
#import "GeneratedPluginRegistrant.h"
|
|
||||||
#import <sqflite/SqflitePlugin.h>
|
|
||||||
|
|
||||||
@implementation GeneratedPluginRegistrant
|
|
||||||
|
|
||||||
+ (void)registerWithRegistry:(NSObject<FlutterPluginRegistry>*)registry {
|
|
||||||
[SqflitePlugin registerWithRegistrar:[registry registrarForPlugin:@"SqflitePlugin"]];
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
|
@ -1,36 +0,0 @@
|
||||||
import 'package:sally/sally.dart';
|
|
||||||
|
|
||||||
part 'example.g.dart';
|
|
||||||
|
|
||||||
class Products extends Table {
|
|
||||||
IntColumn get id => integer().named('products_id').autoIncrement()();
|
|
||||||
TextColumn get name => text()();
|
|
||||||
}
|
|
||||||
|
|
||||||
class Users extends Table {
|
|
||||||
IntColumn get id => integer().autoIncrement()();
|
|
||||||
TextColumn get name => text().withLength(min: 6, max: 32)();
|
|
||||||
}
|
|
||||||
|
|
||||||
@DataClassName('TodoEntry')
|
|
||||||
class Todos extends Table {
|
|
||||||
|
|
||||||
IntColumn get id => integer().autoIncrement()();
|
|
||||||
TextColumn get name => text().withLength(min: 6, max: 10)();
|
|
||||||
TextColumn get content => text().named('body')();
|
|
||||||
}
|
|
||||||
|
|
||||||
@UseSally(tables: [Products, Users, Todos])
|
|
||||||
class ShopDb extends _$ShopDb {
|
|
||||||
Future<List<User>> allUsers() => select(users).get();
|
|
||||||
Future<List<User>> userByName(String name) =>
|
|
||||||
(select(users)..where((u) => u.name.equals(name))).get();
|
|
||||||
|
|
||||||
Future<void> deleteUser(User user) =>
|
|
||||||
(delete(users)..where((u) => u.id.equals(user.id))).go();
|
|
||||||
|
|
||||||
@override
|
|
||||||
MigrationStrategy get migration => MigrationStrategy();
|
|
||||||
@override
|
|
||||||
int get schemaVersion => 1;
|
|
||||||
}
|
|
|
@ -1,183 +0,0 @@
|
||||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
|
||||||
|
|
||||||
part of 'example.dart';
|
|
||||||
|
|
||||||
// **************************************************************************
|
|
||||||
// SallyGenerator
|
|
||||||
// **************************************************************************
|
|
||||||
|
|
||||||
class Product {
|
|
||||||
final int id;
|
|
||||||
final String name;
|
|
||||||
Product({this.id, this.name});
|
|
||||||
@override
|
|
||||||
int get hashCode => (id.hashCode) * 31 + name.hashCode;
|
|
||||||
@override
|
|
||||||
bool operator ==(other) =>
|
|
||||||
identical(this, other) ||
|
|
||||||
(other is Product && other.id == id && other.name == name);
|
|
||||||
}
|
|
||||||
|
|
||||||
class _$ProductsTable extends Products implements TableInfo<Products, Product> {
|
|
||||||
final GeneratedDatabase db;
|
|
||||||
_$ProductsTable(this.db);
|
|
||||||
@override
|
|
||||||
GeneratedIntColumn get id => GeneratedIntColumn('products_id', false);
|
|
||||||
@override
|
|
||||||
GeneratedTextColumn get name => GeneratedTextColumn('name', false);
|
|
||||||
@override
|
|
||||||
List<GeneratedColumn> get $columns => [id, name];
|
|
||||||
@override
|
|
||||||
Products get asDslTable => this;
|
|
||||||
@override
|
|
||||||
String get $tableName => 'products';
|
|
||||||
@override
|
|
||||||
void validateIntegrity(Product instance, bool isInserting) => null;
|
|
||||||
@override
|
|
||||||
Set<GeneratedColumn> get $primaryKey => Set();
|
|
||||||
@override
|
|
||||||
Product map(Map<String, dynamic> data) {
|
|
||||||
final intType = db.typeSystem.forDartType<int>();
|
|
||||||
final stringType = db.typeSystem.forDartType<String>();
|
|
||||||
return Product(
|
|
||||||
id: intType.mapFromDatabaseResponse(data['products_id']),
|
|
||||||
name: stringType.mapFromDatabaseResponse(data['name']),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Map<String, Variable> entityToSql(Product d) {
|
|
||||||
final map = <String, Variable>{};
|
|
||||||
if (d.id != null) {
|
|
||||||
map['products_id'] = Variable<int, IntType>(d.id);
|
|
||||||
}
|
|
||||||
if (d.name != null) {
|
|
||||||
map['name'] = Variable<String, StringType>(d.name);
|
|
||||||
}
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class User {
|
|
||||||
final int id;
|
|
||||||
final String name;
|
|
||||||
User({this.id, this.name});
|
|
||||||
@override
|
|
||||||
int get hashCode => (id.hashCode) * 31 + name.hashCode;
|
|
||||||
@override
|
|
||||||
bool operator ==(other) =>
|
|
||||||
identical(this, other) ||
|
|
||||||
(other is User && other.id == id && other.name == name);
|
|
||||||
}
|
|
||||||
|
|
||||||
class _$UsersTable extends Users implements TableInfo<Users, User> {
|
|
||||||
final GeneratedDatabase db;
|
|
||||||
_$UsersTable(this.db);
|
|
||||||
@override
|
|
||||||
GeneratedIntColumn get id => GeneratedIntColumn('id', false);
|
|
||||||
@override
|
|
||||||
GeneratedTextColumn get name => GeneratedTextColumn('name', false);
|
|
||||||
@override
|
|
||||||
List<GeneratedColumn> get $columns => [id, name];
|
|
||||||
@override
|
|
||||||
Users get asDslTable => this;
|
|
||||||
@override
|
|
||||||
String get $tableName => 'users';
|
|
||||||
@override
|
|
||||||
void validateIntegrity(User instance, bool isInserting) => null;
|
|
||||||
@override
|
|
||||||
Set<GeneratedColumn> get $primaryKey => Set();
|
|
||||||
@override
|
|
||||||
User map(Map<String, dynamic> data) {
|
|
||||||
final intType = db.typeSystem.forDartType<int>();
|
|
||||||
final stringType = db.typeSystem.forDartType<String>();
|
|
||||||
return User(
|
|
||||||
id: intType.mapFromDatabaseResponse(data['id']),
|
|
||||||
name: stringType.mapFromDatabaseResponse(data['name']),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Map<String, Variable> entityToSql(User d) {
|
|
||||||
final map = <String, Variable>{};
|
|
||||||
if (d.id != null) {
|
|
||||||
map['id'] = Variable<int, IntType>(d.id);
|
|
||||||
}
|
|
||||||
if (d.name != null) {
|
|
||||||
map['name'] = Variable<String, StringType>(d.name);
|
|
||||||
}
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class TodoEntry {
|
|
||||||
final int id;
|
|
||||||
final String name;
|
|
||||||
final String content;
|
|
||||||
TodoEntry({this.id, this.name, this.content});
|
|
||||||
@override
|
|
||||||
int get hashCode =>
|
|
||||||
((id.hashCode) * 31 + name.hashCode) * 31 + content.hashCode;
|
|
||||||
@override
|
|
||||||
bool operator ==(other) =>
|
|
||||||
identical(this, other) ||
|
|
||||||
(other is TodoEntry &&
|
|
||||||
other.id == id &&
|
|
||||||
other.name == name &&
|
|
||||||
other.content == content);
|
|
||||||
}
|
|
||||||
|
|
||||||
class _$TodosTable extends Todos implements TableInfo<Todos, TodoEntry> {
|
|
||||||
final GeneratedDatabase db;
|
|
||||||
_$TodosTable(this.db);
|
|
||||||
@override
|
|
||||||
GeneratedIntColumn get id => GeneratedIntColumn('id', false);
|
|
||||||
@override
|
|
||||||
GeneratedTextColumn get name => GeneratedTextColumn('name', false);
|
|
||||||
@override
|
|
||||||
GeneratedTextColumn get content => GeneratedTextColumn('body', false);
|
|
||||||
@override
|
|
||||||
List<GeneratedColumn> get $columns => [id, name, content];
|
|
||||||
@override
|
|
||||||
Todos get asDslTable => this;
|
|
||||||
@override
|
|
||||||
String get $tableName => 'todos';
|
|
||||||
@override
|
|
||||||
void validateIntegrity(TodoEntry instance, bool isInserting) => null;
|
|
||||||
@override
|
|
||||||
Set<GeneratedColumn> get $primaryKey => Set();
|
|
||||||
@override
|
|
||||||
TodoEntry map(Map<String, dynamic> data) {
|
|
||||||
final intType = db.typeSystem.forDartType<int>();
|
|
||||||
final stringType = db.typeSystem.forDartType<String>();
|
|
||||||
return TodoEntry(
|
|
||||||
id: intType.mapFromDatabaseResponse(data['id']),
|
|
||||||
name: stringType.mapFromDatabaseResponse(data['name']),
|
|
||||||
content: stringType.mapFromDatabaseResponse(data['body']),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Map<String, Variable> entityToSql(TodoEntry d) {
|
|
||||||
final map = <String, Variable>{};
|
|
||||||
if (d.id != null) {
|
|
||||||
map['id'] = Variable<int, IntType>(d.id);
|
|
||||||
}
|
|
||||||
if (d.name != null) {
|
|
||||||
map['name'] = Variable<String, StringType>(d.name);
|
|
||||||
}
|
|
||||||
if (d.content != null) {
|
|
||||||
map['body'] = Variable<String, StringType>(d.content);
|
|
||||||
}
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract class _$ShopDb extends GeneratedDatabase {
|
|
||||||
_$ShopDb() : super(const SqlTypeSystem.withDefaults(), null);
|
|
||||||
_$ProductsTable get products => _$ProductsTable(this);
|
|
||||||
_$UsersTable get users => _$UsersTable(this);
|
|
||||||
_$TodosTable get todos => _$TodosTable(this);
|
|
||||||
@override
|
|
||||||
List<TableInfo> get allTables => [products, users, todos];
|
|
||||||
}
|
|
|
@ -1,19 +0,0 @@
|
||||||
name: example
|
|
||||||
description: A sample command-line application.
|
|
||||||
# version: 1.0.0
|
|
||||||
# homepage: https://www.example.com
|
|
||||||
# author: simon <email@example.com>
|
|
||||||
|
|
||||||
environment:
|
|
||||||
sdk: '>=2.0.0 <3.0.0'
|
|
||||||
|
|
||||||
dependencies:
|
|
||||||
sally:
|
|
||||||
path: ../sally
|
|
||||||
|
|
||||||
dev_dependencies:
|
|
||||||
sally_generator:
|
|
||||||
path: ../sally_generator
|
|
||||||
build_runner:
|
|
||||||
pedantic: ^1.0.0
|
|
||||||
test: ^1.0.0
|
|
|
@ -16,7 +16,7 @@ class DatabaseWriter {
|
||||||
// Write the database class
|
// Write the database class
|
||||||
final className = '_\$${db.fromClass.name}';
|
final className = '_\$${db.fromClass.name}';
|
||||||
buffer.write('abstract class $className extends GeneratedDatabase {\n'
|
buffer.write('abstract class $className extends GeneratedDatabase {\n'
|
||||||
'$className() : super(const SqlTypeSystem.withDefaults(), null); \n');
|
'$className(QueryExecutor e) : super(const SqlTypeSystem.withDefaults(), e); \n');
|
||||||
|
|
||||||
final tableGetters = <String>[];
|
final tableGetters = <String>[];
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue