Passed
Push — main ( 15e900...9a9510 )
by Igor
01:02 queued 11s
created

it.IsEAN8   A

Complexity

Conditions 1

Size

Total Lines 6
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 6
nop 0
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
package it
2
3
import (
4
	"github.com/muonsoft/validation"
5
	"github.com/muonsoft/validation/code"
6
	"github.com/muonsoft/validation/is"
7
	"github.com/muonsoft/validation/message"
8
)
9
10
// IsEAN8 is used to validate EAN-8 value.
11
//
12
// See https://en.wikipedia.org/wiki/EAN-8.
13
func IsEAN8() validation.CustomStringConstraint {
14
	return validation.NewCustomStringConstraint(
15
		is.EAN8,
16
		"EAN8Constraint",
17
		code.InvalidEAN8,
18
		message.Templates[code.InvalidEAN8],
19
	)
20
}
21
22
// IsEAN13 is used to validate EAN-13 value.
23
//
24
// See https://en.wikipedia.org/wiki/International_Article_Number.
25
func IsEAN13() validation.CustomStringConstraint {
26
	return validation.NewCustomStringConstraint(
27
		is.EAN13,
28
		"EAN13Constraint",
29
		code.InvalidEAN13,
30
		message.Templates[code.InvalidEAN13],
31
	)
32
}
33
34
// IsUPCA is used to validate UPC-A value.
35
//
36
// See https://en.wikipedia.org/wiki/Universal_Product_Code.
37
func IsUPCA() validation.CustomStringConstraint {
38
	return validation.NewCustomStringConstraint(
39
		is.UPCA,
40
		"UPCAConstraint",
41
		code.InvalidUPCA,
42
		message.Templates[code.InvalidUPCA],
43
	)
44
}
45
46
// IsUPCE is used to validate UPC-E value.
47
//
48
// See https://en.wikipedia.org/wiki/Universal_Product_Code#UPC-E.
49
func IsUPCE() validation.CustomStringConstraint {
50
	return validation.NewCustomStringConstraint(
51
		is.UPCE,
52
		"UPCEConstraint",
53
		code.InvalidUPCE,
54
		message.Templates[code.InvalidUPCE],
55
	)
56
}
57