clerk

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2022 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func NewCreate

func NewCreate[T any](collection *Collection, data T) *create[T]

func NewDelete

func NewDelete[T any](collection *Collection) *delete[T]

func NewQuery

func NewQuery[T any](collection *Collection) *query[T]

func NewSearch

func NewSearch[T any](collection *Collection, query string) *search[T]

func NewUpdate

func NewUpdate[T any](collection *Collection, data T) *update[T]

func NewWatch

func NewWatch[T any](collection *Collection, operations ...Operation) *watch[T]

Types

type Collection

type Collection struct {
	Database string
	Name     string
}

func NewCollection

func NewCollection(name string) *Collection

func NewCollectionWithDatabase

func NewCollectionWithDatabase(
	database string,
	name string,
) *Collection

type Creator

type Creator[T any] interface {
	Create(
		ctx context.Context,
		collection *Collection,
		data T,
	) error
}

type Database

type Database struct {
	// contains filtered or unexported fields
}

func NewDatabase

func NewDatabase(name string) *Database

func (*Database) Collection

func (d *Database) Collection(name string) *Collection

type Deleter

type Deleter[T any] interface {
	Delete(
		ctx context.Context,
		collection *Collection,
		filter map[string]any,
	) error
}

type Operation

type Operation int
const (
	Create Operation = iota
	Delete
	Update
)

func (Operation) String

func (o Operation) String() string

type Querier

type Querier[T any] interface {
	Query(
		ctx context.Context,
		collection *Collection,
		filter map[string]any,
		sorting map[string]bool,
		skip int,
		take int,
	) (<-chan T, error)
}

type Searcher

type Searcher[T any] interface {
	Search(
		ctx context.Context,
		collection *Collection,
		query string,
		highlight []string,
		filterable []string,
		filterQuery string,
		skip int,
		take int,
	) (<-chan T, error)
}

type Updater

type Updater[T any] interface {
	Update(
		ctx context.Context,
		collection *Collection,
		filter map[string]any,
		data T,
		upsert bool,
	) error
}

type Watcher

type Watcher[T any] interface {
	Watch(
		ctx context.Context,
		collection *Collection,
		operation Operation,
	) (<-chan T, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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