validator

package
v0.0.0-...-7e096b4 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidInput         = errors.New("invalid input")
	ErrInconsistent         = errors.New("inconsistent")
	ErrRequired             = errors.New("required")
	ErrConflict             = errors.New("conflict")
	ErrEmptyValue           = errors.New("empty value")
	ErrInvalidType          = errors.New("invalid type")
	ErrInvalidValue         = errors.New("invalid value")
	ErrOutOfRange           = errors.New("out of range")
	ErrAvailableFromVersion = errors.New("officially available from version")
	ErrZeroCoordinates      = errors.New("zero coordinates")
)

Functions

func ErrorWrap

func ErrorWrap(msg string, err error) error

ErrorWrap Wrap error

func ErrorWrapSuffix

func ErrorWrapSuffix(msg string, err error, suffix string) error

ErrorWrapSuffix Wrap error

func FeedVersion

func FeedVersion(v *string) string

FeedVersion ...

func ValidateAlertType

func ValidateAlertType(v *string) bool

ValidateAlertType ...

func ValidateDay

func ValidateDay(v string) bool

ValidateDay ...

func ValidateFeedName

func ValidateFeedName(v string) bool

ValidateFeedName ...

func ValidateFormFactor

func ValidateFormFactor(v *string) bool

ValidateFormFactor ...

func ValidatePropulsionType

func ValidatePropulsionType(v *string) bool

ValidatePropulsionType ...

func ValidateRentalMethod

func ValidateRentalMethod(v string) bool

ValidateRentalMethod ...

func ValidateUserType

func ValidateUserType(v string) bool

ValidateUserType ...

func ValidateVersion

func ValidateVersion(v string) bool

ValidateVersion ...

Types

type Result

type Result struct {
	Language string    `json:"language,omitempty"`
	URL      string    `json:"url,omitempty"`
	Feed     gbfs.Feed `json:"feed,omitempty"`
	Infos    []error   `json:"infos,omitempty"`
	Warnings []error   `json:"warnings,omitempty"`
	Errors   []error   `json:"errors,omitempty"`
}

Result ...

func ValidateFeedCommon

func ValidateFeedCommon(f gbfs.Feed, version string) *Result

ValidateFeedCommon ...

func ValidateFeedFreeBikeStatus

func ValidateFeedFreeBikeStatus(f *gbfs.FeedFreeBikeStatus, version string) *Result

ValidateFeedFreeBikeStatus ...

func ValidateFeedGbfs

func ValidateFeedGbfs(f *gbfs.FeedGbfs, version string) *Result

ValidateFeedGbfs ...

func ValidateFeedGbfsVersions

func ValidateFeedGbfsVersions(f *gbfs.FeedGbfsVersions, version string) *Result

ValidateFeedGbfsVersions ...

func ValidateFeedGeofencingZones

func ValidateFeedGeofencingZones(f *gbfs.FeedGeofencingZones, version string) *Result

ValidateFeedGeofencingZones ...

func ValidateFeedStationInformation

func ValidateFeedStationInformation(f *gbfs.FeedStationInformation, version string) *Result

ValidateFeedStationInformation ...

func ValidateFeedStationStatus

func ValidateFeedStationStatus(f *gbfs.FeedStationStatus, version string) *Result

ValidateFeedStationStatus ...

func ValidateFeedSystemAlerts

func ValidateFeedSystemAlerts(f *gbfs.FeedSystemAlerts, version string) *Result

ValidateFeedSystemAlerts ...

func ValidateFeedSystemCalendar

func ValidateFeedSystemCalendar(f *gbfs.FeedSystemCalendar, version string) *Result

ValidateFeedSystemCalendar ...

func ValidateFeedSystemHours

func ValidateFeedSystemHours(f *gbfs.FeedSystemHours, version string) *Result

ValidateFeedSystemHours ...

func ValidateFeedSystemInformation

func ValidateFeedSystemInformation(f *gbfs.FeedSystemInformation, version string) *Result

ValidateFeedSystemInformation ...

func ValidateFeedSystemPricingPlans

func ValidateFeedSystemPricingPlans(f *gbfs.FeedSystemPricingPlans, version string) *Result

ValidateFeedSystemPricingPlans ...

func ValidateFeedSystemRegions

func ValidateFeedSystemRegions(f *gbfs.FeedSystemRegions, version string) *Result

ValidateFeedSystemRegions ...

func ValidateFeedVehicleTypes

func ValidateFeedVehicleTypes(f *gbfs.FeedVehicleTypes, version string) *Result

ValidateFeedVehicleTypes ...

func (*Result) Error

func (r *Result) Error(e error) *Result

Error Add error

func (*Result) ErrorW

func (r *Result) ErrorW(m string, e error) *Result

ErrorW Add wrapped error

func (*Result) ErrorWS

func (r *Result) ErrorWS(m string, e error, s string) *Result

ErrorWS Add wrapped error with suffix

func (*Result) ErrorWSP

func (r *Result) ErrorWSP(m string, e error, s string) *Result

ErrorWSP Add wrapped error with suffix in parenthesis

func (*Result) HasErrors

func (r *Result) HasErrors() bool

HasErrors ...

func (*Result) HasInfos

func (r *Result) HasInfos() bool

HasInfos ...

func (*Result) HasWarnings

func (r *Result) HasWarnings() bool

HasWarnings ...

func (*Result) Info

func (r *Result) Info(e error) *Result

Info Add info

func (*Result) InfoW

func (r *Result) InfoW(m string, e error) *Result

InfoW Add wrapped info

func (*Result) InfoWS

func (r *Result) InfoWS(m string, e error, s string) *Result

InfoWS Add wrapped info with suffix

func (*Result) InfoWSP

func (r *Result) InfoWSP(m string, e error, s string) *Result

InfoWSP Add wrapped info with suffix in parenthesis

func (*Result) InfoWV

func (r *Result) InfoWV(m string, e error, s string) *Result

InfoWV Add wrapped info with version info

func (*Result) Warning

func (r *Result) Warning(e error) *Result

Warning Add warning

func (*Result) WarningW

func (r *Result) WarningW(m string, e error) *Result

WarningW Add wrapped warning

func (*Result) WarningWS

func (r *Result) WarningWS(m string, e error, s string) *Result

WarningWS Add wrapped warning with suffix

func (*Result) WarningWSP

func (r *Result) WarningWSP(m string, e error, s string) *Result

WarningWSP Add wrapped warning with suffix in parenthesis

type Validator

type Validator struct{}

Validator ...

func New

func New() *Validator

New ...

func (*Validator) Validate

func (v *Validator) Validate(feed gbfs.Feed, version string) *Result

Validate ...

func (*Validator) ValidateAll

func (v *Validator) ValidateAll(feeds []gbfs.Feed, version string) *Result

ValidateAll ...

Jump to

Keyboard shortcuts

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