Documentation ¶
Index ¶
- Variables
- type DefaultMongoDBClient
- func (c *DefaultMongoDBClient) DeleteOne(ctx context.Context, database string, collection string, filter interface{}) (*mongo.DeleteResult, error)
- func (c *DefaultMongoDBClient) FindMany(ctx context.Context, database string, collection string, filter interface{}, ...) (*mongo.Cursor, error)
- func (c *DefaultMongoDBClient) FindOne(ctx context.Context, database string, collection string, filter interface{}) *mongo.SingleResult
- func (c *DefaultMongoDBClient) InsertOne(ctx context.Context, database string, collection string, data interface{}) (*primitive.ObjectID, error)
- func (c *DefaultMongoDBClient) UpdateOne(ctx context.Context, database string, collection string, filter interface{}, ...) (*mongo.UpdateResult, error)
- type MongoDBClient
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrFailedToConvertToObjectID = errors.New("failed to convert to object id")
)
Functions ¶
This section is empty.
Types ¶
type DefaultMongoDBClient ¶
type DefaultMongoDBClient struct {
// contains filtered or unexported fields
}
func NewMongoDBClient ¶
func (*DefaultMongoDBClient) DeleteOne ¶
func (c *DefaultMongoDBClient) DeleteOne(ctx context.Context, database string, collection string, filter interface{}) (*mongo.DeleteResult, error)
func (*DefaultMongoDBClient) FindOne ¶
func (c *DefaultMongoDBClient) FindOne(ctx context.Context, database string, collection string, filter interface{}) *mongo.SingleResult
func (*DefaultMongoDBClient) UpdateOne ¶
func (c *DefaultMongoDBClient) UpdateOne(ctx context.Context, database string, collection string, filter interface{}, update interface{}) (*mongo.UpdateResult, error)
type MongoDBClient ¶
type MongoDBClient interface { InsertOne(ctx context.Context, database string, collection string, data interface{}) (*primitive.ObjectID, error) FindOne(ctx context.Context, database string, collection string, filter interface{}) *mongo.SingleResult FindMany(ctx context.Context, database string, collection string, filter interface{}, orderBy interface{}, page int64, limit int64) (*mongo.Cursor, error) UpdateOne(ctx context.Context, database string, collection string, filter interface{}, update interface{}) (*mongo.UpdateResult, error) DeleteOne(ctx context.Context, database string, collection string, filter interface{}) (*mongo.DeleteResult, error) }
Click to show internal directories.
Click to hide internal directories.