mirror of
https://github.com/logos-storage/nim-datastore.git
synced 2026-01-02 21:53:05 +00:00
32 lines
494 B
Nim
32 lines
494 B
Nim
import ./key
|
|
|
|
type
|
|
SortOrder* {.pure.} = enum
|
|
Assending,
|
|
Descensing
|
|
|
|
Query* = object
|
|
key*: Key
|
|
value*: bool
|
|
limit*: int
|
|
skip*: int
|
|
sort*: SortOrder
|
|
|
|
QueryResponse* = tuple[key: Key, data: seq[byte]]
|
|
QueryIter* = iterator(): QueryResponse {.closure.}
|
|
|
|
proc init*(
|
|
T: type Query,
|
|
key: Key,
|
|
value = false,
|
|
sort = SortOrder.Descensing,
|
|
skip = 0,
|
|
limit = 0): T =
|
|
|
|
T(
|
|
key: key,
|
|
value: value,
|
|
sort: sort,
|
|
skip: skip,
|
|
limit: limit)
|