Skip to content

Commit

Permalink
fixup! rename for refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
zin- committed Aug 5, 2024
1 parent df330cd commit cde092b
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/framework/repository/database_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import 'package:mem/framework/database/factory.dart';
import 'package:mem/framework/repository/repository.dart';
import 'package:mem/logger/log_service.dart';

class DatabaseRepository extends Repository<DatabaseDefinition>
class DatabaseRepository extends RepositoryV2<DatabaseDefinition>
with Receiver<DatabaseDefinition, DatabaseAccessor> {
static DatabaseRepository? _instance;

Expand Down
4 changes: 2 additions & 2 deletions lib/framework/repository/key_with_value_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import 'package:mem/framework/repository/key_with_value.dart';
import 'package:mem/framework/repository/repository.dart';

abstract class KeyWithValueRepository<E extends KeyWithValue<Key, dynamic>, Key>
extends Repository<E>
extends RepositoryV2<E>
with Receiver<E, bool>, DiscarderByKey<E, Key, bool> {}

mixin DiscarderByKey<E extends KeyWithValue<Key, dynamic>, Key, Result>
on Repository<E> {
on RepositoryV2<E> {
Future<Result> discard(Key key);
}
7 changes: 4 additions & 3 deletions lib/framework/repository/repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,19 @@ import 'package:mem/framework/repository/entity.dart';
// 抽象的には得ると捉える事もできるだろうが、では`update`(更新する)ことはあるだろうか?
// 更新することはないように感じる
// よって、ここでは`receive`(受け取る)、`replace`(置き換える)などの荷物や事物を扱う際の単語を採用する
abstract class Repository<E extends EntityV2> {}
abstract class RepositoryV2<E extends EntityV2> {}

mixin Receiver<E extends EntityV2, Result> on Repository<E> {
mixin Receiver<E extends EntityV2, Result> on RepositoryV2<E> {
Future<Result> receive(E entity);
}

// FIXME 型指定は不要なはずなので、おかしい?(間違っている気がする
// というか、mixinの利用自体がなんか変なので辞めたほうが良いかも
mixin Discarder<E extends EntityV2> on Repository<E> {
mixin Discarder<E extends EntityV2> on RepositoryV2<E> {
Future<void> discardAll();
}

abstract class RepositoryV1<E extends EntityV1, Result> {
Future<Result> receive(E entity);
}

2 changes: 1 addition & 1 deletion lib/logger/log_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:mem/framework/repository/repository.dart';
import 'log.dart';
import 'logger_wrapper.dart';

class LogRepository extends Repository<Log> with Receiver<Log, void> {
class LogRepository extends RepositoryV2<Log> with Receiver<Log, void> {
LoggerWrapper _loggerWrapper;

@override
Expand Down
2 changes: 1 addition & 1 deletion lib/notifications/schedule_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import 'package:mem/notifications/schedule.dart';
import 'package:mem/permissions/permission.dart';
import 'package:mem/permissions/permission_handler_wrapper.dart';

class ScheduleClient extends Repository<Schedule>
class ScheduleClient extends RepositoryV2<Schedule>
with Receiver<Schedule, void> {
static ScheduleClient? _instance;
final AndroidAlarmManagerWrapper _androidAlarmManagerWrapper;
Expand Down

0 comments on commit cde092b

Please sign in to comment.