Skip to content

Number specific type validators

While the validator Number works with all golang number types, Valgo also has a validator for each type. You can use them if you prefer or need a stronger safe type code.

Following is a list of functions for every specific number type validator, along with their equivalent pointer validators.

Int(v int) IntP(v *int)
Int8(v int8) Int8P(v *int8)
Int16(v int16) Int16P(v *int16)
Int32(v int32) Int32P(v *int32)
Int64(v int64) Int64P(v *int64)
Uint(v uint) UintP(v *uint)
Uint8(v uint8) Uint8P(v *uint8)
Uint16(v uint16) Uint16P(v *uint16)
Uint32(v uint32) Uint32P(v *uint32)
Uint64(v uint64) Uint64P(v *uint64)
Float32(v float32) Float32P(v *float32)
Float64(v float64) Float64P(v *float64)
Byte(v byte) ByteP(v *byte)
Rune(v byte) RuneP(v *byte)

These validators have the same rule functions as the Number validator.

Similar to the Number validator, custom types can be passed based on the specific number type.