clerk

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 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 added in v0.2.6

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

func NewQuery

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

func NewSearch added in v0.3.0

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

func NewUpdate

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

func NewWatch added in v0.3.0

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 added in v0.3.0

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 added in v0.3.1

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

func NewDatabase

func NewDatabase(name string) *Database

func (*Database) Collection added in v0.3.1

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

type Deleter added in v0.2.6

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

type Operation added in v0.3.0

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

func (Operation) String added in v0.3.0

func (o Operation) String() string

type Querier added in v0.2.2

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

type Searcher added in v0.3.0

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 added in v0.3.0

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