20 lines
457 B
Nim
20 lines
457 B
Nim
|
|
import
|
|
preserves, std/tables
|
|
|
|
type
|
|
Document* {.preservesRecord: "document".} = object
|
|
`id`*: BiggestInt
|
|
`data`*: seq[byte]
|
|
|
|
ValueSlots* = Table[BiggestInt, Preserve[void]]
|
|
DatabaseInfo* {.preservesRecord: "xapian".} = object
|
|
`uuid`*: string
|
|
`path`*: string
|
|
|
|
proc `$`*(x: Document | ValueSlots | DatabaseInfo): string =
|
|
`$`(toPreserve(x))
|
|
|
|
proc encode*(x: Document | ValueSlots | DatabaseInfo): seq[byte] =
|
|
encode(toPreserve(x))
|