Documentation ¶
Index ¶
Constants ¶
const ( // RegexAlphabetLower const RegexAlphabetLower = "a-z" // RegexAlphabetUpper const RegexAlphabetUpper = "A-Z" // RegexNumeric const RegexNumeric = "0-9" // RegexDash const RegexDash = "-" // AlphabetLower const AlphabetLower = "alfabet kecil" // AlphabetUpper const AlphabetUpper = "alfabet besar" // Numeric const Numeric = "numerik" // Dash const Dash = "strip" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JSONSchemaValidator ¶
type JSONSchemaValidator interface {
ValidateDocument(schemaID string, documentSource interface{}) error
}
JSONSchemaValidator abstraction
func NewJSONSchemaValidator ¶
func NewJSONSchemaValidator(opts ...JSONSchemaValidatorOptionFunc) JSONSchemaValidator
NewJSONSchemaValidator constructor
type JSONSchemaValidatorOptionFunc ¶ added in v1.14.0
type JSONSchemaValidatorOptionFunc func(*jsonSchemaValidator)
JSONSchemaValidatorOptionFunc type
func AddHideErrorListTypeJSONSchemaValidatorOption ¶ added in v1.14.0
func AddHideErrorListTypeJSONSchemaValidatorOption(descType ...string) JSONSchemaValidatorOptionFunc
AddHideErrorListTypeJSONSchemaValidatorOption option func
func SetSchemaStorageJSONSchemaValidatorOption ¶ added in v1.14.0
func SetSchemaStorageJSONSchemaValidatorOption(s Storage) JSONSchemaValidatorOptionFunc
SetSchemaStorageJSONSchemaValidatorOption option func
type OptionFunc ¶ added in v1.14.0
type OptionFunc func(*Validator)
OptionFunc type
func SetJSONSchemaValidator ¶ added in v1.14.0
func SetJSONSchemaValidator(jsonSchema JSONSchemaValidator) OptionFunc
SetJSONSchemaValidator option func
func SetStructValidator ¶ added in v1.14.0
func SetStructValidator(structValidator StructValidator) OptionFunc
SetStructValidator option func
type Storage ¶ added in v1.11.15
type Storage interface { Get(schemaID string) (string, error) Store(schemaID string, schema string) error }
Storage abstraction
func NewFileLocalStorage ¶ added in v1.14.0
NewFileLocalStorage read from file
func NewInMemStorage ¶ added in v1.11.15
NewInMemStorage constructor
type StructValidator ¶
type StructValidator interface {
ValidateStruct(data interface{}) error
}
StructValidator abstraction
func NewStructValidator ¶
func NewStructValidator(opts ...StructValidatorOptionFunc) StructValidator
NewStructValidator using go library https://github.com/go-playground/validator (all struct tags will be here) https://godoc.org/github.com/go-playground/validator (documentation using it) NewStructValidator function
type StructValidatorOptionFunc ¶ added in v1.14.0
type StructValidatorOptionFunc func(*structValidator)
StructValidatorOptionFunc type
func SetCoreStructValidatorOption ¶ added in v1.14.0
func SetCoreStructValidatorOption(additionalConfigFunc ...func(*validatorEngine.Validate)) StructValidatorOptionFunc
SetCoreStructValidatorOption option func
func SetTranslatorStructValidatorOption ¶ added in v1.14.0
func SetTranslatorStructValidatorOption(translator ut.Translator) StructValidatorOptionFunc
SetTranslatorStructValidatorOption option func
type Validator ¶
type Validator struct {
// contains filtered or unexported fields
}
Validator instance
func NewValidator ¶
func NewValidator(opts ...OptionFunc) *Validator
NewValidator constructor, using jsonschema & struct validator (github.com/go-playground/validator), jsonschema source file load from "api/jsonschema" directory
func (*Validator) ValidateDocument ¶ added in v1.14.0
ValidateDocument method using jsonschema with input is json source
func (*Validator) ValidateStruct ¶ added in v1.14.0
ValidateStruct method, rules from struct tag using github.com/go-playground/validator