validation

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateCORSOrigin

func ValidateCORSOrigin(origin string) error

ValidateCORSOrigin CORS Origin의 유효성을 검사합니다. Origin은 스키마(http/https), 도메인(또는 IP), 포트로만 구성되어야 하며, 경로(Path)나 쿼리 스트링을 포함할 수 없습니다. 또한 마지막에 슬래시(/)가 없어야 합니다.

func ValidateDuration

func ValidateDuration(d string) error

ValidateDuration duration 문자열의 유효성을 검사합니다.

Example
if err := ValidateDuration("10m"); err == nil {
	fmt.Println("Valid duration")
}
Output:

Valid duration

func ValidateFileExists

func ValidateFileExists(path string, warnOnly bool) error

ValidateFileExists 파일 존재 여부를 검사합니다 warnOnly가 true면 경고만 출력하고 에러는 반환하지 않습니다.

func ValidateFileExistsOrURL

func ValidateFileExistsOrURL(path string, warnOnly bool) error

ValidateFileExistsOrURL 파일 경로 또는 URL의 유효성을 검사합니다. warnOnly가 true면 경고만 출력하고 에러는 반환하지 않습니다.

func ValidateNoDuplicate

func ValidateNoDuplicate(list []string, value, valueType string) error

ValidateNoDuplicate 목록에 중복된 값이 없는지 검사합니다.

func ValidatePort

func ValidatePort(port int) error

ValidatePort TCP/UDP 네트워크 포트 번호의 유효성을 검사합니다. 유효 범위: 1-65535, 1024 미만 포트는 시스템 예약 포트로 경고를 출력합니다.

func ValidateRobfigCronExpression

func ValidateRobfigCronExpression(spec string) error

ValidateRobfigCronExpression Cron 표현식의 유효성을 검사합니다. robfig/cron 패키지를 사용하며, 초 단위를 포함한 7개 필드 형식을 지원합니다. 형식: 초 분 시 일 월 요일 (예: "0 */5 * * * *" - 5분마다)

func ValidateURL

func ValidateURL(urlStr string) error

ValidateURL URL 형식의 유효성을 검사합니다.

Example
if err := ValidateURL("https://example.com"); err == nil {
	fmt.Println("Valid URL")
}
Output:

Valid URL

Types

This section is empty.

Jump to

Keyboard shortcuts

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