cozo icon indicating copy to clipboard operation
cozo copied to clipboard

What is the params argument for in the C library?

Open crystalthoughts opened this issue 1 year ago • 1 comments

Hi, there doesn't seem to be any documentation for what 'parameters' are expected by the API.

I was looking for a way to limit or prevent returning very large strings after a large data input query. One might assume this might be a passed param, but perhaps it means something different.

Could you advise on the above? Thanks

crystalthoughts avatar Jan 05 '24 22:01 crystalthoughts

It appears to be a JSON encoded map, looking at cozo.go which wraps the C library for Go. That said, the cozo_test.go doesn't actually use this at all -- so it is not obvious to me what this from either the C or Go wrappers.

The Python wrapper, however, has this:

res = client.run('?[] <- [[$name]]', {'name': 'Python'})

And that probably is enough of an example to figure it out. The parameters are a JSON object whose fields you can reference from Cozoscript to parameterize a query.

swdunlop avatar May 15 '24 20:05 swdunlop