diff --git a/docs/docs/de/tutorials/quickstart.md b/docs/docs/de/tutorials/quickstart.md index 3a775033b..b50fa8930 100644 --- a/docs/docs/de/tutorials/quickstart.md +++ b/docs/docs/de/tutorials/quickstart.md @@ -13,7 +13,7 @@ Dieser Schnellstart wird wenig um den heißen Brei herumreden und direkt mit dem Bevor es losgeht, müssen wir ein paar Pakete zur `pubspec.yaml` hinzufügen. Damit es schneller geht lassen wir pub das für uns erledigen. ```bash -dart pub add isar:^4.0.0-dev.15 isar_flutter_libs:^4.0.0-dev.15 --hosted-url=https://isar-community.dev +dart pub add isar:^0.0.0-placeholder isar_flutter_libs:^0.0.0-placeholder --hosted-url=https://isar-community.dev ``` ## 2. Klassen annotieren @@ -35,7 +35,15 @@ class User { IDs identifizieren Objekte in einer Collection eindeutig und erlauben es dir, sie später wiederzufinden. -## 3. Isar-Instanz öffnen +## 3. Code-Generator ausführen + +Führe den folgenden Befehl aus, um den `build_runner` zu starten: + +``` +dart run build_runner build +``` + +## 4. Isar-Instanz öffnen Öffne eine neue Isar-Instanz und übergebe alle Collection-Schemata. Optional kannst du einen Instanznamen und ein Verzeichnis angeben. @@ -47,7 +55,7 @@ final isar = await Isar.open( ); ``` -## 4. Schreiben und lesen +## 5. Schreiben und lesen Wenn deine Instanz geöffnet ist, hast du Zugriff auf die Collections. diff --git a/docs/docs/es/tutorials/quickstart.md b/docs/docs/es/tutorials/quickstart.md index 8f197a910..dd21a664d 100644 --- a/docs/docs/es/tutorials/quickstart.md +++ b/docs/docs/es/tutorials/quickstart.md @@ -13,8 +13,7 @@ Vamos a ser cortos en palabras para ir inmediatamente al código en esta guía d Antes de empezar la parte divertida, necesitamos agregar algunos paquetes al `pubspec.yaml`. Podemos usar pub para hacer el trabajo pesado por nosotros. ```bash -flutter pub add isar isar_flutter_libs -flutter pub add -d isar_generator build_runner +dart pub add isar:^0.0.0-placeholder isar_flutter_libs:^0.0.0-placeholder --hosted-url=https://isar-community.dev ``` ## 2. Anota las clases @@ -44,12 +43,6 @@ Ejecuta el siguiente comando para iniciar el `build_runner`: dart run build_runner build ``` -Si estás usando Flutter, puedes usar el siguiente: - -``` -flutter pub run build_runner build -``` - ## 4. Abre una instancia Isar Abre una nueva instalcia Isar y pásale todos los esquemas de tu colección. Opcionalmente puedes especificar un nombre para la instancia y un directorio. @@ -71,13 +64,14 @@ Todas las operaciones CRUD básicas están disponibles a través del `IsarCollec ```dart final newUser = User()..name = 'Jane Doe'..age = 36; -await isar.writeTxn(() async { +await isar.writeAsync((isar) async { + newUser.id = isar.users.autoIncrement(); await isar.users.put(newUser); // insert & update }); final existingUser = await isar.users.get(newUser.id); // get -await isar.writeTxn(() async { +await isar.writeAsync((isar) async { await isar.users.delete(existingUser.id!); // delete }); ``` diff --git a/docs/docs/fr/tutorials/quickstart.md b/docs/docs/fr/tutorials/quickstart.md index 2da59f4f4..80d6f2fab 100644 --- a/docs/docs/fr/tutorials/quickstart.md +++ b/docs/docs/fr/tutorials/quickstart.md @@ -13,8 +13,7 @@ Nous allons être brefs en mots et rapides en code dans ce démarrage rapide. Avant de débuter, nous devons ajouter quelques dépendances au fichier `pubspec.yaml`. Nous pouvons utiliser la commande `pub` pour faire le gros du travail à notre place. ```bash -flutter pub add isar isar_flutter_libs -flutter pub add -d isar_generator build_runner +dart pub add isar:^0.0.0-placeholder isar_flutter_libs:^0.0.0-placeholder --hosted-url=https://isar-community.dev ``` ## 2. Annotation de classes @@ -44,12 +43,6 @@ Exécutez la commande suivante pour démarrer le `build_runner`: dart run build_runner build ``` -Si vous utilisez Flutter: - -```sh -flutter pub run build_runner build -``` - ## 4. Ouverture l'instance Isar Ouvrez une nouvelle instance d'Isar et passez tous vos schémas de collection. En option, vous pouvez spécifier un nom d'instance et un dossier. @@ -71,13 +64,14 @@ Toutes les opérations CRUD de base sont disponibles via `IsarCollection`. ```dart final newUser = User()..name = 'Jane Doe'..age = 36; -await isar.writeTxn(() async { +await isar.writeAsync((isar) async { + newUser.id = isar.users.autoIncrement(); await isar.users.put(newUser); // Insertion & modification }); final existingUser = await isar.users.get(newUser.id); // Obtention -await isar.writeTxn(() async { +await isar.writeAsync((isar) async { await isar.users.delete(existingUser.id!); // Suppression }); ``` diff --git a/docs/docs/it/tutorials/quickstart.md b/docs/docs/it/tutorials/quickstart.md index ba33bd26c..010be17ee 100644 --- a/docs/docs/it/tutorials/quickstart.md +++ b/docs/docs/it/tutorials/quickstart.md @@ -13,8 +13,7 @@ In questa guida introduttiva saremo a corto di parole e veloci nel codice. Prima che inizii il divertimento, dobbiamo aggiungere alcuni pacchetti a `pubspec.yaml`. Possiamo usare il pub per facilitarci il lavoro pesante. ```bash -flutter pub add isar isar_flutter_libs -flutter pub add -d isar_generator build_runner +dart pub add isar:^0.0.0-placeholder isar_flutter_libs:^0.0.0-placeholder --hosted-url=https://isar-community.dev ``` ## 2. Annota le classi @@ -44,12 +43,6 @@ Esegui il seguente comando per avviare `build_runner`: dart run build_runner build ``` -Se stai usando Flutter, usa quanto segue: - -``` -flutter pub run build_runner build -``` - ## 4. Apri l'istanza Isar Apri una nuova istanza Isar e passa tutti i tuoi schemi di raccolte. Facoltativamente, puoi specificare un nome di istanza e una directory. @@ -71,13 +64,14 @@ Tutte le operazioni CRUD di base sono disponibili tramite "IsarCollection". ```dart final newUser = User()..name = 'Jane Doe'..age = 36; -await isar.writeTxn(() async { +await isar.writeAsync((isar) async { + newUser.id = isar.users.autoIncrement(); await isar.users.put(newUser); // insert & update }); final existingUser = await isar.users.get(newUser.id); // get -await isar.writeTxn(() async { +await isar.writeAsync((isar) async { await isar.users.delete(existingUser.id!); // delete }); ``` diff --git a/docs/docs/ja/tutorials/quickstart.md b/docs/docs/ja/tutorials/quickstart.md index e07ebf200..3a49366ab 100644 --- a/docs/docs/ja/tutorials/quickstart.md +++ b/docs/docs/ja/tutorials/quickstart.md @@ -14,8 +14,7 @@ title: クイックスタート Isarを使用する前に、いくつかのパッケージを `pubspec.yaml` に追加する必要があります。pubを使用する事で、面倒な作業を簡単に済ませることが出来ます。 ```bash -flutter pub add isar isar_flutter_libs -flutter pub add -d isar_generator build_runner +dart pub add isar:^0.0.0-placeholder isar_flutter_libs:^0.0.0-placeholder --hosted-url=https://isar-community.dev ``` ## 2. クラスの注釈(アノテーション) @@ -45,12 +44,6 @@ idはコレクション内のオブジェクトを一意に識別して、後で dart run build_runner build ``` -Flutterを使用している場合は、代わりに次のコマンドを使用してください: - -``` -flutter pub run build_runner build -``` - ## 4. Isarインスタンスを開く 新規のIsarインスタンスを開き、コレクションのスキーマを渡します。必要に応じて、インスタンス名とディレクトリを指定することができます。 @@ -72,13 +65,14 @@ Isarインスタンスを開いたら, コレクションを利用すること ```dart final newUser = User()..name = 'Jane Doe'..age = 36; -await isar.writeTxn(() async { +await isar.writeAsync((isar) async { + newUser.id = isar.users.autoIncrement(); await isar.users.put(newUser); // 挿入と更新 }); final existingUser = await isar.users.get(newUser.id); // 取得 -await isar.writeTxn(() async { +await isar.writeAsync((isar) async { await isar.users.delete(existingUser.id!); // 削除 }); ``` diff --git a/docs/docs/ko/tutorials/quickstart.md b/docs/docs/ko/tutorials/quickstart.md index b2bed2103..7242cdaeb 100644 --- a/docs/docs/ko/tutorials/quickstart.md +++ b/docs/docs/ko/tutorials/quickstart.md @@ -13,8 +13,7 @@ title: 빠른 시작 재미있는 부분을 보기 전에 `pubspec.yaml` 에 몇 개의 패키지를 추가해야 합니다. 우리는 펍을 이용해서 힘든 일을 쉽게 할 수 있습니다. ```bash -flutter pub add isar isar_flutter_libs -flutter pub add -d isar_generator build_runner +dart pub add isar:^0.0.0-placeholder isar_flutter_libs:^0.0.0-placeholder --hosted-url=https://isar-community.dev ``` ## 2. 클래스에 주석 추가(어노테이션) @@ -44,12 +43,6 @@ Id는 컬렉션에서 개체를 고유하게 식별하고 나중에 개체를 dart run build_runner build ``` -플러터를 사용하고 있다면, 다음 명령을 사용합니다. - -``` -flutter pub run build_runner build -``` - ## 4. Isar 인스턴스 열기 새 Isar 인스턴스를 열고 모든 컬렉션 스키마를 전달합니다. 선택적으로 인스턴스 이름과 디렉토리를 지정할 수도 있습니다. @@ -71,13 +64,14 @@ final isar = await Isar.open( ```dart final newUser = User()..name = 'Jane Doe'..age = 36; -await isar.writeTxn(() async { +await isar.writeAsync((isar) async { + newUser.id = isar.users.autoIncrement(); await isar.users.put(newUser); // 삽입 & 업데이트 }); final existingUser = await isar.users.get(newUser.id); // 가져오기 -await isar.writeTxn(() async { +await isar.writeAsync((isar) async { await isar.users.delete(existingUser.id!); // 삭제 }); ``` diff --git a/docs/docs/pt/tutorials/quickstart.md b/docs/docs/pt/tutorials/quickstart.md index 8c3f04eee..2a98d9000 100644 --- a/docs/docs/pt/tutorials/quickstart.md +++ b/docs/docs/pt/tutorials/quickstart.md @@ -13,8 +13,7 @@ Seremos curtos em palavras e rápidos em código neste início rápido. Antes que a diversão comece, precisamos adicionar alguns pacotes ao `pubspec.yaml`. Podemos usar o pub para fazer o trabalho complexo para nós. ```bash -flutter pub add isar isar_flutter_libs -flutter pub add -d isar_generator build_runner +dart pub add isar:^0.0.0-placeholder isar_flutter_libs:^0.0.0-placeholder --hosted-url=https://isar-community.dev ``` ## 2. Anotar classes @@ -44,12 +43,6 @@ Execute o seguinte comando para iniciar o `build_runner`: dart run build_runner build ``` -Se você estiver usando o Flutter, use o seguinte: - -``` -flutter pub run build_runner build -``` - ## 4. Abrir instância Isar Abra uma nova instância Isar e passe todos os seus esquemas de coleção. Opcionalmente, você pode especificar um nome de instância e um diretório. @@ -71,13 +64,14 @@ Todas as operações básicas de CRUD estão disponíveis via `IsarCollection`. ```dart final newUser = User()..name = 'Jane Doe'..age = 36; -await isar.writeTxn(() async { +await isar.writeAsync((isar) async { + newUser.id = isar.users.autoIncrement(); await isar.users.put(newUser); // inserir & atualizar }); final existingUser = await isar.users.get(newUser.id); // get -await isar.writeTxn(() async { +await isar.writeAsync((isar) async { await isar.users.delete(existingUser.id!); // delete }); ``` diff --git a/docs/docs/tutorials/quickstart.md b/docs/docs/tutorials/quickstart.md index e0b970e50..e52e1560b 100644 --- a/docs/docs/tutorials/quickstart.md +++ b/docs/docs/tutorials/quickstart.md @@ -13,7 +13,7 @@ We're going to be short on words and quick on code in this quickstart. Before the fun begins, we need to add a few packages to the `pubspec.yaml`. We can use pub to do the heavy lifting for us. ```bash -dart pub add isar:^4.0.0-dev.15 isar_flutter_libs:^4.0.0-dev.15 --hosted-url=https://isar-community.dev +dart pub add isar:^0.0.0-placeholder isar_flutter_libs:^0.0.0-placeholder --hosted-url=https://isar-community.dev ``` ## 2. Annotate classes @@ -37,7 +37,15 @@ class User { Ids uniquely identify objects in a collection and allow you to find them again later. -## 3. Open Isar instance +## 3. Run code generator + +Execute the following command to start the `build_runner`: + +``` +dart run build_runner build +``` + +## 4. Open Isar instance Open a new Isar instance and pass all of your collection schemas. Optionally you can specify an instance name and directory. @@ -49,7 +57,7 @@ final isar = await Isar.open( ); ``` -## 4. Write and read +## 5. Write and read Once your instance is open, you can start using the collections. diff --git a/docs/docs/ur/tutorials/quickstart.md b/docs/docs/ur/tutorials/quickstart.md index fcca09134..4025727a8 100644 --- a/docs/docs/ur/tutorials/quickstart.md +++ b/docs/docs/ur/tutorials/quickstart.md @@ -11,8 +11,7 @@ title: فورا شروع کریں تفریح کا آغاز کرنےسے پہلےہمیں "پب سپیک۔یمل" میں چند پیکجز شامل کرنے کی ضرورت ہے۔ہم اپنے لیے بھاری سامان اٹھانے کے لیے پب کا استعمال کر سکتے ہیں۔ ```bash -flutter pub add isar isar_flutter_libs -flutter pub add -d isar_generator build_runner +dart pub add isar:^0.0.0-placeholder isar_flutter_libs:^0.0.0-placeholder --hosted-url=https://isar-community.dev ``` ## 2. کلاسوں کی تشریح کریں۔ @@ -41,12 +40,6 @@ class User { dart run build_runner build ``` -اگر آپ فلٹر استعمال کر رہے ہیں تو درج ذیل استعمال کریں؛ - -``` -flutter pub run build_runner build -``` - ## 4. ای زار مثال کھولیں۔ ایک نیا ای زار مثال کھولیں اور اپنے تمام کلیکشن اسکیموں کو پاس کریں۔ اختیاری طور پر آپ مثال کا نام اور ڈائریکٹری بتا سکتے ہیں۔ @@ -69,14 +62,15 @@ final isar = await Isar.open( ```dart final newUser = User()..name = 'Jane Doe'..age = 36; -await isar.writeTxn(() async { +await isar.writeAsync((isar) async { + newUser.id = isar.users.autoIncrement(); await isar.users.put(newUser); داخل کریں اور تروتازہ کریں۔// }); final existingUser = await isar.users.get(newUser.id); حاصل کریں۔// -await isar.writeTxn(() async { +await isar.writeAsync((isar) async { await isar.users.delete(existingUser.id!); حذف کریں// }); diff --git a/docs/docs/zh/tutorials/quickstart.md b/docs/docs/zh/tutorials/quickstart.md index 70aab3353..31e4f62e7 100644 --- a/docs/docs/zh/tutorials/quickstart.md +++ b/docs/docs/zh/tutorials/quickstart.md @@ -13,8 +13,7 @@ title: 快速开始 在开始之前,我们需要在 `pubspec.yaml` 文件中添加若干依赖,可以运行以下命令帮助我们完成: ```bash -flutter pub add isar isar_flutter_libs -flutter pub add -d isar_generator build_runner +dart pub add isar:^0.0.0-placeholder isar_flutter_libs:^0.0.0-placeholder --hosted-url=https://isar-community.dev ``` ## 2. 给类添加注解 @@ -44,12 +43,6 @@ Id 唯一指向了 Collection 中的对象,之后我们可通过 Id 来查询 dart run build_runner build ``` -倘若你的项目用到了 Flutter,可用下方命令来代替: - -``` -flutter pub run build_runner build -``` - ## 4. 创建一个 Isar 实例 创建一个新的 Isar 实例,并将你想保存到 Isar 的所有 collection 的 schema(它在上一步由 Isar Generator 根据你定义的 collection 自动生成) 作为参数传入。你还可以指定实例的名称以及它所存储数据的文件路径。 @@ -71,13 +64,14 @@ final isar = await Isar.open( ```dart final newUser = User()..name = 'Jane Doe'..age = 36; -await isar.writeTxn(() async { +await isar.writeAsync((isar) async { + newUser.id = isar.users.autoIncrement(); await isar.users.put(newUser); // 将新用户数据写入到 Isar }); final existingUser = await isar.users.get(newUser.id); // 通过 Id 读取用户数据 -await isar.writeTxn(() async { +await isar.writeAsync((isar) async { await isar.users.delete(existingUser.id!); // 通过 Id 删除指定用户 }); ``` diff --git a/packages/isar/CHANGELOG.md b/packages/isar/CHANGELOG.md index 1360e8035..e58108200 100644 --- a/packages/isar/CHANGELOG.md +++ b/packages/isar/CHANGELOG.md @@ -1,3 +1,7 @@ +## 4.0.1 + +Adapted quickstart guide to get started with version 4 + ## 4.0.0-dev.15 Switch deployment to isar-community diff --git a/packages/isar/lib/src/isar_connect.dart b/packages/isar/lib/src/isar_connect.dart index 5e3c3b8b5..8efafefe3 100644 --- a/packages/isar/lib/src/isar_connect.dart +++ b/packages/isar/lib/src/isar_connect.dart @@ -66,7 +66,8 @@ abstract class _IsarConnect { if (path.endsWith('=')) { path = path.substring(0, path.length - 1); } - final url = ' https://isar-community.dev/inspector/${Isar.version}/#/$port$path '; + final url = + ' https://isar-community.dev/inspector/${Isar.version}/#/$port$path '; String line(String text, String fill) { final fillCount = url.length - text.length; final left = List.filled(fillCount ~/ 2, fill); diff --git a/tool/publish.sh b/tool/publish.sh index 512e51d41..a930db70c 100755 --- a/tool/publish.sh +++ b/tool/publish.sh @@ -6,11 +6,7 @@ # set -o errexit -if [ "$ISAR_VERSION" == "" ]; then - echo "Define ISAR_VERSION to specify which release to publish.sh" - exit 1 -fi -find . -type f -exec sed -i "s/0.0.0-placeholder/$ISAR_VERSION/g" {} + +. ./replace-versions.sh pushd packages/isar dart pub get popd diff --git a/tool/replace-versions.sh b/tool/replace-versions.sh new file mode 100755 index 000000000..f0f1d6a81 --- /dev/null +++ b/tool/replace-versions.sh @@ -0,0 +1,8 @@ +#!/bin/bash +# This script replaces the version placeholder with the latest tag version on this branch +if [ "$ISAR_VERSION" == "" ]; then + export ISAR_VERSION=`git describe --tags --abbrev=0` + echo "ISAR_VERSION not defined in environment, using $ISAR_VERSION" +fi +find packages -type f -exec sed -i "s/0.0.0-placeholder/$ISAR_VERSION/g" {} + +find docs -type f -exec sed -i "s/0.0.0-placeholder/$ISAR_VERSION/g" {} +