Skip to content

Commit

Permalink
fix: lint error on dev (public apis)
Browse files Browse the repository at this point in the history
  • Loading branch information
alextekartik committed Aug 15, 2020
1 parent 01a51eb commit acd67a6
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 7 deletions.
6 changes: 5 additions & 1 deletion sembast/lib/src/database_factory_mixin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,12 @@ abstract class SembastDatabaseFactory implements DatabaseFactory {
void removeDatabaseOpenHelper(String path);
}

/// Database factory mixin.
mixin DatabaseFactoryMixin implements SembastDatabaseFactory {
// for single instances only
final _databaseOpenHelpers = <String, DatabaseOpenHelper>{};

/// Open a database with a given set of options.
Future<Database> openDatabaseWithOptions(
String path, DatabaseOpenOptions options) {
// Always specify the default codec
Expand All @@ -138,6 +140,7 @@ mixin DatabaseFactoryMixin implements SembastDatabaseFactory {
codec: codec));
}

/// Get or create the open helper for a given path.
DatabaseOpenHelper getDatabaseOpenHelper(
String path, DatabaseOpenOptions options) {
var helper = getExistingDatabaseOpenHelper(path);
Expand All @@ -148,6 +151,7 @@ mixin DatabaseFactoryMixin implements SembastDatabaseFactory {
return helper;
}

/// Get existing open helper for a given path.
DatabaseOpenHelper getExistingDatabaseOpenHelper(String path) {
if (path != null) {
return _databaseOpenHelpers[path];
Expand Down Expand Up @@ -187,7 +191,7 @@ mixin DatabaseFactoryMixin implements SembastDatabaseFactory {
return doDeleteDatabase(path);
}

// Flush all opened databases
/// Flush all opened databases
Future flush() async {
var helpers = List<DatabaseOpenHelper>.from(_databaseOpenHelpers.values,
growable: false);
Expand Down
13 changes: 8 additions & 5 deletions sembast/lib/src/filter_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,24 +44,27 @@ class SembastCustomFilter extends SembastFilterBase {
}
}

mixin AnyInListMixin implements SembastFilterBase {
/// Any in list mixin.
mixin FilterAnyInListMixin implements SembastFilterBase {
/// True if it should match any in a list.
bool anyInList;
}

/// Value mixin.
mixin FilterValueMixin implements SembastFilterBase {
/// The value.
dynamic value;
}

mixin FieldFieldMixin implements SembastFilterBase {
/// Field information (name) mixin
mixin FilterFieldMixin implements SembastFilterBase {
/// The field.
String field;
}

/// Equals filter.
class SembastEqualsFilter extends SembastFilterBase
with AnyInListMixin, FilterValueMixin, FieldFieldMixin {
with FilterAnyInListMixin, FilterValueMixin, FilterFieldMixin {
/// Equals filter.
SembastEqualsFilter(String field, dynamic value, bool anyInList) {
this.field = field;
Expand Down Expand Up @@ -97,7 +100,7 @@ class SembastEqualsFilter extends SembastFilterBase

/// Matches filter.
class SembastMatchesFilter extends SembastFilterBase
with AnyInListMixin, FieldFieldMixin {
with FilterAnyInListMixin, FilterFieldMixin {
/// The regular expression.
final RegExp regExp;

Expand Down Expand Up @@ -183,7 +186,7 @@ class SembastCompositeFilter extends SembastFilterBase {

/// Filter predicate implementation.
class SembastFilterPredicate extends SembastFilterBase
with FilterValueMixin, FieldFieldMixin {
with FilterValueMixin, FilterFieldMixin {
/// The operation.
FilterOperation operation;

Expand Down
4 changes: 3 additions & 1 deletion sembast/lib/src/record_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ abstract class SembastRecord extends RecordSnapshot<dynamic, dynamic> {
bool get deleted;
}

/// Sembast record helper mixin.
mixin SembastRecordHelperMixin implements SembastRecord {
///
/// Copy a record.
Expand Down Expand Up @@ -47,7 +48,7 @@ mixin SembastRecordHelperMixin implements SembastRecord {
return map;
}

// The actual map written to disk
/// The actual map written to disk
Map<String, dynamic> toDatabaseRowMap() {
var map = _toBaseMap();
// Don't write the value for deleted
Expand Down Expand Up @@ -76,6 +77,7 @@ abstract class SembastRecordValue<V> {
V rawValue;
}

/// Sembast record mixin.
mixin SembastRecordMixin implements SembastRecord, SembastRecordValue {
bool _deleted;

Expand Down
1 change: 1 addition & 0 deletions sembast/lib/src/record_ref_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import 'package:sembast/src/debug_utils.dart';
import 'package:sembast/src/listener.dart';
import 'package:sembast/src/record_snapshot_impl.dart';

/// Record ref mixin.
mixin RecordRefMixin<K, V> implements RecordRef<K, V> {
@override
StoreRef<K, V> store;
Expand Down
1 change: 1 addition & 0 deletions sembast/lib/src/record_snapshot_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:sembast/src/api/sembast.dart';
import 'package:sembast/src/record_impl.dart';
import 'package:sembast/src/utils.dart';

/// Record snapshot mixin.
mixin RecordSnapshotMixin<K, V>
implements RecordSnapshot<K, V>, SembastRecordValue<V> {
/// Record revision.
Expand Down
1 change: 1 addition & 0 deletions sembast/lib/src/records_ref_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:sembast/src/api/sembast.dart';
import 'package:sembast/src/api/store_ref.dart';
import 'package:sembast/src/database_client_impl.dart';

/// Records ref mixin.
mixin RecordsRefMixin<K, V> implements RecordsRef<K, V> {
@override
StoreRef<K, V> store;
Expand Down
2 changes: 2 additions & 0 deletions sembast/lib/src/store_ref_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class SembastStoreRef<K, V> with StoreRefMixin<K, V> {
}
}

/// Store ref mixin.
mixin StoreRefMixin<K, V> implements StoreRef<K, V> {
@override
String name;
Expand Down Expand Up @@ -231,6 +232,7 @@ extension SembastStoreRefExtension<K, V> on StoreRef<K, V> {
}
}

/// Store factory mixin.
mixin StoreFactoryMixin<K, V> implements StoreFactory<K, V> {
@override
StoreRef<K, V> store([String name]) {
Expand Down

0 comments on commit acd67a6

Please sign in to comment.