Don't lock versions into compiled constants, underpinning shared lib could be
updated and we'd never know. FossilOrigin-Name: bb2f3334eee618c651acc8cd9859554f97ac29589145b17ac5d41b0f8bbada70
This commit is contained in:
parent
b40af50154
commit
5847c8dbf0
5 changed files with 9 additions and 11 deletions
6
USAGE.md
6
USAGE.md
|
|
@ -34,14 +34,14 @@ versions might work. Don't count too heavily on it. :-)
|
||||||
| v0.8.2 | v0.1.0 |
|
| v0.8.2 | v0.1.0 |
|
||||||
|
|
||||||
You can use the `kuzuVersionCompatible()` function (along with the
|
You can use the `kuzuVersionCompatible()` function (along with the
|
||||||
`KUZU_VERSION` and `KUZU_LIBVERSION` constants) to quickly check if things are
|
`kuzuGetVersion()` and the `KUZU_VERSION` constant) to quickly check if things
|
||||||
looking right.
|
are looking right.
|
||||||
|
|
||||||
```nim
|
```nim
|
||||||
import kuzu
|
import kuzu
|
||||||
|
|
||||||
echo KUZU_VERSION #=> "0.1.0"
|
echo KUZU_VERSION #=> "0.1.0"
|
||||||
echo KUZU_LIBVERSION #=> "0.8.2"
|
echo kuzuGetVersion() #=> "0.8.2"
|
||||||
echo kuzuVersionCompatible() #=> true
|
echo kuzuVersionCompatible() #=> true
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,14 +31,14 @@ include
|
||||||
proc kuzuVersionCompatible*(): bool =
|
proc kuzuVersionCompatible*(): bool =
|
||||||
## Returns true if the system installed Kuzu library
|
## Returns true if the system installed Kuzu library
|
||||||
## is the expected version of this library wrapper.
|
## is the expected version of this library wrapper.
|
||||||
result = KUZU_EXPECTED_LIBVERSION == KUZU_LIBVERSION
|
result = KUZU_EXPECTED_LIBVERSION == $kuzuGetVersion()
|
||||||
|
|
||||||
|
|
||||||
when isMainModule:
|
when isMainModule:
|
||||||
echo "Nim-Kuzu version: ", KUZU_VERSION,
|
echo "Nim-Kuzu version: ", KUZU_VERSION,
|
||||||
". Expected library version: ", KUZU_EXPECTED_LIBVERSION, "."
|
". Expected library version: ", KUZU_EXPECTED_LIBVERSION, "."
|
||||||
echo "Installed Kuzu library version ", KUZU_LIBVERSION,
|
echo "Installed Kuzu library version ", kuzuGetVersion(),
|
||||||
" (storage version ", KUZU_STORAGE_VERSION, ")"
|
" (storage version ", kuzuGetStorageVersion(), ")"
|
||||||
if kuzuVersionCompatible():
|
if kuzuVersionCompatible():
|
||||||
echo "Versions match!"
|
echo "Versions match!"
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,5 @@
|
||||||
const KUZU_VERSION* = "0.1.0"
|
const KUZU_VERSION* = "0.1.0"
|
||||||
const KUZU_EXPECTED_LIBVERSION* = "0.8.2"
|
const KUZU_EXPECTED_LIBVERSION* = "0.8.2"
|
||||||
|
|
||||||
let KUZU_LIBVERSION* = $kuzu_get_version()
|
|
||||||
let KUZU_STORAGE_VERSION* = kuzu_get_storage_version().int
|
|
||||||
let KUZU_DEFAULT_CONFIG* = kuzu_default_system_config()
|
let KUZU_DEFAULT_CONFIG* = kuzu_default_system_config()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,5 +3,6 @@
|
||||||
import re
|
import re
|
||||||
import kuzu
|
import kuzu
|
||||||
|
|
||||||
assert KUZU_LIBVERSION.contains( re"^\d+\.\d+\.\d+(?:\.\d+)?$" )
|
let version = $kuzuGetVersion()
|
||||||
|
assert version.contains( re"^\d+\.\d+\.\d+(?:\.\d+)?$" )
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,5 +2,5 @@
|
||||||
|
|
||||||
import kuzu
|
import kuzu
|
||||||
|
|
||||||
assert KUZU_STORAGE_VERSION >= 36
|
assert kuzuGetStorageVersion() >= 36
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue