Documentation
      ¶
    
    
  
    
  
    Overview ¶
Example (RangeInt) ¶
package main
import (
	"go.llib.dev/frameless/pkg/validate"
)
func main() {
	type T struct {
		V int `range:"0..100"`
	}
	validate.Value(T{V: 42})  // no error
	validate.Value(T{V: -1})  // validate.Error
	validate.Value(T{V: 101}) // validate.Error
}
Example (RangeIntMulti) ¶
package main
import (
	"go.llib.dev/frameless/pkg/validate"
)
func main() {
	type T struct {
		Num1 int `range:"0..100"`
		Num2 int `range:"0..25,30..50"`
	}
	_ = validate.Value(T{})
}
Index ¶
Examples ¶
Constants ¶
      View Source
      
  
    const ImplementationError errorkit.Error = "ImplementationError"
    
      View Source
      
  const InsideValidateFunc copt = 1
    InsideValidateFunc option indicates that the function is being used inside a Validate() error method.
When this option is set, the Validate function call is skipped to prevent an infinite loop caused by a circular Validate call.
Variables ¶
This section is empty.
Functions ¶
func StructField ¶
Types ¶
type Error ¶ added in v0.288.0
type Error struct{ Cause error }
    Error is a validation error, that represents an incorrect content.
        
          
            type ValidationError
            deprecated
            
          
  
    
  
      
      type ValidationError = Error
Deprecated: use validate.Error instead
 Click to show internal directories. 
   Click to hide internal directories.