diff --git a/docs/changelog.md b/docs/changelog.md new file mode 100644 index 00000000..262fa090 --- /dev/null +++ b/docs/changelog.md @@ -0,0 +1,259 @@ +# Changelog + +## 0.18.0 + +* Documentation update on DateTimeConverter sample +* Change ForeignKeyAction to enum in the generator +* Add primary key auto increment test + +### 🚀 Features + +* Add support for WITH statements for DatabaseViews + +### 🐛 Bug Fixes + +* More tolerant query with list parameter parsing + +## 0.17.0 + +### 🐛 Bug Fixes + +* Generate distinct type converter instances +* Fix generation of DAO method with list argument using type converters + +## 0.16.0 + +### 🚀 Features + +* Add **experimental** support for type converters + +## 0.15.0 + +### Changes + +* Update dependencies + +### 🚀 Features + +* Add support for WITHOUT ROWID tables +* Check transaction method return types and allow non-void returns + +## 0.14.0 + +### Changes + +* Document entity inheritance and add integration test +* Raise minimum sqflite version to 1.3.0 +* add integration test for transaction rollback +* Mention missing null propagation in streams +* Fix types (integer instead of real) + +## 0.13.0 + +!!! attention + ### Breaking Change + + * Apply camel case to constants + + You need to migrate the explicit usages of `OnConflictStrategy` and `ForeignKeyAction` from snake case to camel case. + +### Changes + +* Mention SQL centricity of Floor in README +* Add banner to README +* Update the description of the library +* Migrate OnConflictStrategy to enum +* Add more precise limitations of entity class and streams to README +* Add DAO inheritance example to README +* Fix database and DAO usage example in the README +* Update README.md +* Assert example app's behavior +* Mention that floor uses first constructor found in entity class +* Remove snapshot version instructions from README + +### 🚀 Features + +* Support Linux, macOS, Windows +* Implement simple Streams on DatabaseViews, fix multi-dao changelistener + +### 🐛 Bug Fixes + +* Await database path retrieval +* Fix boolean conversion issues, add regression test, fix indentation +* Fix wrongly parsed arguments in @Query + +## 0.12.0 + +### Changes + +* Ignore Getters&Setters +* Use Flutter bundled pub to get and upgrade project dependencies +* Generate database implementation on every CI run +* Throw exception when querying for unsupported type +* Add generated code for example app +* Add workflow scripts +* Run real database tests on development machine and CI + +### 🚀 Features + +* Support ByteArrays/Blobs +* Support inherited fields for entities and views +* Support database views +* Support inherited DAO methods +* Support asynchronous migrations + +### 🐛 Bug Fixes + +* Fix failing SQLite installation process on CI +* Fix failing stream query test + +## 0.11.0 + +### Changes + +* Refactor string utility function into extension function +* Refactor annotation check functions to use extension functions +* Refactor type check functions to use extension functions + +### 🚀 Features + +* Ignore fields of entities by adding ignore annotation +* Handle named constructor parameters and ignore field order +* Exclude static fields from entity mapping + +## 0.10.0 + +### Changes + +* Update dependencies +* Update README with correct instructions to initialize in memory database + +### 🐛 Bug Fixes + +* Make in-memory database actually be just in memory + +## 0.9.0 + +### 🐛 Bug Fixes + +* Make IN clauses work with strings +* Fix foreign key action string representation + +## 0.8.0 + +### Changes + +* Update README with clear package import instructions + +### 🚀 Features + +* Introduce static 'to map' functions +* Add optional callback functions when opening database + +### 🐛 Bug Fixes + +* Allow int and string (composite) primary keys + +## 0.7.0 + +### 🐛 Bug Fixes + +* Retain reactivity when using transactions + +## 0.6.0 + +### 🚀 Features + +* Add support for IN clauses in query statements +* Enable compound primary keys + +## 0.5.0 + +### Changes + +* Make tasks deletable in example app + +### 🚀 Features + +* Allow multiline string queries +* Allow void-return queries with arguments + +## 0.4.2 + +### 🐛 Bug Fixes + +* Fix query parameter substitution regex + +## 0.4.0 + +### Changes + +* Enable coverage report +* Simplify type assertions and add tests + +### 🚀 Features + +* Allow more convenient database initialization + +### 🐛 Bug Fixes + +* Use query argument binding instead of manual binding + +## 0.3.0 + +### Changes + +* Use TypeChecker for all annotations +* Add publishing instructions +* Remove unused annotation names +* Simplify the mapping from an entity to a map +* Fix database writer test +* Make stream emit query result on subscription +* Update example to use StreamBuilder +* Update README + +### 🐛 Bug Fixes + +* Correct mapper instance name referenced by generated query methods +* Fix adapter instances naming + +## 0.2.0 + +### Changes + +* Add database adapters +* Run floor Flutter tests +* Move value objects to value_objects directory +* Map source elements into value objects in processors +* Use GeneratorForAnnotation and TypeChecker to verify annotations +* Throw more specific errors on obfuscated database annotation + +### 🚀 Features + +* Add support for migrations +* Add support for returning Streams as query result +* Support accessing data from Data Access Objects +* Add entity classes to database annotation +* Add support for indices + +## 0.1.0 + +### 🚀 Features + +* Support conflict strategies when inserting and updating records +* Add support for running queries that return void +* Add support for foreign keys +* Add parameter verification for query methods +* Return deleted row count on delete +* Return updated rows count on update +* Return ID/s of inserted item/s +* Add support for transactions +* Add support for changing (insert, update, delete) lists +* Support custom entity name +* Enable NOT NULL columns +* Enable custom column name mapping +* Add delete methods code generation and fix update methods +* Add update methods code generation +* Add insert methods code generation +* Add code generator for query methods +* Code generation for database creation diff --git a/docs/daos.md b/docs/daos.md index a2458f38..14c71b00 100644 --- a/docs/daos.md +++ b/docs/daos.md @@ -62,6 +62,8 @@ await dao.findPersonsWithNamesLike(name); Use the `@insert`, `@update` and `@delete` annotations for inserting and changing persistent data. All these methods accept single or multiple entity instances. +### Insert + `@insert` marks a method as an insertion method. When using the capitalized `@Insert` you can specify a conflict strategy. Else it just defaults to aborting the insert. @@ -70,6 +72,15 @@ These methods can return a `Future` of either `void`, `int` or `List`. - `int` return primary key of inserted item - `List` return primary keys of inserted items +```dart +@Insert(onConflict: OnConflictStrategy.rollback) +Future insertPerson(Person person); + +@insert +Future> insertPersons(List persons); +``` + +### Update `@update` marks a method as an update method. When using the capitalized `@Update` you can specify a conflict strategy. @@ -78,6 +89,15 @@ These methods can return a `Future` of either `void` or `int`. - `void` return nothing - `int` return number of changed rows +```dart +@Update(onConflict: OnConflictStrategy.replace) +Future updatePerson(Person person); + +@update +Future updatePersons(List persons); +``` + +### Delete `@delete` marks a method as a deletion method. These methods can return a `Future` of either `void` or `int`. @@ -85,16 +105,11 @@ These methods can return a `Future` of either `void` or `int`. - `int` return number of deleted rows ```dart -// examples of changing multiple items with return - -@insert -Future> insertPersons(List person); - -@update -Future updatePersons(List person); +@delete +Future deletePerson(Person person); @delete -Future deletePersons(List person); +Future deletePersons(List persons); ``` ## Streams diff --git a/docs/getting-started.md b/docs/getting-started.md index 028bdd37..0f5aea68 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -127,4 +127,4 @@ await personDao.insertPerson(person); final result = await personDao.findPersonById(1); ``` -For further examples take a look at the [example](https://github.com/vitusortner/floor/tree/develop/example) and [floor_test](https://github.com/vitusortner/floor/tree/develop/floor/test/integration) directories. +For further examples take a look at the [example](https://github.com/vitusortner/floor/tree/develop/example) and [test](https://github.com/vitusortner/floor/tree/develop/floor/test/integration) directories. diff --git a/docs/type-converters.md b/docs/type-converters.md index 74400fb2..f20aa453 100644 --- a/docs/type-converters.md +++ b/docs/type-converters.md @@ -1,7 +1,8 @@ # Type Converters -⚠️ **This feature is still in an experimental state. -Please use it with caution and file issues for problems you encounter.** +!!! attention + This feature is still in an experimental state. + Please use it with caution and file issues for problems you encounter. SQLite allows storing values of only a handful types. Whenever more complex Dart in-memory objects should be stored, there sometimes is the need for converting between Dart and SQLite compatible types. @@ -53,7 +54,10 @@ class Order { } ``` -## Type converters can be applied to +--- + +**Type converters can be applied to** + 1. databases 1. DAOs 1. entities/views diff --git a/mkdocs.yml b/mkdocs.yml index 45d2ae18..726d17b2 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -1,4 +1,4 @@ -site_name: Floor +site_name: Floor SQLite site_description: "Floor - The typesafe, reactive, and lightweight SQLite abstraction for your Flutter applications" site_url: https://vitusortner.github.io/floor/ repo_name: floor @@ -21,25 +21,31 @@ theme: code: Jetbrains Mono icon: repo: fontawesome/brands/github - logo: octicons/note-16 + logo: octicons/terminal-24 favicon: img/favicon.png features: - toc.integrate + - navigation.tabs nav: - - Home: index.md - - Getting Started: getting-started.md - - Architecture: architecture.md - - Entities: entities.md - - Database Views: database-views.md - - Data Access Objects: daos.md - - Type Converters: type-converters.md - - Migrations: migrations.md - - In Memory Database: in-memory-database.md - - Initialization Callback: initialization-callback.md - - Platform Support: platform-support.md - - Isolates: isolates.md - - Testing: testing.md - - Examples: examples.md - - Naming: naming.md - - Feedback: feedback.md + - Home: + - Welcome: index.md + - Naming: naming.md + - Feedback: feedback.md + + - Documentation: + - Getting Started: getting-started.md + - Architecture: architecture.md + - Entities: entities.md + - Database Views: database-views.md + - Data Access Objects: daos.md + - Type Converters: type-converters.md + - Migrations: migrations.md + - In Memory Database: in-memory-database.md + - Initialization Callback: initialization-callback.md + - Platform Support: platform-support.md + - Isolates: isolates.md + - Testing: testing.md + - Examples: examples.md + + - Changelog: changelog.md