For the complete documentation index, see llms.txt. This page is also available as Markdown.

Examples Overview

This document provides links to detailed examples for using the various ChronDB interfaces.

ChronDB supports multiple access protocols, allowing you to choose the interface that best suits your needs:

Clojure API

The native Clojure API offers the most direct way to interact with ChronDB, providing access to all features including CRUD operations, searching, version control, and branching.

;; Basic example
(require '[chrondb.core :as chrondb])
(def db (chrondb/create-chrondb))
(chrondb/save db "user:1" {:name "Alice" :email "[email protected]"})

REST API

The REST API allows you to interact with ChronDB using HTTP requests, making it easy to integrate with any programming language or environment that can make HTTP requests.

# Create a document using curl
curl -X POST http://localhost:3000/api/v1/documents/user:1 \
  -H "Content-Type: application/json" \
  -d '{"name": "John Doe", "email": "[email protected]"}'

Redis Protocol

ChronDB implements a subset of the Redis protocol, allowing you to connect using standard Redis clients.

PostgreSQL Protocol

ChronDB implements a subset of the PostgreSQL protocol, allowing you to connect using standard PostgreSQL clients and leverage SQL query capabilities.

Examples by Protocol

For more detailed examples, see:

SQL History Functions

Here are examples of using the SQL history functions:

Document History

To retrieve the complete history of a document:

Point-in-Time Document Access

To access documents at specific points in time:

Document Version Comparison

To compare different versions of a document:

These examples demonstrate how to leverage ChronDB's history tracking capabilities using the SQL interface.


Choose the interface that best suits your needs and refer to the specific documentation for detailed examples and use cases.

Last updated

Was this helpful?