Skip to content

Commit

Permalink
docs(katana_model): Maintenance of Comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
mathrunet committed Oct 17, 2022
1 parent 1429d47 commit 4643b52
Show file tree
Hide file tree
Showing 13 changed files with 705 additions and 247 deletions.
26 changes: 18 additions & 8 deletions packages/katana_model/lib/adapter/runtime_model_adapter.dart
@@ -1,43 +1,53 @@
part of katana_model;

/// Model adapter that uses a database that runs only in the memory of the application.
/// All data will be reset when the application is re-launched.
///
/// It is usually used for temporary databases under development or for testing.
///
/// Normally, a common database [sharedDatabase] is used for the entire app, but if you want to reset the database each time, for example for testing, pass an individual database to [database].
///
/// By passing data to [RuntimeModelAdapter.setRawData], the database can be used as a data mockup since it contains data in advance.
///
/// アプリのメモリ上でのみ動作するデータベースを利用したモデルアダプター。
///
/// All data will be reset when the application is re-launched.
/// アプリを立ち上げ直すとデータはすべてリセットされます。
///
/// It is usually used for temporary databases under development or for testing.
/// 通常は開発途中の仮のデータベースやテスト用のデータベースに利用します。
///
/// Normally, a common database [sharedDatabase] is used for the entire app, but if you want to reset the database each time, for example for testing, pass an individual database to [database].
/// 通常はアプリ内全体での共通のデータベース[sharedDatabase]が利用されますが、テスト用などで毎回データベースをリセットする場合は[database]に個別のデータベースを渡してください。
///
/// By passing data to [RuntimeModelAdapter.setRawData], the database can be used as a data mockup since it contains data in advance.
/// [RuntimeModelAdapter.setRawData]にデータを渡すことで予めデータが入った状態でデータベースを利用することができるためデータモックとして利用することができます。
@immutable
class RuntimeModelAdapter extends ModelAdapter {
/// Model adapter that uses a database that runs only in the memory of the application.
/// All data will be reset when the application is re-launched.
///
/// It is usually used for temporary databases under development or for testing.
///
/// Normally, a common database [sharedDatabase] is used for the entire app, but if you want to reset the database each time, for example for testing, pass an individual database to [database].
///
/// By passing data to [RuntimeModelAdapter.setRawData], the database can be used as a data mockup since it contains data in advance.
///
/// アプリのメモリ上でのみ動作するデータベースを利用したモデルアダプター。
///
/// All data will be reset when the application is re-launched.
/// アプリを立ち上げ直すとデータはすべてリセットされます。
///
/// It is usually used for temporary databases under development or for testing.
/// 通常は開発途中の仮のデータベースやテスト用のデータベースに利用します。
///
/// Normally, a common database [sharedDatabase] is used for the entire app, but if you want to reset the database each time, for example for testing, pass an individual database to [database].
/// 通常はアプリ内全体での共通のデータベース[sharedDatabase]が利用されますが、テスト用などで毎回データベースをリセットする場合は[database]に個別のデータベースを渡してください。
///
/// By passing data to [RuntimeModelAdapter.setRawData], the database can be used as a data mockup since it contains data in advance.
/// [RuntimeModelAdapter.setRawData]にデータを渡すことで予めデータが入った状態でデータベースを利用することができるためデータモックとして利用することができます。
const RuntimeModelAdapter({NoSqlDatabase? database}) : _database = database;

/// Designated database. Please use for testing purposes, etc.
///
/// 指定のデータベース。テスト用途などにご利用ください。
NoSqlDatabase get database => _database ?? sharedDatabase;
final NoSqlDatabase? _database;

/// A common database throughout the application.
///
/// アプリ内全体での共通のデータベース。
static final NoSqlDatabase sharedDatabase = NoSqlDatabase();

Expand Down
13 changes: 10 additions & 3 deletions packages/katana_model/lib/extension/searchable_document_mixin.dart
@@ -1,15 +1,19 @@
part of katana_model;

/// Mix-in to make documents searchable.
/// ドキュメントを検索対象にするためのミックスイン。
///
/// This can be mixed in with `with` to make documents searchable and "display only specific strings" when querying collections.
/// これを`with`でミックスインすることでドキュメントを検索対象にしてコレクションでのクエリ時に「特定の文字列のみ表示する」といったことを実現することができます。
///
/// Stores Bigram data for search in [searchValueFieldKey].
/// [searchValueFieldKey]に検索用のBigramのデータを格納します。
///
/// [buildSearchText] creates a string to be searched. If you want to search multiple items, combine all strings and return them as a single string.
///
/// ドキュメントを検索対象にするためのミックスイン。
///
/// これを`with`でミックスインすることでドキュメントを検索対象にしてコレクションでのクエリ時に「特定の文字列のみ表示する」といったことを実現することができます。
///
/// [searchValueFieldKey]に検索用のBigramのデータを格納します。
///
/// [buildSearchText]で検索対象の文字列を作成します。複数の項目を検索対象にしたい場合、すべての文字列を合成し1つの文字列として返してください。
///
/// ```dart
Expand All @@ -19,6 +23,7 @@ part of katana_model;
/// ```
///
/// Documents targeted for search will be searchable in the collection. The search is made possible by passing a query using [ModelQuery.search].
///
/// 検索対象にされたドキュメントはコレクションで検索可能になります。検索の際は[ModelQuery.search]を用いてクエリを渡すことで検索可能になります。
///
/// ```dart
Expand All @@ -28,11 +33,13 @@ part of katana_model;
/// ```
mixin SearchableDocumentMixin<T> on DocumentBase<T> {
/// The field with this key contains the Bigram data for the search.
///
/// このキーを持つフィールドに検索用のBigramのデータを格納します。
@protected
String get searchValueFieldKey;

/// Creates a string to be searched. If you want to search multiple items, combine all strings and return them as a single string.
///
/// 検索対象の文字列を作成します。複数の項目を検索対象にしたい場合、すべての文字列を合成し1つの文字列として返してください。
///
/// ```dart
Expand Down

0 comments on commit 4643b52

Please sign in to comment.