mirror of
https://github.com/logos-storage/nim-datastore.git
synced 2026-01-06 23:53:09 +00:00
databuffer type
This commit is contained in:
parent
8b4f388bb3
commit
8800a2ccc0
@ -10,7 +10,7 @@ import ./key
|
|||||||
import ./types
|
import ./types
|
||||||
|
|
||||||
export databuffer, threadresult, semaphore, types
|
export databuffer, threadresult, semaphore, types
|
||||||
export upraises, results
|
export upraises, results, SortOrder
|
||||||
|
|
||||||
type
|
type
|
||||||
KeyId* = object
|
KeyId* = object
|
||||||
@ -29,7 +29,7 @@ type
|
|||||||
offset*: int # Offset from which to start querying - not available in all backends
|
offset*: int # Offset from which to start querying - not available in all backends
|
||||||
sort*: SortOrder # Sort order - not available in all backends
|
sort*: SortOrder # Sort order - not available in all backends
|
||||||
|
|
||||||
DbQueryResponse* = tuple[key: Option[string], data: seq[byte]] | tuple[key: Option[KeyId], data: DataBuffer]
|
DbQueryResponse* = tuple[key: Option[KeyId], val: DataBuffer]
|
||||||
|
|
||||||
proc `$`*(id: KeyId): string = $(id.data)
|
proc `$`*(id: KeyId): string = $(id.data)
|
||||||
|
|
||||||
|
|||||||
@ -104,11 +104,10 @@ proc close*(self: SQLiteDatastore): ?!void =
|
|||||||
|
|
||||||
|
|
||||||
iterator query*(self: SQLiteDatastore,
|
iterator query*(self: SQLiteDatastore,
|
||||||
query: Query
|
query: DbQuery
|
||||||
): ?!ThreadQueryRes =
|
): ?!DbQueryResponse {.closure.} =
|
||||||
|
|
||||||
var
|
var
|
||||||
iter = QueryIter()
|
|
||||||
queryStr = if query.value:
|
queryStr = if query.value:
|
||||||
QueryStmtDataIdStr
|
QueryStmtDataIdStr
|
||||||
else:
|
else:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user