55[ ![ Release] ( https://img.shields.io/github/v/release/eredotpkfr/golidators )] ( https://github.com/eredotpkfr/golidators/releases/latest )
66[ ![ License] ( https://img.shields.io/badge/license-MIT-blue )] ( https://github.com/eredotpkfr/golidators/blob/main/LICENSE )
77[ ![ Stars] ( https://img.shields.io/github/stars/eredotpkfr/golidators?style=social )] ( https://github.com/eredotpkfr/golidators/stargazers )
8+
89# golidators
9- Golidators is a golang package, it includes basic data validation functions and regexes.
10+
11+ Golidators is a golang package, it includes basic data validation functions and regexes
1012
1113## Install
14+
1215``` bash
13- $ go get github.com/eredotpkfr/golidators
16+ ~ $ go get github.com/eredotpkfr/golidators
1417```
1518
1619## Overview
20+
1721Following validators available on this package:
22+
1823- Domain
1924- MD5, SHA1, SHA224, SHA256, SHA512
2025- IPv4, IPv4CIDR, IPv6, IPv6CIDR
2126- MAC
2227- Port
2328- URL
2429- UUID
30+ - CreditCard/Luhn
2531
2632## Usage
33+
2734Just import and use it. Also see documentation at [ pkg.go.dev] ( https://pkg.go.dev/github.com/eredotpkfr/golidators#section-documentation )
35+
2836``` go
2937package main
3038
@@ -34,20 +42,28 @@ import (
3442)
3543
3644func main () {
45+ // Validate domain address
3746 fmt.Println (golidators.Domain (" www.example.com" ))
38- // true
47+ // Validate IPv4 address
3948 fmt.Println (golidators.Ipv4 (" ::1" ))
40- // false
49+ // Validate IPv6 address
4150 fmt.Println (golidators.Ipv6 (" ::1" ))
42- // true
51+ // Validate URL
4352 fmt.Println (golidators.Url (" https://www.example.com" ))
44- // true
53+ // Validate IPv4CIDR
4554 fmt.Println (golidators.Ipv4Cidr (" 127.0.0.1/12" ))
46- // true
55+ // Validate most common hashes
4756 fmt.Println (golidators.Md5 (" foo/bar" ))
48- // false
57+ // Validate with Luhn algorithm
58+ fmt.Println (golidators.Luhn (5300025108592596 ))
59+ // Calculate check digit with Luhn algorithm
60+ fmt.Println (golidators.LuhnCheckDigit (5146713835433 ))
61+ // Validate credit card number with Luhn
62+ fmt.Println (golidators.CreditCard (5184214431476070 ))
4963}
5064```
65+
5166## Contact
67+
5268Blog - [ erdoganyoksul.com] ( https://www.erdoganyoksul.com ) <br />
5369
0 commit comments