Documentation ¶
Index ¶
- type Client
- type CollectionLayer
- type DataLayer
- type DocumentResultLayer
- type InsertOneResultLayer
- type Wrapper
- type WrapperCollection
- func (c WrapperCollection) FindOne(ctx context.Context, filter interface{}, opts ...option.FindOneOptioner) DocumentResultLayer
- func (c WrapperCollection) FindOneAndDelete(ctx context.Context, filter interface{}, ...) DocumentResultLayer
- func (c WrapperCollection) FindOneAndUpdate(ctx context.Context, filter interface{}, update interface{}, ...) DocumentResultLayer
- func (c WrapperCollection) InsertOne(ctx context.Context, document interface{}, opts ...option.InsertOneOptioner) (InsertOneResultLayer, error)
- type WrapperDatabase
- type WrapperDocumentResult
- type WrapperInsertOneResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CollectionLayer ¶
type CollectionLayer interface { InsertOne(ctx context.Context, document interface{}, opts ...option.InsertOneOptioner) (InsertOneResultLayer, error) FindOne(ctx context.Context, filter interface{}, opts ...option.FindOneOptioner) DocumentResultLayer FindOneAndUpdate(ctx context.Context, filter interface{}, update interface{}, opts ...option.FindOneAndUpdateOptioner) DocumentResultLayer FindOneAndDelete(ctx context.Context, filter interface{}, opts ...option.FindOneAndDeleteOptioner) DocumentResultLayer }
CollectionLayer abstracts the required functions for MongoDB.
type DataLayer ¶
type DataLayer interface {
Collection(name string) CollectionLayer
}
DataLayer wraps a CollectionLayer.
type DocumentResultLayer ¶
DocumentResultLayer abstracts the Decode() method.
type InsertOneResultLayer ¶
type InsertOneResultLayer interface{}
InsertOneResultLayer is an empty interface. No methods are required for this. Everything implements this.
type WrapperCollection ¶
type WrapperCollection struct {
*mongo.Collection
}
WrapperCollection wraps mongo.Collection.
func (WrapperCollection) FindOne ¶
func (c WrapperCollection) FindOne(ctx context.Context, filter interface{}, opts ...option.FindOneOptioner) DocumentResultLayer
FindOne finds a document given filters and options.
func (WrapperCollection) FindOneAndDelete ¶
func (c WrapperCollection) FindOneAndDelete(ctx context.Context, filter interface{}, opts ...option.FindOneAndDeleteOptioner) DocumentResultLayer
FindOneAndDelete finds a document and removes it.
func (WrapperCollection) FindOneAndUpdate ¶
func (c WrapperCollection) FindOneAndUpdate(ctx context.Context, filter interface{}, update interface{}, opts ...option.FindOneAndUpdateOptioner) DocumentResultLayer
FindOneAndUpdate finds a document and updates it. Closest we have to a transaction.
func (WrapperCollection) InsertOne ¶
func (c WrapperCollection) InsertOne(ctx context.Context, document interface{}, opts ...option.InsertOneOptioner) (InsertOneResultLayer, error)
InsertOne inserts a document.
type WrapperDatabase ¶
WrapperDatabase wraps the mongo.Database.
func (WrapperDatabase) Collection ¶
func (d WrapperDatabase) Collection(name string) CollectionLayer
Collection returns a mongo collection. CollectionLayer shadows the mongo.Collection.
type WrapperDocumentResult ¶
type WrapperDocumentResult struct {
*mongo.DocumentResult
}
WrapperDocumentResult wraps mongo.DocumentResult.
type WrapperInsertOneResult ¶
type WrapperInsertOneResult struct {
*mongo.InsertOneResult
}
WrapperInsertOneResult wraps mongo.InsertOneResult.