Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- type BaseMongo interface {
- Read(ctx context.Context, filter bson.M, db string, collection string, out interface{}) error
- }
- type Mongo struct {
- client *mongo.Client
- }
- func (m *Mongo) Read(ctx context.Context, filter bson.M, db string, collection string, out interface{}) error {
- return m.client.Database(db).Collection(collection).FindOne(context.Background(), filter).Decode(out)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement