34 lines
805 B
Go
34 lines
805 B
Go
//
|
|
// error.go
|
|
// Copyright (C) 2023 tiglog <me@tiglog.com>
|
|
//
|
|
// Distributed under terms of the MIT license.
|
|
//
|
|
|
|
package mgodb
|
|
|
|
import "go.mongodb.org/mongo-driver/mongo"
|
|
|
|
var (
|
|
// ErrNilDocument is returned when a nil document is passed to a CRUD method.
|
|
ErrNilDocument = mongo.ErrNilDocument
|
|
|
|
// ErrNilValue is returned when a nil value is passed to a CRUD method.
|
|
ErrNilValue = mongo.ErrNilValue
|
|
|
|
// ErrNoDocuments is returned by SingleResult methods when the operation that
|
|
// created the SingleResult did not return any documents.
|
|
ErrNoDocuments = mongo.ErrNoDocuments
|
|
)
|
|
|
|
func IsNoDocuments(err error) bool {
|
|
return err == mongo.ErrNoDocuments
|
|
}
|
|
|
|
func IsNilValue(err error) bool {
|
|
return err == mongo.ErrNilValue
|
|
}
|
|
func IsNilDocument(err error) bool {
|
|
return err == mongo.ErrNilDocument
|
|
}
|