refactor - tests

This commit is contained in:
Jaremy Creechley 2023-09-27 19:18:37 -07:00
parent ade0898fe7
commit cac5d52b35
No known key found for this signature in database
GPG Key ID: 4E66FB67B21D3300
2 changed files with 6 additions and 4 deletions

View File

@ -51,8 +51,9 @@ proc dbQuery*[K](
proc `$`*(id: KeyId): string = $(id.data)
proc toKey*(tp: typedesc[KeyId], id: cstring): KeyId = KeyId.new(id)
proc toKey*(tp: typedesc[string], id: cstring): string = $(id)
proc toKey*(tp: typedesc[KeyId], id: string|cstring): KeyId = KeyId.new($id)
proc toKey*(tp: typedesc[string], id: string|cstring): string = $(id)
# proc toKey*(tp: typedesc[Key], id: string|cstring): KeyId = Key.init($id).expect("valid key")
template toVal*(tp: typedesc[DataBuffer], id: openArray[byte]): DataBuffer = DataBuffer.new(id)
template toVal*(tp: typedesc[seq[byte]], id: openArray[byte]): seq[byte] = @(id)

View File

@ -204,8 +204,9 @@ proc query*[K,V](
let env = FsQueryEnv[K,V](self: self, basePath: DataBuffer.new(basePath))
success DbQueryHandle[KeyId, V, FsQueryEnv[K,V]](query: query, env: env)
iterator iter*[K, V](handle: var DbQueryHandle[K, V, FsQueryEnv[K,V]]): ?!DbQueryResponse[K, V] =
let root = $(handle.env)
iterator iter*[K, V](handle: var DbQueryHandle[K, V, FsQueryEnv[K,V]]
): ?!DbQueryResponse[K, V] =
let root = $(handle.env.self.root)
echo "FS:root: ", root
for path in root.dirIter():