Use libimagstore get iterator
Use libimagstore infrastructure to transform iterator in StoreIdGetIterator for getting entries from store.
This commit is contained in:
parent
3b138ba881
commit
97e613d8c5
2 changed files with 13 additions and 1 deletions
|
@ -29,3 +29,4 @@ libimagerror = { version = "0.6.0", path = "../../../lib/core/libimagerror"
|
||||||
libimagnotes = { version = "0.6.0", path = "../../../lib/domain/libimagnotes" }
|
libimagnotes = { version = "0.6.0", path = "../../../lib/domain/libimagnotes" }
|
||||||
libimagentryedit = { version = "0.6.0", path = "../../../lib/entry/libimagentryedit" }
|
libimagentryedit = { version = "0.6.0", path = "../../../lib/entry/libimagentryedit" }
|
||||||
libimagutil = { version = "0.6.0", path = "../../../lib/etc/libimagutil" }
|
libimagutil = { version = "0.6.0", path = "../../../lib/etc/libimagutil" }
|
||||||
|
libimagstore = { version = "0.6.0", path = "../../../lib/core/libimagstore" }
|
||||||
|
|
|
@ -26,15 +26,21 @@ extern crate libimagrt;
|
||||||
extern crate libimagentryedit;
|
extern crate libimagentryedit;
|
||||||
extern crate libimagerror;
|
extern crate libimagerror;
|
||||||
extern crate libimagutil;
|
extern crate libimagutil;
|
||||||
|
extern crate libimagstore;
|
||||||
|
|
||||||
|
use std::process::exit;
|
||||||
|
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
|
|
||||||
use libimagentryedit::edit::Edit;
|
use libimagentryedit::edit::Edit;
|
||||||
use libimagrt::runtime::Runtime;
|
use libimagrt::runtime::Runtime;
|
||||||
use libimagrt::setup::generate_runtime_setup;
|
use libimagrt::setup::generate_runtime_setup;
|
||||||
|
use libimagstore::iter::get::StoreIdGetIteratorExtension;
|
||||||
use libimagnotes::note::Note;
|
use libimagnotes::note::Note;
|
||||||
use libimagnotes::notestore::*;
|
use libimagnotes::notestore::*;
|
||||||
use libimagerror::trace::MapErrTrace;
|
use libimagerror::trace::MapErrTrace;
|
||||||
|
use libimagerror::trace::trace_error_exit;
|
||||||
|
use libimagerror::iter::TraceIterator;
|
||||||
use libimagutil::info_result::*;
|
use libimagutil::info_result::*;
|
||||||
use libimagutil::warn_result::WarnResult;
|
use libimagutil::warn_result::WarnResult;
|
||||||
|
|
||||||
|
@ -114,7 +120,12 @@ fn list(rt: &Runtime) {
|
||||||
.store()
|
.store()
|
||||||
.all_notes()
|
.all_notes()
|
||||||
.map_err_trace_exit_unwrap(1)
|
.map_err_trace_exit_unwrap(1)
|
||||||
.filter_map(|noteid| rt.store().get(noteid).map_err_trace_exit_unwrap(1))
|
.into_get_iter(rt.store())
|
||||||
|
.unwrap_with(|e| trace_error_exit(&e, 1))
|
||||||
|
.map(|opt| opt.unwrap_or_else(|| {
|
||||||
|
error!("Fatal: Nonexistent entry where entry should exist");
|
||||||
|
exit(1)
|
||||||
|
}))
|
||||||
.sorted_by(|note_a, note_b| if let (Ok(a), Ok(b)) = (note_a.get_name(), note_b.get_name()) {
|
.sorted_by(|note_a, note_b| if let (Ok(a), Ok(b)) = (note_a.get_name(), note_b.get_name()) {
|
||||||
return a.cmp(&b)
|
return a.cmp(&b)
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue