mirror of
https://github.com/logos-storage/nim-datastore.git
synced 2026-01-05 23:23:10 +00:00
updates
This commit is contained in:
parent
a8da4c4f38
commit
4844f7dad0
@ -3,6 +3,8 @@
|
|||||||
--styleCheck:usages
|
--styleCheck:usages
|
||||||
--styleCheck:error
|
--styleCheck:error
|
||||||
|
|
||||||
|
--d:"datastoreUseAsync=false"
|
||||||
|
|
||||||
when (NimMajor, NimMinor) == (1, 2):
|
when (NimMajor, NimMinor) == (1, 2):
|
||||||
switch("hint", "Processing:off")
|
switch("hint", "Processing:off")
|
||||||
switch("hint", "XDeclaredButNotUsed:off")
|
switch("hint", "XDeclaredButNotUsed:off")
|
||||||
|
|||||||
@ -78,17 +78,14 @@ else:
|
|||||||
type
|
type
|
||||||
SQLiteDatastore* = ref object of Datastore
|
SQLiteDatastore* = ref object of Datastore
|
||||||
readOnly: bool
|
readOnly: bool
|
||||||
db: SQLiteDsDb
|
db: SQLiteDsDb[string, seq[byte]]
|
||||||
|
|
||||||
proc path*(self: SQLiteDatastore): string =
|
proc path*(self: SQLiteDatastore): string =
|
||||||
self.db.dbPath
|
$self.db.dbPath
|
||||||
|
|
||||||
proc `readOnly=`*(self: SQLiteDatastore): bool
|
proc `readOnly=`*(self: SQLiteDatastore): bool
|
||||||
{.error: "readOnly should not be assigned".}
|
{.error: "readOnly should not be assigned".}
|
||||||
|
|
||||||
proc timestamp*(t = epochTime()): int64 =
|
|
||||||
(t * 1_000_000).int64
|
|
||||||
|
|
||||||
method has*(self: SQLiteDatastore, key: Key): Future[?!bool] {.async.} =
|
method has*(self: SQLiteDatastore, key: Key): Future[?!bool] {.async.} =
|
||||||
var
|
var
|
||||||
exists = false
|
exists = false
|
||||||
@ -129,7 +126,7 @@ else:
|
|||||||
bytes: seq[byte]
|
bytes: seq[byte]
|
||||||
|
|
||||||
proc onData(s: RawStmtPtr) =
|
proc onData(s: RawStmtPtr) =
|
||||||
bytes = self.db.getDataCol()
|
bytes = dataCol[seq[byte]](self.db.getDataCol)
|
||||||
|
|
||||||
if err =? self.db.getStmt.query((key.id), onData).errorOption:
|
if err =? self.db.getStmt.query((key.id), onData).errorOption:
|
||||||
return failure(err)
|
return failure(err)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user