client

package
v0.0.0-...-1b76716 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	Connect(context.Context) error
	Disconnect(context.Context) error

	Database(string) Database
	ListDatabaseNames(context.Context, interface{}) ([]string, error)
}

func WrapClient

func WrapClient(c *mongo.Client) Client

type Collection

type Collection interface {
	Aggregate(context.Context, interface{}, ...*options.AggregateOptions) (Cursor, error)
	Find(context.Context, interface{}, ...*options.FindOptions) (Cursor, error)
	FindOne(context.Context, interface{}, ...*options.FindOneOptions) SingleResult
	Name() string
	ReplaceOne(context.Context, interface{}, interface{}, ...*options.ReplaceOptions) (*UpdateResult, error)
	UpdateOne(context.Context, interface{}, interface{}, ...*options.UpdateOptions) (*UpdateResult, error)
	UpdateMany(context.Context, interface{}, interface{}, ...*options.UpdateOptions) (*UpdateResult, error)
	InsertOne(context.Context, interface{}) (*InsertOneResult, error)
	InsertMany(context.Context, []interface{}) (*InsertManyResult, error)
}

type Cursor

type Cursor interface {
	Current() []byte
	All(context.Context, interface{}) error
	Close(context.Context) error
	Decode(interface{}) error
	Err() error
	ID() int64
	Next(context.Context) bool
}

type Database

type Database interface {
	Client() Client
	Collection(string) Collection
	Name() string
	RunCommand(context.Context, interface{}) SingleResult
	RunCommandCursor(context.Context, interface{}) (Cursor, error)
}

type InsertManyResult

type InsertManyResult = mongo.InsertManyResult

type InsertOneResult

type InsertOneResult = mongo.InsertOneResult

type MigrationOperation

type MigrationOperation func(Client, *birch.Document) error

MigrationOperation defines the function object that performs the transformation in the manual migration migrations. Register these functions using RegisterMigrationOperation.

Implementors of MigrationOperations are responsible for implementing idempotent operations.

type Processor

type Processor interface {
	Load(Client, model.Namespace, map[string]interface{}) Cursor
	Migrate(Cursor) error
}

Processor defines the process for processing a stream of documents using a Cursor.

type SingleResult

type SingleResult interface {
	Decode(interface{}) error
	DecodeBytes() ([]byte, error)
	Err() error
}

type UpdateResult

type UpdateResult = mongo.UpdateResult

Jump to

Keyboard shortcuts

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