Documentation
¶
Overview ¶
Package clientinfra provides shared Mongo client setup helpers.
Index ¶
- func EnsureIndexes(timeout time.Duration, ensure func(context.Context) error) error
- func Ping(ctx context.Context, client *mongodriver.Client, normalizeNil bool) error
- func ResolveTimeout(timeout time.Duration, defaultTimeout time.Duration) time.Duration
- func ValidateMongoOptions(client *mongodriver.Client, database string) error
- func WithTimeout(ctx context.Context, timeout time.Duration, normalizeNil bool) (context.Context, context.CancelFunc)
- type Cursor
- type IndexView
- type SingleResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnsureIndexes ¶
EnsureIndexes runs index initialization with a timeout-bounded background context.
func ResolveTimeout ¶
ResolveTimeout applies the package default when the configured timeout is not positive.
func ValidateMongoOptions ¶
func ValidateMongoOptions(client *mongodriver.Client, database string) error
ValidateMongoOptions checks the shared required Mongo constructor inputs.
Types ¶
type Cursor ¶ added in v1.1.0
type Cursor struct {
Cur *mongodriver.Cursor
}
Cursor adapts mongodriver.Cursor to a feature-local interface.
type IndexView ¶ added in v1.1.0
type IndexView struct {
View mongodriver.IndexView
}
IndexView adapts mongodriver.IndexView to a feature-local interface.
func (IndexView) CreateOne ¶ added in v1.1.0
func (v IndexView) CreateOne(ctx context.Context, model mongodriver.IndexModel, opts ...*options.CreateIndexesOptions) (string, error)
CreateOne forwards to the wrapped IndexView.
type SingleResult ¶ added in v1.1.0
type SingleResult struct {
Res *mongodriver.SingleResult
}
SingleResult adapts mongodriver.SingleResult to a feature-local interface.
func (SingleResult) Decode ¶ added in v1.1.0
func (r SingleResult) Decode(val any) error
Decode forwards to the wrapped SingleResult.
Click to show internal directories.
Click to hide internal directories.