Completed
Push — main ( fbce6d...e1e59a )
by Igor
14s queued 13s
created

is.UUID   A

Complexity

Conditions 1

Size

Total Lines 2
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
dl 0
loc 2
rs 10
c 0
b 0
f 0
nop 2
1
package is
2
3
import "github.com/muonsoft/validation/validate"
4
5
// ULID validates whether the value is a valid ULID (Universally Unique Lexicographically Sortable Identifier).
6
// See https://github.com/ulid/spec for ULID specifications.
7
func ULID(value string) bool {
8
	return validate.ULID(value) == nil
9
}
10
11
// UUID validates whether a string value is a valid UUID (also known as GUID).
12
//
13
// By default, it uses strict mode and checks the UUID as specified in RFC 4122.
14
// To parse additional formats, use the
15
// [github.com/muonsoft/validation/validate.AllowNonCanonicalUUIDFormats] option.
16
//
17
// In addition, it checks if the UUID version matches one of
18
// the registered versions: 1, 2, 3, 4, 5, 6 or 7.
19
// Use [github.com/muonsoft/validation/validate.AllowUUIDVersions] to validate
20
// for a specific set of versions.
21
//
22
// Nil UUID ("00000000-0000-0000-0000-000000000000") values are considered as valid.
23
// Use [github.com/muonsoft/validation/validate.DenyNilUUID] to disallow nil value.
24
//
25
// See http://tools.ietf.org/html/rfc4122.
26
func UUID(value string, options ...func(o *validate.UUIDOptions)) bool {
27
	return validate.UUID(value, options...) == nil
28
}
29