Add tests and docs for toBlob. Bump version.

FossilOrigin-Name: d7358c9d8961f2b70f83ca4e19d4c43408e59cc169f072a238745060edb09de9
This commit is contained in:
Mahlon E. Smith 2025-04-19 17:45:53 +00:00
parent 7a85bfc7ac
commit e532c50e99
6 changed files with 78 additions and 19 deletions

View file

@ -501,3 +501,22 @@ for row in res:
# Bob has known Alice since 2009.
# Alice has known Bob since 2010.
```
### Blobs
Kuzu can store small chunks of opaque binary data. For these BLOB columns,
using `toBlob` will return the raw sequence of bytes.
```nim
var q = conn.query """
CREATE NODE TABLE Doot ( id SERIAL, data BLOB, PRIMARY KEY(id) )
"""
var stmt = conn.prepare( "CREATE (d:Doot {data: encode($str)})" )
q = stmt.execute( (str: "Hello!") )
q = conn.query( "MATCH (d:Doot) RETURN d.data" )
var blob = q.getNext[0].toBlob #=> @[72, 101, 108, 108, 111, 33]
```