mongodb

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MongodbCollectionOperator added in v1.1.0

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

func NewMongoCollectionOperator added in v1.1.0

func NewMongoCollectionOperator(connection *MongodbConnection) *MongodbCollectionOperator

func (*MongodbCollectionOperator) Drop added in v1.1.0

func (o *MongodbCollectionOperator) Drop(
	ctx context.Context,
	collection *clerk.Collection,
) error

func (*MongodbCollectionOperator) List added in v1.2.0

func (o *MongodbCollectionOperator) List(
	ctx context.Context,
	database *clerk.Database,
) ([]*clerk.Collection, error)

func (*MongodbCollectionOperator) Rename added in v1.1.0

func (o *MongodbCollectionOperator) Rename(
	ctx context.Context,
	collection *clerk.Collection,
	renameTo string,
	drop bool,
) (*clerk.Collection, error)

type MongodbConnection

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

func NewMongoConnection

func NewMongoConnection(ctx context.Context, url string) (*MongodbConnection, error)

func (*MongodbConnection) Close

func (c *MongodbConnection) Close(handler func(err error))

func (*MongodbConnection) WithTransaction

func (c *MongodbConnection) WithTransaction(ctx context.Context, fn MongodbTransactionFunc) error

type MongodbOperator

type MongodbOperator[T any] struct {
	// contains filtered or unexported fields
}

func NewMongoOperator

func NewMongoOperator[T any](connection *MongodbConnection) *MongodbOperator[T]

func (*MongodbOperator[T]) Create

func (c *MongodbOperator[T]) Create(
	ctx context.Context,
	collection *clerk.Collection,
	data T,
) error

func (*MongodbOperator[T]) Delete

func (c *MongodbOperator[T]) Delete(
	ctx context.Context,
	collection *clerk.Collection,
	filter map[string]any,
) error

func (*MongodbOperator[T]) Query

func (c *MongodbOperator[T]) Query(
	ctx context.Context,
	collection *clerk.Collection,
	filter map[string]any,
	sorting map[string]bool,
	skip int,
	take int,
) (<-chan T, error)

func (*MongodbOperator[T]) Update

func (c *MongodbOperator[T]) Update(
	ctx context.Context,
	collection *clerk.Collection,
	filter map[string]any,
	data T,
	upsert bool,
) error

func (*MongodbOperator[T]) Watch

func (c *MongodbOperator[T]) Watch(
	ctx context.Context,
	collection *clerk.Collection,
	operation clerk.Operation,
) (<-chan T, error)

type MongodbTransactionFunc

type MongodbTransactionFunc func(ctx context.Context) error

Jump to

Keyboard shortcuts

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