iso7064

package
v0.0.0-...-c7901e9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 5, 2026 License: MIT Imports: 2 Imported by: 0

README

iso7064

import "github.com/altessa-s/go-atlas/domain/validation/iso7064"

Package iso7064 provides check-digit validation using the ISO 7064 MOD 11-10 algorithm for 9-digit numeric identifiers. Both functions accept string or int64 via a generic type parameter; pass strings when leading zeros must be preserved.

Functions

Function Description
Mod11_10 Validate an identifier and return the boolean result together with an error on malformed input
IsValidMod11_10 Convenience wrapper that returns false on any error, suitable for simple guard checks

Documentation

Overview

Package iso7064 provides check-digit validation using the ISO 7064 MOD 11-10 algorithm for 9-digit numeric identifiers.

Mod11_10 returns both the validation result and an error for malformed input. IsValidMod11_10 is a convenience wrapper that returns false on any error.

Both functions accept string or int64 via a generic type parameter. When using int64, leading zeros are not preserved; if your identifier can have leading zeros, pass it as a string.

Example:

valid := iso7064.IsValidMod11_10("123456788")
valid, err := iso7064.Mod11_10("123456788")

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsValidMod11_10

func IsValidMod11_10[T interface{ string | int64 }](data T) bool

IsValidMod11_10 checks if the ISO 7064 MOD 11-10 check digit is valid. Returns false for invalid input or failed validation.

Example:

iso7064.IsValidMod11_10("123456788") // true

func Mod11_10

func Mod11_10[T interface{ string | int64 }](data T) (bool, error)

Mod11_10 validates an ISO 7064 MOD 11-10 check digit for a 9-digit number. Returns true if valid, false otherwise. Returns error if input is not a valid 9-digit number.

Note: When using int64 input, leading zeros are not preserved. If your identifier can have leading zeros, pass it as a string.

Example:

valid, err := iso7064.Mod11_10("123456788") // true, nil

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL