Skip to content

Commit

Permalink
Resolve merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
hendrikvdkaaden committed Mar 13, 2024
2 parents 584de06 + 9967c32 commit 739d731
Show file tree
Hide file tree
Showing 77 changed files with 3,230 additions and 820 deletions.
23 changes: 12 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ jobs:
timeout-minutes: 10

container:
image: google/dart:latest
image: dart:2.19.3

steps:
- name: Check out code
uses: actions/checkout@v2

- name: Install dependencies
working-directory: floor_annotation
run: pub get
run: dart pub get

- name: Analyze
working-directory: floor_annotation
run: dartanalyzer --fatal-infos --fatal-warnings .
run: dart analyze --fatal-infos --fatal-warnings .

- name: Format
working-directory: floor_annotation
Expand All @@ -35,30 +35,30 @@ jobs:
timeout-minutes: 10

container:
image: google/dart:latest
image: dart:2.19.3

steps:
- name: Check out code
uses: actions/checkout@v2

- name: Install dependencies
working-directory: floor_generator
run: pub get
run: dart pub get

- name: Analyze
working-directory: floor_generator
run: dartanalyzer --fatal-infos --fatal-warnings .
run: dart analyze --fatal-infos --fatal-warnings .

- name: Format
working-directory: floor_generator
run: dart format --output=none --set-exit-if-changed .

- name: Run tests
working-directory: floor_generator
run: pub run test_cov
run: dart run test_cov

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: floor_generator
Expand All @@ -76,9 +76,10 @@ jobs:
uses: actions/checkout@v2

- name: Install Flutter
uses: subosito/flutter-action@v1
uses: subosito/flutter-action@v2
with:
channel: stable
architecture: x64

- name: Install dependencies
run: flutter packages get
Expand All @@ -103,7 +104,7 @@ jobs:
working-directory: floor

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: floor
Expand All @@ -118,7 +119,7 @@ jobs:
uses: actions/checkout@v2

- name: Install Flutter
uses: subosito/flutter-action@v1
uses: subosito/flutter-action@v2
with:
channel: stable

Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ on:

jobs:
update-release-draft:
permissions:
contents: write # to create a GitHub release
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter@v5
Expand Down
27 changes: 15 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
![Floor](https://raw.githubusercontent.com/vitusortner/floor/develop/img/floor.png)
![Floor](https://raw.githubusercontent.com/pinchbv/floor/develop/img/floor.png)

**See the [project's website](https://floor.codes) for the full documentation.**
**See the [project's website](https://pinchbv.github.io/floor/) for the full documentation.**

Floor provides a neat SQLite abstraction for your Flutter applications inspired by the [Room persistence library](https://developer.android.com/topic/libraries/architecture/room).
It comes with automatic mapping between in-memory objects and database rows while still offering full control of the database with the use of SQL.
Expand All @@ -16,11 +16,11 @@ As a consequence, it's necessary to have an understanding of SQL and SQLite in o
- iOS, Android, Linux, macOS, Windows

⚠️ The library is open to contributions!
Refer to [GitHub Discussions](https://github.com/vitusortner/floor/discussions) for questions, ideas, and discussions.
Refer to [GitHub Discussions](https://github.com/pinchbv/floor/discussions) for questions, ideas, and discussions.

[![pub package](https://img.shields.io/pub/v/floor.svg)](https://pub.dartlang.org/packages/floor)
[![build status](https://github.com/vitusortner/floor/workflows/Continuous%20integration/badge.svg)](https://github.com/vitusortner/floor/actions)
[![codecov](https://codecov.io/gh/vitusortner/floor/branch/develop/graph/badge.svg)](https://codecov.io/gh/vitusortner/floor)
[![build status](https://github.com/pinchbv/floor/workflows/CI/badge.svg)](https://github.com/pinchbv/floor/actions)
[![codecov](https://codecov.io/gh/pinchbv/floor/branch/develop/graph/badge.svg)](https://codecov.io/gh/pinchbv/floor)

## Getting Started

Expand All @@ -37,10 +37,10 @@ The third dependency is `build_runner` which has to be included as a dev depende
dependencies:
flutter:
sdk: flutter
floor: ^1.2.0
floor: ^1.4.2

dev_dependencies:
floor_generator: ^1.2.0
floor_generator: ^1.4.2
build_runner: ^2.1.2
```
Expand Down Expand Up @@ -86,7 +86,10 @@ import 'package:floor/floor.dart';
@dao
abstract class PersonDao {
@Query('SELECT * FROM Person')
Future<List<Person>> findAllPersons();
Future<List<Person>> findAllPeople();
@Query('SELECT name FROM Person')
Stream<List<String>> findAllPeopleName();
@Query('SELECT * FROM Person WHERE id = :id')
Stream<Person?> findPersonById(int id);
Expand Down Expand Up @@ -151,19 +154,19 @@ 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 [test](https://github.com/vitusortner/floor/tree/develop/floor/test/integration) directories.
For further examples take a look at the [example](https://github.com/pinchbv/floor/tree/develop/example) and [test](https://github.com/pinchbv/floor/tree/develop/floor/test/integration) directories.

## Naming
The library's name derives from the following.
*Floor* as the *bottom layer* of a [Room](https://developer.android.com/topic/libraries/architecture/room) which points to the analogy of the database layer being the bottom and foundation layer of most applications.
Where *fl* also gives a pointer that the library is used in the Flutter context.

## Bugs, Ideas, and Feedback
For bugs please use [GitHub Issues](https://github.com/vitusortner/floor/issues).
For questions, ideas, and discussions use [GitHub Discussions](https://github.com/vitusortner/floor/discussions).
For bugs please use [GitHub Issues](https://github.com/pinchbv/floor/issues).
For questions, ideas, and discussions use [GitHub Discussions](https://github.com/pinchbv/floor/discussions).

## License
Copyright 2021 The Floor Project Authors
Copyright 2023 The Floor Project Authors

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
1 change: 0 additions & 1 deletion docs/CNAME

This file was deleted.

40 changes: 36 additions & 4 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,37 @@
# Changelog

## 1.4.2

* Changed TypeConverters priority
* Ignore ordering of constructors to always take the public, non-factory constructor
* Return result of table modifications through queries

## 1.4.1

### Changes

* Fix issue with nullable enum declaration in entity

## 1.4.0

### Changes

* Update to Analyzer 5
* Add Enum support
* Add primitive Dart type support in queries

## 1.3.0

### Changes

* Remove Slack invite links

### 🛠 Maintenance

* Update Analyzer to 4.1.0
* Allow release drafter to create GitHub releases
* Support latest analyzer

## 1.2.0

### Changes
Expand Down Expand Up @@ -135,12 +167,12 @@ All credits for this release go to mqus.

## 0.13.0

!!! attention
### Breaking Change
### ⚠️ Breaking Changes

* Apply camel case to constants
**You need to migrate the explicit usages of `OnConflictStrategy` and `ForeignKeyAction` from snake
case to camel case.**

You need to migrate the explicit usages of `OnConflictStrategy` and `ForeignKeyAction` from snake case to camel case.
* Apply camel case to constants

### Changes

Expand Down
41 changes: 24 additions & 17 deletions docs/daos.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ DAO classes can use inherited methods by implementing and extending classes whil
@dao
abstract class PersonDao {
@Query('SELECT * FROM Person')
Future<List<Person>> findAllPersons();
Future<List<Person>> findAllPeople();
@Query('SELECT * FROM Person WHERE id = :id')
Stream<Person?> findPersonById(int id);
Expand All @@ -20,8 +20,9 @@ abstract class PersonDao {
## Queries
Method signatures turn into query methods by adding the `@Query()` annotation with the query in parenthesis to them.
Be mindful about the correctness of your SQL statements as they are only partly validated while generating the code.
These queries have to return either a `Future` or a `Stream` of an entity or `void`.
Returning `Future<void>` comes in handy whenever you want to delete the full content of a table, for instance.
These queries have to return either a `Future` or a `Stream` of an entity, Dart core type or `void`.
Retrieval of Dart Core types such as `String`, `double`, `int`, `double`, `Uint8List` can be used if you want to get all records from a certain column or return `COUNT` records in the table.
Returning `Future<void>` comes in handy whenever you want to delete the full content of a table, for instance.
Some query method examples can be seen in the following.

A function returning a single item will return `null` when no matching row is found.
Expand All @@ -36,17 +37,23 @@ Future<Person?> findPersonById(int id);
@Query('SELECT * FROM Person WHERE id = :id AND name = :name')
Future<Person?> findPersonByIdAndName(int id, String name);
@Query('SELECT COUNT(id) FROM Person')
Future<int?> getPeopleCount(); // fetch records count
@Query('SELECT name FROM Person')
Future<List<String>> getAllPeopleNames(); // fetch all records from one column
@Query('SELECT * FROM Person')
Future<List<Person>> findAllPersons(); // select multiple items
Future<List<Person>> findAllPeople(); // select multiple items
@Query('SELECT * FROM Person')
Stream<List<Person>> findAllPersonsAsStream(); // stream return
Stream<List<Person>> findAllPeopleAsStream(); // stream return
@Query('DELETE FROM Person')
Future<void> deleteAllPersons(); // query without returning an entity
Future<void> deleteAllPeople(); // query without returning an entity
@Query('SELECT * FROM Person WHERE id IN (:ids)')
Future<List<Person>> findPersonsWithIds(List<int> ids); // query with IN clause
Future<List<Person>> findPeopleWithIds(List<int> ids); // query with IN clause
```

Query arguments, when using SQLite's `LIKE` operator, have to be supplied by the input of a method.
Expand All @@ -55,11 +62,11 @@ It's not possible to define a pattern matching argument like `%foo%` in the quer
```dart
// dao
@Query('SELECT * FROM Person WHERE name LIKE :name')
Future<List<Person>> findPersonsWithNamesLike(String name);
Future<List<Person>> findPeopleWithNamesLike(String name);
// usage
final name = '%foo%';
await dao.findPersonsWithNamesLike(name);
await dao.findPeopleWithNamesLike(name);
```

## Data Changes
Expand All @@ -81,7 +88,7 @@ These methods can return a `Future` of either `void`, `int` or `List<int>`.
Future<void> insertPerson(Person person);
@insert
Future<List<int>> insertPersons(List<Person> persons);
Future<List<int>> insertPeople(List<Person> people);
```

### Update
Expand All @@ -98,7 +105,7 @@ These methods can return a `Future` of either `void` or `int`.
Future<void> updatePerson(Person person);
@update
Future<int> updatePersons(List<Person> persons);
Future<int> updatePeople(List<Person> people);
```

### Delete
Expand All @@ -113,7 +120,7 @@ These methods can return a `Future` of either `void` or `int`.
Future<void> deletePerson(Person person);
@delete
Future<int> deletePersons(List<Person> persons);
Future<int> deletePeople(List<Person> people);
```

## Streams
Expand All @@ -135,12 +142,12 @@ abstract class PersonDao {
Stream<Person?> findPersonByIdAsStream(int id);
@Query('SELECT * FROM Person')
Stream<List<Person>> findAllPersonsAsStream();
Stream<List<Person>> findAllPeopleAsStream();
}
// usage
StreamBuilder<List<Person>>(
stream: dao.findAllPersonsAsStream(),
stream: dao.findAllPeopleAsStream(),
builder: (BuildContext context, AsyncSnapshot<List<Person>> snapshot) {
// do something with the values here
},
Expand All @@ -160,9 +167,9 @@ It's also required to add the `async` modifier. These methods have to return a `

```dart
@transaction
Future<void> replacePersons(List<Person> persons) async {
await deleteAllPersons();
await insertPersons(persons);
Future<void> replacePeople(List<Person> people) async {
await deleteAllPeople();
await insertPeople(people);
}
```

Expand Down
1 change: 1 addition & 0 deletions docs/entities.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ Floor entities can hold values of the following Dart types which map to their co
- `String` - TEXT
- `bool` - INTEGER (0 = false, 1 = true)
- `Uint8List` - BLOB
- `enum` - INTEGER (records by the index 0..n)

In case you want to store sophisticated Dart objects that can be represented by one of the above types, take a look at [Type Converters](type-converters.md).

Expand Down
4 changes: 2 additions & 2 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ The third dependency is `build_runner` which has to be included as a dev depende
dependencies:
flutter:
sdk: flutter
floor: ^1.2.0
floor: ^1.4.0

dev_dependencies:
floor_generator: ^1.2.0
floor_generator: ^1.4.0
build_runner: ^2.1.2
```
Expand Down
4 changes: 2 additions & 2 deletions example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ The library's name derives from the following.
Where *fl* also gives a pointer that the library is used in the Flutter context.

## Bugs and Feedback
For bugs, questions and discussions please use [Github Issues](https://github.com/vitusortner/floor/issues).
For bugs, questions and discussions please use [Github Issues](https://github.com/pinchbv/floor/issues).

## License
Copyright 2021 The Floor Project Authors
Copyright 2022 The Floor Project Authors

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion example/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
2 changes: 1 addition & 1 deletion example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
Loading

0 comments on commit 739d731

Please sign in to comment.