echovalidator

package module
v0.1.0-beta.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 9, 2024 License: MIT Imports: 2 Imported by: 1

README

.github/workflows/build.yml Go Reference

echo-validator

A basic implementation of echo.Validator using github.com/goplayground/validator/v10.

Usage

The echo-validator package provides an easy-to-use global instance of Validator that can be configured with echo.Echo as follows:

package main

import (
    echovalidator "github.com/bdreece/echo-validator"
    "github.com/labstack/echo/v4"
)

func main() {
    e := echo.New()
    e.Validator = echovalidator.Default

    /* ... */
}

License

MIT License

Copyright (c) 2024 Brian Reece

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Default = New(validator.New())

A global singleton Validator.

Functions

This section is empty.

Types

type Validator

type Validator struct {
	// contains filtered or unexported fields
}

The validator.Validate wrapper.

func New

func New(v *validator.Validate) *Validator

Creates a new Validator.

func (*Validator) Validate

func (v *Validator) Validate(i any) error

Validate implements echo.Validator

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL