Documentation ¶
Index ¶
- Constants
- Variables
- func CustomErrorHandler(ctx *fiber.Ctx, err error) error
- func NormalizeEmail(email string) string
- func ValidateRequestEntity(ctx *fiber.Ctx, request interface{}, errorMessage string) error
- type Base64Key
- type CodeHosting
- type Environment
- type Log
- type ProblemJSONError
- type PublisherPatch
- type PublisherPost
- type Response
- type SoftwarePatch
- type SoftwarePost
- type ValidationError
- type Webhook
Constants ¶
View Source
const ( SymmetricKeyLen = 32 EventTypeCreate = "create" EventTypeUpdate = "update" EventTypeDelete = "delete" )
Variables ¶
View Source
var ( ErrAuthentication = errors.New("token authentication failed") ErrInvalidDateTime = errors.New("invalid date time format (RFC 3339 needed)") ErrKeyLen = errors.New("PASETO_KEY must be 32 bytes long once base64-decoded") ErrDBUniqueConstraint = errors.New("db constraint violation") ErrDBRecordNotFound = errors.New("record not found") )
Functions ¶
func CustomErrorHandler ¶
func NormalizeEmail ¶ added in v0.5.1
func ValidateRequestEntity ¶ added in v0.5.1
Types ¶
type CodeHosting ¶
type Environment ¶
type Environment struct { MaxRequests int `env:"MAX_REQUESTS" envDefault:"0"` CurrentEnvironment string `env:"ENVIRONMENT" envDefault:"production"` Database string `env:"DATABASE_DSN"` PasetoKey *Base64Key `env:"PASETO_KEY"` }
var EnvironmentConfig Environment //nolint:gochecknoglobals
func (*Environment) IsTest ¶
func (e *Environment) IsTest() bool
type ProblemJSONError ¶
type ProblemJSONError struct { Code string `json:"code,omitempty"` Title string `json:"title"` Detail string `json:"detail,omitempty"` Status int `json:"status"` ValidationErrors []ValidationError `json:"validationErrors,omitempty"` }
func ErrorWithValidationErrors ¶
func ErrorWithValidationErrors( status int, title string, detail string, validationErrors []ValidationError, ) ProblemJSONError
func (ProblemJSONError) Error ¶
func (pj ProblemJSONError) Error() string
type PublisherPatch ¶ added in v0.5.1
type PublisherPatch struct { CodeHosting []CodeHosting `json:"codeHosting" validate:"gt=0"` Description string `json:"description"` Email string `json:"email" validate:"email"` Active *bool `json:"active"` ExternalCode string `json:"externalCode" validate:"max=255"` }
type PublisherPost ¶ added in v0.5.1
type PublisherPost struct { CodeHosting []CodeHosting `json:"codeHosting" validate:"required,gt=0,dive"` Description string `json:"description"` Email string `json:"email" validate:"email,required"` Active *bool `json:"active"` ExternalCode string `json:"externalCode" validate:"max=255"` }
type SoftwarePatch ¶ added in v0.5.0
type SoftwarePost ¶ added in v0.5.0
type ValidationError ¶
type ValidationError struct { Field string `json:"field"` Rule string `json:"rule"` Value string `json:"value,omitempty"` }
func ValidateStruct ¶
func ValidateStruct(validateStruct interface{}) []ValidationError
Click to show internal directories.
Click to hide internal directories.