Skip to content

Commit 865ac18

Browse files
Update code documentation.
1 parent b212e2a commit 865ac18

File tree

4 files changed

+36
-5
lines changed

4 files changed

+36
-5
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ query.close();
161161
### Streams
162162

163163
Streams can be created from queries.
164-
The streams can be extended with [rxdart](https://github.com/ReactiveX/rxdart);
164+
Note: Dart Streams can be extended with [rxdart](https://github.com/ReactiveX/rxdart).
165165

166166
```dart
167167
import "package:objectbox/src/observable.dart";

lib/objectbox.dart

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1+
/// ObjectBox for Dart is a standalone database storing Dart objects locally,
2+
/// with strong ACID semantics.
3+
///
4+
/// See the [README](https://github.com/objectbox/objectbox-dart#readme)
5+
/// to get started.
16
library objectbox;
27

38
export 'src/annotations.dart';
9+
export 'src/box.dart';
410
export 'src/common.dart';
511
export 'src/model.dart';
6-
export 'src/store.dart';
7-
export 'src/box.dart';
812
export 'src/modelinfo/index.dart';
913
export 'src/query/query.dart';
14+
export 'src/store.dart';

lib/src/query/query.dart

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,11 @@ class ConditionGroupAll extends ConditionGroup {
564564
ConditionGroupAll(conditions) : super(conditions, bindings.obx_qb_all);
565565
}
566566

567+
/// A repeatable Query returning the latest matching Objects.
568+
///
569+
/// Use [find] or related methods to fetch the latest results from the BoxStore.
570+
///
571+
/// Use [property] to only return values or an aggregate of a single Property.
567572
class Query<T> {
568573
Pointer<Void> _cQuery;
569574
Store store;
@@ -599,6 +604,7 @@ class Query<T> {
599604
checkObx(bindings.obx_query_limit(_cQuery, limit));
600605
}
601606

607+
/// Returns the number of matching Objects.
602608
int count() {
603609
final ptr = allocate<Uint64>(count: 1);
604610
try {
@@ -609,6 +615,7 @@ class Query<T> {
609615
}
610616
}
611617

618+
/// Close the query and free resources.
612619
// TODO Document wrap with closure to fake auto close
613620
void close() {
614621
checkObx(bindings.obx_query_close(_cQuery));
@@ -681,12 +688,12 @@ class Query<T> {
681688
});
682689
}
683690

684-
// For testing purposes
691+
/// For internal testing purposes.
685692
String describe() {
686693
return cString(bindings.obx_query_describe(_cQuery));
687694
}
688695

689-
// For testing purposes
696+
/// For internal testing purposes.
690697
String describeParameters() {
691698
return cString(bindings.obx_query_describe_params(_cQuery));
692699
}
@@ -719,14 +726,17 @@ class Query<T> {
719726
}
720727
}
721728

729+
/// See [property] for details.
722730
IntegerPropertyQuery integerProperty(QueryProperty qp) {
723731
return property<IntegerPropertyQuery>(qp);
724732
}
725733

734+
/// See [property] for details.
726735
DoublePropertyQuery doubleProperty(QueryProperty qp) {
727736
return property<DoublePropertyQuery>(qp);
728737
}
729738

739+
/// See [property] for details.
730740
StringPropertyQuery stringProperty(QueryProperty qp) {
731741
return property<StringPropertyQuery>(qp);
732742
}

lib/src/store.dart

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,22 @@ class Store {
1717
Pointer<Void> _cStore;
1818
final ModelDefinition defs;
1919

20+
/// Creates a BoxStore using the model definition from your
21+
/// `objectbox.g.dart` file.
22+
///
23+
/// For example in a Dart app:
24+
/// ```
25+
/// var store = Store(getObjectBoxModel());
26+
/// ```
27+
///
28+
/// Or for a Flutter app:
29+
/// ```
30+
/// getApplicationDocumentsDirectory().then((dir) {
31+
/// _store = Store(getObjectBoxModel(), directory: dir.path + "/objectbox");
32+
/// });
33+
/// ```
34+
///
35+
/// See our examples for more details.
2036
Store(this.defs,
2137
{String directory, int maxDBSizeInKB, int fileMode, int maxReaders}) {
2238
var model = Model(defs.model);

0 commit comments

Comments
 (0)