golidators

package module
Version: v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2021 License: MIT Imports: 4 Imported by: 0

README

Workflow Go Report Card Go Reference Go Version Release License Stars

golidators

Golidators is a golang package, it includes basic data validation functions and regexes.

Install

go get github.com/eredotpkfr/golidators

Overview

Following validators available on this package:

  • Domain
  • MD5, SHA1, SHA224, SHA256, SHA512
  • IPv4, IPv4CIDR, IPv6, IPv6CIDR
  • MAC
  • Port
  • URL
  • UUID

Usage

Just import and use it. Also see documentation at pkg.go.dev

package main

import (
    "github.com/eredotpkfr/golidators"
    "fmt"
)

func main() {
  fmt.Println(golidators.Domain("www.example.com"))
  // true
  fmt.Println(golidators.Ipv4("::1"))
  // false
  fmt.Println(golidators.Ipv6("::1"))
  // true
  fmt.Println(golidators.Url("https://www.example.com"))
  // true
  fmt.Println(golidators.Ipv4Cidr("127.0.0.1/12"))
  // true
  fmt.Println(golidators.Md5("foo/bar"))
  // false
}

Contact

Blog - erdoganyoksul.com
Mail - erdoganyoksul3@gmail.com

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Domain

func Domain(domain string) bool

Domain function for validating domains

func Ipv4

func Ipv4(ipv4Addr string) bool

Ipv4 function for validating IPv4

func Ipv4Cidr

func Ipv4Cidr(ipv4AddrCidr string) bool

Ipv4Cidr function for validating IPv4CIDR

func Ipv6

func Ipv6(ipv6Addr string) bool

Ipv6 function for validating IPv6

func Ipv6Cidr

func Ipv6Cidr(ipv6AddrCidr string) bool

Ipv6Cidr function for validating IPv6CIDR

func Mac added in v0.1.3

func Mac(macAddr string) bool

Mac function for validating MAC Addresses

func Md5

func Md5(md5 string) bool

Md5 function for validating MD5

func Port

func Port(port int) bool

Port function for validating ports

func Sha1

func Sha1(sha1 string) bool

Sha1 function for validating SHA1

func Sha224

func Sha224(sha224 string) bool

Sha224 function for validating SHA224

func Sha256

func Sha256(sha256 string) bool

Sha256 function for validating SHA256

func Sha512

func Sha512(sha512 string) bool

Sha512 function for validating SHA512

func Url

func Url(url string) bool

Url function for validating URL's

func Uuid added in v0.1.3

func Uuid(uuid string) bool

Uuid function for validating UUID

Types

This section is empty.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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