Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RowError ¶
type RowError interface {
error
GetSource() string
GetOperation() RowOperationType
// contains filtered or unexported methods
}
RowError is an interface for errors that occur during row processing (mapping, enrichment, validation).
func EnsureRowError ¶
func EnsureRowError(source string, operation RowOperationType, err error) RowError
EnsureRowError ensures that the error is a RowError, if not it converts it to a RowErrorWithMessage
type RowErrorWithFields ¶
type RowErrorWithFields struct {
Source string `json:"source"`
Operation RowOperationType `json:"operation"`
MissingFields []string `json:"missing_fields,omitempty"`
InvalidFields []string `json:"invalid_fields,omitempty"`
}
RowErrorWithFields is an implementation of RowError that includes missing and invalid fields. It is used to represent errors that are caused by specific fields either missing or invalid in the row.
func NewRowErrorWithFields ¶
func NewRowErrorWithFields(missingFields, invalidFields []string) *RowErrorWithFields
func (*RowErrorWithFields) Error ¶
func (r *RowErrorWithFields) Error() string
func (*RowErrorWithFields) GetOperation ¶
func (r *RowErrorWithFields) GetOperation() RowOperationType
func (*RowErrorWithFields) GetSource ¶
func (r *RowErrorWithFields) GetSource() string
type RowErrorWithMessage ¶
type RowErrorWithMessage struct {
Source string `json:"source"`
Operation RowOperationType `json:"operation"`
Message string `json:"message"`
}
RowErrorWithMessage is an implementation of RowError that includes a message. It is used to represent row errors where an error is not related to specific fields allowing for a descriptive message to be used instead. Also used as a generic fallback by EnsureRowError if the error is not a RowError.
func NewRowErrorWithMessage ¶
func NewRowErrorWithMessage(message string) *RowErrorWithMessage
func (*RowErrorWithMessage) Error ¶
func (r *RowErrorWithMessage) Error() string
func (*RowErrorWithMessage) GetOperation ¶
func (r *RowErrorWithMessage) GetOperation() RowOperationType
func (*RowErrorWithMessage) GetSource ¶
func (r *RowErrorWithMessage) GetSource() string
type RowErrors ¶
type RowErrors struct {
Total int64
// contains filtered or unexported fields
}
RowErrors is an aggregation of row errors, grouping by RowOperationType and error message
func NewRowErrors ¶
func NewRowErrors() *RowErrors
NewRowErrors creates a new RowErrors correctly, should always be used to create a new RowErrors
func RowErrorsFromProto ¶
RowErrorsFromProto converts a protobuf representation to a RowErrors
func (*RowErrors) Errors ¶
Errors returns one row per source, with a summary of the errors e.g. "source: 100 rows failed mapping with 2 missing fields: field1, field2" or "source: 100 rows failed with 2 errors" if there are multiple error messages which are not related to missing/invalid fields or "source: 100 rows failed with error: message" if there is only one error message for the source
type RowOperationType ¶
type RowOperationType string
const ( RowOperationTypeMapping RowOperationType = "mapping" RowOperationTypeEnrichment RowOperationType = "enrichment" RowOperationTypeValidation RowOperationType = "validation" )