Documentation ¶
Index ¶
- type CanUseMarkerProvider
- type Option
- func WithCanUseMarkerProvider(provider CanUseMarkerProvider) Option
- func WithDB(db *sql.DB) Option
- func WithLocation(location string) Option
- func WithRefCheck(flag bool) Option
- func WithSetMarker(f bool) Option
- func WithShallow(f bool) Option
- func WithUnique(flag bool) Option
- func WithValidation(v *Validation) Option
- type Options
- type Service
- type Validation
- type Validator
- type Violation
- type Violations
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CanUseMarkerProvider ¶
type CanUseMarkerProvider func(v interface{}) bool
type Option ¶
type Option func(o *Options)
Option defines validator option
func WithCanUseMarkerProvider ¶
func WithCanUseMarkerProvider(provider CanUseMarkerProvider) Option
WithCanUseMarkerProvider creates with marker provider option
func WithLocation ¶
WithLocation creates with location option
func WithValidation ¶
func WithValidation(v *Validation) Option
WithValidation creates with Validation option
type Options ¶
type Options struct { WithShallow bool WithSetMarker bool WithDB *sql.DB WithUnique bool WithRef bool Location string CanUseMarkerProvider CanUseMarkerProvider WithValidation *Validation }
Options defins validator options
type Validation ¶
type Validation struct { Violations Violations `json:",omitempty"` Failed bool `json:",omitempty"` }
Validation represents validation
func (*Validation) AddViolation ¶
func (v *Validation) AddViolation(location, field string, value interface{}, check string, msg string)
AddViolation adds violation
type Validator ¶
type Validator interface {
Validate(ctx context.Context, any interface{}, options ...Option) (*Validation, error)
}
type Violation ¶
type Violation struct { Location string `json:",omitempty"` Field string `json:",omitempty"` Value interface{} `json:",omitempty"` Message string `json:",omitempty"` Check string `json:",omitempty"` }
Violation represent validation violation
type Violations ¶
type Violations []*Violation
Click to show internal directories.
Click to hide internal directories.