validator

package
v1.7.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 1, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
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 struct {
}

JSONSchemaValidator validator

func NewJSONSchemaValidator

func NewJSONSchemaValidator(schemaRootPath string) *JSONSchemaValidator

NewJSONSchemaValidator constructor

func (*JSONSchemaValidator) ValidateDocument

func (v *JSONSchemaValidator) ValidateDocument(schemaID string, documentSource interface{}) error

ValidateDocument based on schema id

type StructValidator

type StructValidator struct {
	// contains filtered or unexported fields
}

StructValidator struct

func NewStructValidator

func NewStructValidator() *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

func (*StructValidator) ValidateStruct

func (v *StructValidator) ValidateStruct(data interface{}) error

ValidateStruct function

type Validator

type Validator struct {
	*JSONSchemaValidator
	*StructValidator
}

Validator instance

func NewValidator

func NewValidator() *Validator

NewValidator constructor, using jsonschema & struct validator (github.com/go-playground/validator), jsonschema source file load from "api/jsonschema" directory

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL