database

package
v0.0.0-...-988e9ee Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const MongoDB = "mongodb"

Variables

View Source
var ErrDuplicateKey = errors.New("document already exists")
View Source
var ErrNoDocuments = errors.New("document does not exist")

Functions

func SliceBuf

func SliceBuf[T any](iter Iterator[T], bufSize int64) ([]T, error)

Types

type Controller

type Controller[T any] interface {
	// Insert inserts a log into the database
	Insert(context.Context, T) error

	// Get gets a log from the database
	Get(context.Context, string) (T, error)

	// Update updates a log in the database
	Update(context.Context, string, updates.Updates[T]) error

	// Delete deletes a log from the database
	Delete(context.Context, string) error

	// Count counts the number of logs in the database
	Count(context.Context) (int64, error)

	// Find finds a set of logs in the database
	Find(context.Context, find.Query[T], find.Options[T]) (Iterator[T], error)
}

type Iterator

type Iterator[T any] interface {
	Chan() chan T
	Err() error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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