Skip to content

Commit

Permalink
Add golang documentation to ValidationFactory
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosforero committed Apr 9, 2023
1 parent 4c35dfe commit a64e8a2
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,21 @@ type FactoryOptions struct {
MarshalJsonFunc func(e *Error) ([]byte, error)
}

// ValidationFactory is a struct provided by Valgo that enables the creation of
// Validation sessions with preset options. This allows for more flexibility and
// easier management of options when creating [Validation] sessions, as it avoids
// having to pass options each time a new [Validation] is created.
//
// The [Factory()] function is used to create a ValidationFactory instance, and
// it takes a [FactoryOptions] struct as a parameter. This allows customization
// of the default locale code, addition of new locales, and setting a custom
// JSON marshaler for errors.
//
// A ValidationFactory instance offers all the functions for creating
// Validations available at the package level ([Is()], [In()], [Check()], [New()]),
// which create new Validation sessions with the preset options defined in the
// factory.

type ValidationFactory struct {
localeCodeDefault string
locales map[string]*Locale
Expand Down

0 comments on commit a64e8a2

Please sign in to comment.