validator

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 31, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MinResNameLength = 1
	MaxResNameLength = 200

	MinWorkspaceDescLength = 0
	MaxWorkspaceDescLength = 1000

	MinDataModelNameLength          = 1
	MaxDataModelNameLength          = 30
	MaxEntitySetDataModelNameLength = 50
	MaxDataModelHeaderLength        = 100
	MaxDataModelRowIDLength         = 100

	MinSubmissionNameSuffixLength = 1
	MaxSubmissionNameSuffixLength = 200
	// SubmissionName = WorkflowName + "-history-" + Suffix
	MinSubmissionNameLength = MinResNameLength + 9 + MinSubmissionNameSuffixLength
	MaxSubmissionNameLength = MaxResNameLength + 9 + MaxSubmissionNameSuffixLength
	MaxSubmissionDescLength = 1000
)

length validator.

Variables

View Source
var (
	ResNameRegex = regexp.MustCompile(`^[\p{Han}A-Za-z0-9][-_\p{Han}A-Za-z0-9]*$`)
	// DataModelNameReg _${data_model}(data model name) is the data model stored for submission
	DataModelNameReg = regexp.MustCompile("^[0-9a-zA-Z_][0-9a-zA-Z-_]*$")
	// DataModelHeaderReg _${data_model}_id(data model id header) is the data model stored for submission
	DataModelHeaderReg = regexp.MustCompile("^[0-9a-zA-Z_][0-9a-zA-Z-_]*$")
)

Functions

func RegisterValidators

func RegisterValidators() error

RegisterValidators registers k8s validators.

func Validate

func Validate(s interface{}) error

Validate can validate struct field with validate tag.

func ValidateDataModelNameInString

func ValidateDataModelNameInString(name string) bool

ValidateDataModelNameInString ...

func ValidateNFSMountPathInString

func ValidateNFSMountPathInString(p string) bool

ValidateNFSMountPathInString ...

func ValidateResNameInString

func ValidateResNameInString(name string) bool

ValidateResNameInString ...

func ValidateWorkspaceDescInString

func ValidateWorkspaceDescInString(desc string) bool

ValidateWorkspaceDescInString ...

Types

This section is empty.

Jump to

Keyboard shortcuts

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