Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MongoConnection ¶
type MongoConnection struct {
ConnectionStringSource string
DB *mongo.Client
Connected bool
Database string
Logger log.Logger
MaxPoolSize uint64
}
MongoConnection is a hub which deal with mongodb connections.
func (*MongoConnection) Connect ¶
func (mc *MongoConnection) Connect(ctx context.Context) error
Connect keeps a singleton connection with mongodb.
func (*MongoConnection) EnsureIndexes ¶ added in v2.5.2
func (mc *MongoConnection) EnsureIndexes(ctx context.Context, collection string, index mongo.IndexModel) error
EnsureIndexes guarantees an index exists for a given collection. Idempotent.
Click to show internal directories.
Click to hide internal directories.