Caravan is a set of in-process message streaming tools for Go applications. Think "Kafka", but for the internal workings of your software. Caravan DB includes features for managing Relational Tables and Indexes.
This is a work in progress. Not at all ready to be used for any purpose
Caravan DB is a "Database as a Function." What this means is that the database manages a single persistent data structure exposed via a transactor function. The transactor function will invoke a provided query and automatically return a new version of the database if that query is successful.
For example:
package main
import (
"github.com/caravan/db"
"github.com/caravan/db/column"
"github.com/caravan/db/database"
)
func main() {
empty := db.NewDatabase()
stuff, _ := empty(func(d database.Database) error {
tbl, _ := d.CreateTable("some-table",
column.Make("first_name"),
column.Make("last_name"),
)
_ = tbl.CreateIndex(db.StandardIndex, "full-name",
"last_name", "first_name",
)
return nil
})
}
The variable empty
will point to the original empty database, whereas the variable stuff
will point to a new version of the database that contains a table called "some-table"
.