Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var NewSession = func(ctx context.Context, opt config.Mongo) (ISession, error) { serverAPIOptions := options.ServerAPI(options.ServerAPIVersion1) clientOptions := options.Client(). ApplyURI(fmt.Sprintf("%s://%s:%s@%s/%s?retryWrites=true&w=majority", opt.MongoProtocol, opt.MongoUsername, opt.MongoPassword, opt.MongoHost, opt.MongoDatabase)). SetServerAPIOptions(serverAPIOptions) return newClient(ctx, clientOptions) }
NewSession method
Functions ¶
This section is empty.
Types ¶
type ISession ¶
type ISession interface { Connect(ctx context.Context) error Disconnect(ctx context.Context) error Ping(ctx context.Context, rp *readpref.ReadPref) error StartSession(opts ...*options.SessionOptions) (mongo.Session, error) Database(name string, opts ...*options.DatabaseOptions) *mongo.Database ListDatabases(ctx context.Context, filter interface{}, opts ...*options.ListDatabasesOptions) (mongo.ListDatabasesResult, error) ListDatabaseNames(ctx context.Context, filter interface{}, opts ...*options.ListDatabasesOptions) ([]string, error) UseSession(ctx context.Context, fn func(mongo.SessionContext) error) error UseSessionWithOptions(ctx context.Context, opts *options.SessionOptions, fn func(mongo.SessionContext) error) error Watch(ctx context.Context, pipeline interface{}, opts ...*options.ChangeStreamOptions) (*mongo.ChangeStream, error) NumberSessionsInProgress() int Timeout() *time.Duration }
ISession interface
Click to show internal directories.
Click to hide internal directories.