~ehmry/nim-tkrzw

5f6677d8b8467a9e34f5b0d0743b10ab3d4deae0 — Emery Hemingway 3 years ago 5488551
Make overwriting optional in set(…)
1 files changed, 2 insertions(+), 2 deletions(-)

M src/tkrzw.nim
M src/tkrzw.nim => src/tkrzw.nim +2 -2
@@ 156,8 156,8 @@ proc get*[A,B](dbm; key: A; result: var B) =
  copyMem(addr result[0], buf.data, result.len)
    # TODO: is this copy avoidable?

proc set*[A,B](dbm; key: A; value: B) =
  dbm.Set(key.toStringView, value.toStringView, true)
proc set*[A,B](dbm; key: A; value: B; overwrite = true) =
  dbm.Set(key.toStringView, value.toStringView, overwrite)

proc `[]`*(dbm; key: string): string {.inline.} = get(dbm, key, result)