Categorygithub.com/strongo/validation
modulepackage
0.0.6
Repository: https://github.com/strongo/validation.git
Documentation: pkg.go.dev

# README

strongo-validation

Validation errors & helpers.

Purpose of this class to define a generic set of validation errors.

  • Validation error
    • Bad request
      • Missing field
      • Invalid field value
    • Bad record
      • Missing field
      • Invalid field value
    • Bad field
      • Missing field
      • Invalid field value

You can check if an err error is a validation error or a specific validation error with next functions:

  • IsValidationError(err error) bool
  • IsBadRequestError(err error) bool
  • IsBadRecordError(err error) bool
  • IsBadFieldValueError(err error) bool

Documentation

https://pkg.go.dev/github.com/strongo/validation

Usage

This package is known to be used in next open source projects:

Please submit a pull request to add your project here if you use this package in an open source project.

Versioning

The version is auto-incremented by CI/CD pipeline on push to main branch.

LICENSE

MIT License

# Functions

No description provided by the author
IsBadRecordError checks if provided errors is a validation error.
IsBadRequestError checks if provided errors is a validation error.
IsValidationError checks if provided errors is a validation error.
MustBeFieldError makes sure the provided error is a field error.
NewBadRequestError create error.
NewErrBadRecordFieldValue creates an error for a bad record field value.
NewErrBadRequestFieldValue creates an error for a bad request field value.
NewErrRecordIsMissingRequiredField creates an error for a missing required field in a record.
NewErrRequestIsMissingRequiredField creates an error for a missing required field in a request.
NewValidationError creates a common validation error.

# Structs

ErrBadFieldValue reports error for a bad field value.