1.4 KiB
Getting Started
The exceedingly quick version:
- Add the desired module/package to your dependencies
- Implement an instance of the
DocumentSerializer
interface and assign it to theDocumentConfig.serializer
property (for all but kotlinx) - Set a PostgreSQL or SQLite JDBC connection string for the
Configuration.connectionString
property
At this point, Connection.dbConn()
will provide a connection which can be used either for function calls or extension method calls. You will also be able to call functions without providing a connection, and the library will create one for that command. (Database pooling will help reduce connection overhead when using this technique.)
From there, Definition.ensureTable(name)
will create a table, and you are ready to start manipulating documents!
(Documentation is in active development; until it is more complete, the flow is very similar to BitBadger.Documents, the .NET implementation of a similar library. This library also supports Json
in place of Find
to return raw JSON, and Json.write*
to write that JSON to a PrintWriter
, bypassing the entire deserialize-from-the-database, serialize-to-the-output-body process.)
Examples
Each library has an exhaustive suite of integration tests; reviewing those may also provide insight into the patterns used for effective document storage and retrieval.