mongodb

package
v3.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnknownFilter = errors.New("unknown filter")
)

Functions

This section is empty.

Types

type CollectionOperator

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

func NewCollectionOperator

func NewCollectionOperator(connection *Connection, database *clerk.Database) *CollectionOperator

func (*CollectionOperator) ExecuteDelete

func (d *CollectionOperator) ExecuteDelete(
	ctx context.Context,
	delete *clerk.Delete[*clerk.Collection],
) (int, error)

func (*CollectionOperator) ExecuteQuery

func (q *CollectionOperator) ExecuteQuery(
	ctx context.Context,
	query *clerk.Query[*clerk.Collection],
) (<-chan *clerk.Collection, error)

func (*CollectionOperator) ExecuteUpdate

func (u *CollectionOperator) ExecuteUpdate(
	ctx context.Context,
	update *clerk.Update[*clerk.Collection],
) error

type Config

type Config struct {
	Uri     string
	Timeout time.Duration
}

func DefaultConfig

func DefaultConfig(uri string) Config

func (Config) GetContext

func (c Config) GetContext(ctx context.Context) (context.Context, context.CancelFunc)

type Connection

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

func NewConnection

func NewConnection(
	ctx context.Context,
	config Config,
) (*Connection, error)

func (*Connection) Close

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

type DatabaseOperator

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

func NewDatabaseOperator

func NewDatabaseOperator(connection *Connection) *DatabaseOperator

func (*DatabaseOperator) ExecuteDelete

func (d *DatabaseOperator) ExecuteDelete(
	ctx context.Context,
	delete *clerk.Delete[*clerk.Database],
) (int, error)

func (*DatabaseOperator) ExecuteQuery

func (q *DatabaseOperator) ExecuteQuery(
	ctx context.Context,
	query *clerk.Query[*clerk.Database],
) (<-chan *clerk.Database, error)

func (*DatabaseOperator) ExecuteTransaction

func (t *DatabaseOperator) ExecuteTransaction(ctx context.Context, fn clerk.TransactionFn) error

type IndexOperator

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

func NewIndexOperator

func NewIndexOperator(connection *Connection, collection *clerk.Collection) *IndexOperator

func (*IndexOperator) ExecuteCreate

func (c *IndexOperator) ExecuteCreate(
	ctx context.Context,
	create *clerk.Create[*clerk.Index],
) error

func (*IndexOperator) ExecuteDelete

func (d *IndexOperator) ExecuteDelete(
	ctx context.Context,
	delete *clerk.Delete[*clerk.Index],
) (int, error)

func (*IndexOperator) ExecuteQuery

func (q *IndexOperator) ExecuteQuery(
	ctx context.Context,
	query *clerk.Query[*clerk.Index],
) (<-chan *clerk.Index, error)

type Operator

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

func NewOperator

func NewOperator[T any](connection *Connection, collection *clerk.Collection) *Operator[T]

func (*Operator) ExecuteCreate

func (c *Operator) ExecuteCreate(
	ctx context.Context,
	create *clerk.Create[T],
) error

func (*Operator) ExecuteDelete

func (d *Operator) ExecuteDelete(
	ctx context.Context,
	delete *clerk.Delete[T],
) (int, error)

func (*Operator) ExecuteQuery

func (q *Operator) ExecuteQuery(
	ctx context.Context,
	query *clerk.Query[T],
) (<-chan T, error)

func (*Operator) ExecuteUpdate

func (u *Operator) ExecuteUpdate(ctx context.Context, update *clerk.Update[T]) error

func (*Operator) ExecuteWatch

func (w *Operator) ExecuteWatch(
	ctx context.Context,
	watch *clerk.Watch[T],
) (<-chan *clerk.Event[T], error)

Jump to

Keyboard shortcuts

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