Added a basic homepage
This commit is contained in:
parent
d40640a648
commit
12fd3c04ca
113 changed files with 414 additions and 506 deletions
26
internal/services/validator.go
Normal file
26
internal/services/validator.go
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
package services
|
||||
|
||||
import (
|
||||
"github.com/go-playground/validator/v10"
|
||||
)
|
||||
|
||||
// Validator provides validation mainly validating structs within the web context
|
||||
type Validator struct {
|
||||
// validator stores the underlying validator
|
||||
validator *validator.Validate
|
||||
}
|
||||
|
||||
// NewValidator creats a new Validator
|
||||
func NewValidator() *Validator {
|
||||
return &Validator{
|
||||
validator: validator.New(),
|
||||
}
|
||||
}
|
||||
|
||||
// Validate validates a struct
|
||||
func (v *Validator) Validate(i any) error {
|
||||
if err := v.validator.Struct(i); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue