db

package module
v0.0.0-...-576298e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 19, 2023 License: MIT Imports: 2 Imported by: 0

README

Caravan DB

Go Report Card Build Status Test Coverage Maintainability GitHub

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

Introduction

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".

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// UniqueIndex is an index.Type that allows only unique associations
	UniqueIndex = internal.UniqueIndex

	// StandardIndex is an index.Type that allows multiple associations
	StandardIndex = internal.StandardIndex
)

Functions

func NewDatabase

func NewDatabase() database.Transactor

NewDatabase returns a new Transactor instance

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL