DocumentModelPath class
Annotation for creating a documentation model.
Specify the path for the document in path.
Use with freezed
, etc.
You can define a query to get the document model in static const document = _$(class name)DocumentQuery()
.
You can duplicate the same data to another path by defining a path in mirror.
Each data can be retrieved with document.mirror
and can be loaded
and saved
in the same way.
In addition, by using saveSync
and deleteSync
, data can be saved and deleted synchronously.
It can be used to achieve relationships in NoSQL databases with follow/follow implementations.
ドキュメントモデルを作成するためのアノテーション。
pathにドキュメント用のパスを指定します。
freezed
などと共に利用してください。
static const document = _$(クラス名)DocumentQuery()
にドキュメントモデルを取得するためのクエリを定義できます。
mirrorにパスを定義すると別のパスに同じデータを複製することができます。
それぞれのデータはdocument.mirror
で取得でき、同じようにload
やsave
ができるようになります。
さらにsaveSync
やdeleteSync
を利用することで、同期的にデータの保存や削除が行なえます。
フォロー・フォロワーの実装でNoSQLデータベースにおけるリレーションを実現するために利用することが可能です。
@freezed
@formValue
@immutable
@DocumentModelPath("user/doc")
class UserModel with _$UserModel {
const factory UserModel({
@Default("") String name,
@Default("") String description,
}) = _UserModel;
const UserModel._();
factory UserModel.fromJson(Map<String, Object?> json) => _$UserModelFromJson(json);
static const document = _$UserModelDocumentQuery();
}
- Available Extensions
Constructors
- DocumentModelPath(String path, String? mirror)
-
Annotation for creating a documentation model.
const
Properties
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited