clientinfra

package
v1.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 23, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package clientinfra provides shared Mongo client setup helpers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureIndexes

func EnsureIndexes(timeout time.Duration, ensure func(context.Context) error) error

EnsureIndexes runs index initialization with a timeout-bounded background context.

func Ping

func Ping(ctx context.Context, client *mongodriver.Client, normalizeNil bool) error

Ping performs the common primary-read-preference health check.

func ResolveTimeout

func ResolveTimeout(timeout time.Duration, defaultTimeout time.Duration) time.Duration

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.

func WithTimeout

func WithTimeout(ctx context.Context, timeout time.Duration, normalizeNil bool) (context.Context, context.CancelFunc)

WithTimeout wraps the caller context with the configured timeout.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL