mirror of
https://github.com/immich-app/immich.git
synced 2026-02-13 12:27:56 +03:00
28 lines
683 B
Dart
28 lines
683 B
Dart
import 'dart:async';
|
|
|
|
import 'package:immich_mobile/domain/models/store.model.dart';
|
|
|
|
abstract class IStoreConverter<T, U> {
|
|
const IStoreConverter();
|
|
|
|
/// Converts the value T to the primitive type U supported by the Store
|
|
U toPrimitive(T value);
|
|
|
|
/// Converts the value back to T? from the primitive type U from the Store
|
|
FutureOr<T?> fromPrimitive(U value);
|
|
}
|
|
|
|
abstract interface class IStoreRepository {
|
|
Future<bool> upsert<T, U>(StoreKey<T, U> key, T value);
|
|
|
|
Future<T> get<T, U>(StoreKey<T, U> key);
|
|
|
|
Future<T?> tryGet<T, U>(StoreKey<T, U> key);
|
|
|
|
Stream<T?> watch<T, U>(StoreKey<T, U> key);
|
|
|
|
Future<void> delete(StoreKey key);
|
|
|
|
Future<void> deleteAll();
|
|
}
|