Init
This commit is contained in:
89
validation/rules.go
Normal file
89
validation/rules.go
Normal file
@@ -0,0 +1,89 @@
|
||||
package validation
|
||||
|
||||
import "regexp"
|
||||
|
||||
// This needs to be a map of structs
|
||||
|
||||
type rule struct {
|
||||
minLength uint64
|
||||
maxLength uint64
|
||||
charset regexp.Regexp
|
||||
divisible uint8
|
||||
}
|
||||
|
||||
var aztec = rule{
|
||||
minLength: 1,
|
||||
maxLength: 3067,
|
||||
charset: *ANY,
|
||||
divisible: 1,
|
||||
}
|
||||
|
||||
var code39 = rule{
|
||||
minLength: 1,
|
||||
maxLength: 80,
|
||||
charset: *CODE39,
|
||||
divisible: 1,
|
||||
}
|
||||
|
||||
var code128 = rule{
|
||||
minLength: 1,
|
||||
maxLength: 80,
|
||||
charset: *ASCII,
|
||||
divisible: 1,
|
||||
}
|
||||
|
||||
var datamatrix = rule{
|
||||
minLength: 1,
|
||||
maxLength: 2335,
|
||||
charset: *ANY,
|
||||
divisible: 1,
|
||||
}
|
||||
|
||||
var ean8 = rule{
|
||||
minLength: 7,
|
||||
maxLength: 7,
|
||||
charset: *NUMERAL,
|
||||
divisible: 1,
|
||||
}
|
||||
|
||||
var ean13 = rule{
|
||||
minLength: 12,
|
||||
maxLength: 12,
|
||||
charset: *NUMERAL,
|
||||
divisible: 1,
|
||||
}
|
||||
|
||||
var ean14 = rule{
|
||||
minLength: 2,
|
||||
maxLength: 80,
|
||||
charset: *NUMERAL,
|
||||
divisible: 2,
|
||||
}
|
||||
|
||||
var pdf417 = rule{
|
||||
minLength: 1,
|
||||
maxLength: 1100,
|
||||
charset: *ANY,
|
||||
divisible: 1,
|
||||
}
|
||||
|
||||
var pzn7 = rule{
|
||||
minLength: 7,
|
||||
maxLength: 7,
|
||||
charset: *NUMERAL,
|
||||
divisible: 1,
|
||||
}
|
||||
|
||||
var qr = rule{
|
||||
minLength: 1,
|
||||
maxLength: 4296,
|
||||
charset: *ISO88591,
|
||||
divisible: 1,
|
||||
}
|
||||
|
||||
var upca = rule{
|
||||
minLength: 11,
|
||||
maxLength: 11,
|
||||
charset: *NUMERAL,
|
||||
divisible: 1,
|
||||
}
|
||||
Reference in New Issue
Block a user