Improve function naming

This commit is contained in:
Ming Ming 2022-08-05 19:11:10 +08:00
parent c118ffd60f
commit 40203bbdbc
2 changed files with 8 additions and 8 deletions

View file

@ -465,8 +465,8 @@ class FilesQueryBuilder {
_byRelativePath = path;
}
void byRelativePathPattern(String pattern) {
(_byRelativePathPatterns ??= []).add(pattern);
void byOrRelativePathPattern(String pattern) {
(_byOrRelativePathPatterns ??= []).add(pattern);
}
void byMimePattern(String pattern) {
@ -536,11 +536,11 @@ class FilesQueryBuilder {
if (_byRelativePath != null) {
query.where(db.accountFiles.relativePath.equals(_byRelativePath));
}
if (_byRelativePathPatterns?.isNotEmpty == true) {
final expression = _byRelativePathPatterns!
if (_byOrRelativePathPatterns?.isNotEmpty == true) {
final expression = _byOrRelativePathPatterns!
.sublist(1)
.fold<Expression<bool?>>(
db.accountFiles.relativePath.like(_byRelativePathPatterns![0]),
db.accountFiles.relativePath.like(_byOrRelativePathPatterns![0]),
(previousValue, element) =>
previousValue | db.accountFiles.relativePath.like(element));
query.where(expression);
@ -582,7 +582,7 @@ class FilesQueryBuilder {
int? _byFileId;
Iterable<int>? _byFileIds;
String? _byRelativePath;
List<String>? _byRelativePathPatterns;
List<String>? _byOrRelativePathPatterns;
List<String>? _byMimePatterns;
bool? _byFavorite;
int? _byDirRowId;

View file

@ -31,7 +31,7 @@ class ScanDirOffline {
..setAppAccount(account);
root.strippedPathWithEmpty.run((p) {
if (p.isNotEmpty) {
q.byRelativePathPattern("$p/%");
q.byOrRelativePathPattern("$p/%");
}
});
if (isOnlySupportedFormat) {
@ -80,7 +80,7 @@ class ScanDirOfflineMini {
if (path.isEmpty) {
break;
}
q.byRelativePathPattern("$path/%");
q.byOrRelativePathPattern("$path/%");
}
if (isOnlySupportedFormat) {
q