helper

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2026 License: MPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrPrint

func ErrPrint(err error)

func IsCosmosDB

func IsCosmosDB(connectionString string) bool

func IsSlice

func IsSlice(o interface{}) bool

func LoadCertificateAndKey

func LoadCertificateAndKey(data []byte) (*tls.Certificate, error)

func LoadCertificateAndKeyFromFile

func LoadCertificateAndKeyFromFile(path string) (*tls.Certificate, error)

func MongoShouldReconnect added in v1.3.0

func MongoShouldReconnect(err error) bool

MongoShouldReconnect checks if the error is a network error or a server error that requires reconnection

func NormalizeObjectIDs added in v1.7.0

func NormalizeObjectIDs(result interface{}, normalize func(id interface{}) (interface{}, bool))

NormalizeObjectIDs rewrites the _id of map results through normalize, which returns the replacement and true when the value is the driver's own id type. Any pointer to a map with string keys, or to a slice of such maps or of pointers to them, is handled, so model.DBM, plain maps and bson.M all qualify; typed destinations are left alone.

func ProjectionFields added in v1.7.0

func ProjectionFields(fields []string) []string

ProjectionFields trims the names, keeps the first occurrence of each and skips a child path whose parent is also listed, so drivers build their projection from a clean list.

Types

This section is empty.

Jump to

Keyboard shortcuts

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