lib/cli: add timing logs to query commands
This commit is contained in:
@@ -29,12 +29,16 @@ class QueryKanji extends Command {
|
||||
libsqlitePath: argResults!.option('libsqlite')!,
|
||||
);
|
||||
|
||||
final time = Stopwatch()..start();
|
||||
final result = await JaDBConnection(db).searchKanji('漢');
|
||||
time.stop();
|
||||
|
||||
if (result == null) {
|
||||
print("No such kanji");
|
||||
} else {
|
||||
print(JsonEncoder.withIndent(' ').convert(result.toJson()));
|
||||
}
|
||||
|
||||
print("Query took ${time.elapsedMilliseconds}ms");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,9 @@ class QueryWord extends Command {
|
||||
libsqlitePath: argResults!.option('libsqlite')!,
|
||||
);
|
||||
|
||||
final time = Stopwatch()..start();
|
||||
final result = await JaDBConnection(db).searchWord('かな');
|
||||
time.stop();
|
||||
|
||||
if (result == null) {
|
||||
print("Invalid search");
|
||||
@@ -39,5 +41,7 @@ class QueryWord extends Command {
|
||||
print(JsonEncoder.withIndent(' ')
|
||||
.convert(result.map((e) => e.toJson()).toList()));
|
||||
}
|
||||
|
||||
print("Query took ${time.elapsedMilliseconds}ms");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user