Documentation ¶
Overview ¶
implements the MongoCollectionDerived interface which is a derived interface from the MongoCollection interface. The MongoCollection interface defines the methods that can be used to interact with the MongoDB collection. The MongoCollectionDerived interface defines the methods that can be used to interact with the MongoDB collection in a more user-friendly way. The MongoORM struct is a struct that contains a MongoCollection interface and the name of the collection. The MongoORM struct is used to interact with the MongoDB collection in a more user-friendly way.
Index ¶
- type MongoCollection
- type MongoCollectionDerived
- type MongoORM
- func (mongoOrm *MongoORM) Aggregate(ctx context.Context, target interface{}, filter interface{}, ...) error
- func (mongoOrm *MongoORM) BulkWrite(ctx context.Context, models []mongo.WriteModel, ...) (*mongo.BulkWriteResult, error)
- func (mongoOrm *MongoORM) CountDocuments(ctx context.Context, filter interface{}, opts ...*options.CountOptions) (int64, error)
- func (mongoOrm *MongoORM) DeleteMany(ctx context.Context, filter interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error)
- func (mongoOrm *MongoORM) DeleteOne(ctx context.Context, filter interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error)
- func (mongoOrm *MongoORM) Distinct(ctx context.Context, fieldName string, filter interface{}, ...) ([]interface{}, error)
- func (mongoOrm *MongoORM) FindMany(ctx context.Context, target interface{}, filter interface{}, ...) error
- func (mongoOrm *MongoORM) FindOne(ctx context.Context, target interface{}, filter interface{}, ...) error
- func (mongoOrm *MongoORM) Indexes() mongo.IndexView
- func (mongoOrm *MongoORM) InsertMany(ctx context.Context, items []interface{}, opts ...*options.InsertManyOptions) (*mongo.InsertManyResult, error)
- func (mongoOrm *MongoORM) InsertOne(ctx context.Context, target interface{}, opts ...*options.InsertOneOptions) (*mongo.InsertOneResult, error)
- func (mongoOrm *MongoORM) ReplaceOne(ctx context.Context, filter interface{}, replacement interface{}, ...) (*mongo.UpdateResult, error)
- func (mongoOrm *MongoORM) UpdateMany(ctx context.Context, filter interface{}, update interface{}, ...) (*mongo.UpdateResult, error)
- func (mongoOrm *MongoORM) UpdateOne(ctx context.Context, filter interface{}, update interface{}, ...) (*mongo.UpdateResult, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MongoCollection ¶
type MongoCollection interface { FindOne(ctx context.Context, filter interface{}, opts ...*options.FindOneOptions) *mongo.SingleResult CountDocuments(ctx context.Context, filter interface{}, opts ...*options.CountOptions) (int64, error) Find(ctx context.Context, filter interface{}, opts ...*options.FindOptions) (*mongo.Cursor, error) InsertOne(ctx context.Context, document interface{}, opts ...*options.InsertOneOptions) (*mongo.InsertOneResult, error) InsertMany(ctx context.Context, documents []interface{}, opts ...*options.InsertManyOptions) (*mongo.InsertManyResult, error) UpdateOne(ctx context.Context, filter interface{}, update interface{}, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error) DeleteOne(ctx context.Context, filter interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error) Aggregate(ctx context.Context, filter interface{}, opts ...*options.AggregateOptions) (*mongo.Cursor, error) Distinct(ctx context.Context, fieldName string, filter interface{}, opts ...*options.DistinctOptions) ([]interface{}, error) BulkWrite(ctx context.Context, models []mongo.WriteModel, opts ...*options.BulkWriteOptions) (*mongo.BulkWriteResult, error) ReplaceOne(ctx context.Context, filter interface{}, replacement interface{}, opts ...*options.ReplaceOptions) (*mongo.UpdateResult, error) DeleteMany(ctx context.Context, filter interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error) Indexes() mongo.IndexView UpdateMany(ctx context.Context, filter interface{}, update interface{}, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error) }
type MongoCollectionDerived ¶
type MongoCollectionDerived interface { FindOne(ctx context.Context, target interface{}, filter interface{}, opts ...*options.FindOneOptions) error FindMany(ctx context.Context, target interface{}, filter interface{}, opts ...*options.FindOptions) error InsertOne(ctx context.Context, target interface{}, opts ...*options.InsertOneOptions) (*mongo.InsertOneResult, error) InsertMany(ctx context.Context, target []interface{}, opts ...*options.InsertManyOptions) (*mongo.InsertManyResult, error) UpdateOne(ctx context.Context, filter interface{}, update interface{}, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error) DeleteOne(ctx context.Context, filter interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error) Aggregate(ctx context.Context, target interface{}, filter interface{}, opts ...*options.AggregateOptions) error Distinct(ctx context.Context, fieldName string, filter interface{}, opts ...*options.DistinctOptions) ([]interface{}, error) BulkWrite(ctx context.Context, models []mongo.WriteModel, opts ...*options.BulkWriteOptions) (*mongo.BulkWriteResult, error) CountDocuments(ctx context.Context, filter interface{}, opts ...*options.CountOptions) (int64, error) ReplaceOne(ctx context.Context, filter interface{}, replacement interface{}, opts ...*options.ReplaceOptions) (*mongo.UpdateResult, error) DeleteMany(ctx context.Context, filter interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error) Indexes() mongo.IndexView UpdateMany(ctx context.Context, filter interface{}, update interface{}, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error) }
type MongoORM ¶
type MongoORM struct { Col MongoCollection ColName string Logger *zap.Logger }
func (*MongoORM) BulkWrite ¶
func (mongoOrm *MongoORM) BulkWrite( ctx context.Context, models []mongo.WriteModel, opts ...*options.BulkWriteOptions, ) (*mongo.BulkWriteResult, error)
func (*MongoORM) CountDocuments ¶
func (*MongoORM) DeleteMany ¶
func (mongoOrm *MongoORM) DeleteMany(ctx context.Context, filter interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error)
func (*MongoORM) DeleteOne ¶
func (mongoOrm *MongoORM) DeleteOne(ctx context.Context, filter interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error)
func (*MongoORM) InsertMany ¶
func (mongoOrm *MongoORM) InsertMany(ctx context.Context, items []interface{}, opts ...*options.InsertManyOptions) (*mongo.InsertManyResult, error)
func (*MongoORM) InsertOne ¶
func (mongoOrm *MongoORM) InsertOne(ctx context.Context, target interface{}, opts ...*options.InsertOneOptions) (*mongo.InsertOneResult, error)
func (*MongoORM) ReplaceOne ¶
func (mongoOrm *MongoORM) ReplaceOne(ctx context.Context, filter interface{}, replacement interface{}, opts ...*options.ReplaceOptions) (*mongo.UpdateResult, error)
func (*MongoORM) UpdateMany ¶
func (mongoOrm *MongoORM) UpdateMany(ctx context.Context, filter interface{}, update interface{}, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error)
func (*MongoORM) UpdateOne ¶
func (mongoOrm *MongoORM) UpdateOne(ctx context.Context, filter interface{}, update interface{}, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error)
Click to show internal directories.
Click to hide internal directories.