2021-01-26 13:23:52 +00:00
|
|
|
package mongo
|
|
|
|
|
2021-02-14 04:48:09 +00:00
|
|
|
import (
|
|
|
|
"fmt"
|
2021-02-24 12:02:57 +00:00
|
|
|
|
2023-05-24 11:04:29 +00:00
|
|
|
"git.kmsign.ru/royalcat/repogen/internal/spec"
|
2021-02-14 04:48:09 +00:00
|
|
|
)
|
2021-01-26 13:23:52 +00:00
|
|
|
|
2021-02-14 04:48:09 +00:00
|
|
|
// NewOperationNotSupportedError creates operationNotSupportedError
|
|
|
|
func NewOperationNotSupportedError(operationName string) error {
|
|
|
|
return operationNotSupportedError{OperationName: operationName}
|
2021-01-26 13:23:52 +00:00
|
|
|
}
|
|
|
|
|
2021-02-14 04:48:09 +00:00
|
|
|
type operationNotSupportedError struct {
|
|
|
|
OperationName string
|
|
|
|
}
|
|
|
|
|
|
|
|
func (err operationNotSupportedError) Error() string {
|
|
|
|
return fmt.Sprintf("operation '%s' not supported", err.OperationName)
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewBsonTagNotFoundError creates bsonTagNotFoundError
|
|
|
|
func NewBsonTagNotFoundError(fieldName string) error {
|
|
|
|
return bsonTagNotFoundError{FieldName: fieldName}
|
|
|
|
}
|
|
|
|
|
|
|
|
type bsonTagNotFoundError struct {
|
|
|
|
FieldName string
|
|
|
|
}
|
|
|
|
|
|
|
|
func (err bsonTagNotFoundError) Error() string {
|
|
|
|
return fmt.Sprintf("bson tag of field '%s' not found", err.FieldName)
|
|
|
|
}
|
2021-02-24 12:02:57 +00:00
|
|
|
|
|
|
|
// NewUpdateTypeNotSupportedError creates updateTypeNotSupportedError
|
|
|
|
func NewUpdateTypeNotSupportedError(update spec.Update) error {
|
|
|
|
return updateTypeNotSupportedError{Update: update}
|
|
|
|
}
|
|
|
|
|
|
|
|
type updateTypeNotSupportedError struct {
|
|
|
|
Update spec.Update
|
|
|
|
}
|
|
|
|
|
|
|
|
func (err updateTypeNotSupportedError) Error() string {
|
|
|
|
return fmt.Sprintf("update type %s not supported", err.Update.Name())
|
|
|
|
}
|
2021-03-31 11:44:31 +00:00
|
|
|
|
|
|
|
// NewUpdateOperatorNotSupportedError creates updateOperatorNotSupportedError
|
|
|
|
func NewUpdateOperatorNotSupportedError(operator spec.UpdateOperator) error {
|
|
|
|
return updateOperatorNotSupportedError{Operator: operator}
|
|
|
|
}
|
|
|
|
|
|
|
|
type updateOperatorNotSupportedError struct {
|
|
|
|
Operator spec.UpdateOperator
|
|
|
|
}
|
|
|
|
|
|
|
|
func (err updateOperatorNotSupportedError) Error() string {
|
|
|
|
return fmt.Sprintf("update operator %s not supported", err.Operator)
|
|
|
|
}
|