inn

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNilINN try call methods for nil inn struct
	ErrNilINN = errors.New("nil inn struct")

	// ErrInvalidCheckSumsValue invalid check sums rune value
	ErrInvalidCheckSumsValue = errors.New("invalid check sums rune value")
)

Functions

func Generate

func Generate() string

Generate generate random type inn string value

func GenerateLegal

func GenerateLegal() string

GenerateLegal generate legal type inn string value

func GeneratePhysical

func GeneratePhysical() string

GeneratePhysical generate physical type inn string value

func Validate

func Validate(inn string) (bool, error)

Validate check to valid inn from input string. example: input format is 7707083893

Types

type CheckSums added in v0.1.4

type CheckSums []int

func GenerateCheckSums added in v0.1.4

func GenerateCheckSums(innType INNType, nums []int) CheckSums

func (CheckSums) String added in v0.1.4

func (cs CheckSums) String() string

type INNStruct

type INNStruct struct {
	// contains filtered or unexported fields
}

func NewINN added in v0.1.4

func NewINN(innType INNType) *INNStruct

func ParseINN added in v0.1.4

func ParseINN(inn string) (*INNStruct, error)

func (*INNStruct) IsLegal added in v0.1.4

func (inn *INNStruct) IsLegal() bool

func (*INNStruct) IsPhysical added in v0.1.4

func (inn *INNStruct) IsPhysical() bool

func (*INNStruct) IsValid added in v0.1.4

func (inn *INNStruct) IsValid() (bool, error)

func (*INNStruct) String added in v0.1.4

func (inn *INNStruct) String() string

type INNType added in v0.1.4

type INNType uint
const (
	Physical INNType = iota
	Legal
	// ForeignLegal start with 9909
	ForeignLegal
)

func (INNType) String added in v0.1.4

func (t INNType) String() string

type SerialNumber added in v0.1.4

type SerialNumber struct {
	// contains filtered or unexported fields
}

func GenerateSerailNumber added in v0.1.4

func GenerateSerailNumber(innType INNType) SerialNumber

func (*SerialNumber) Ints added in v0.1.4

func (sn *SerialNumber) Ints() []int

func (SerialNumber) String added in v0.1.4

func (sn SerialNumber) String() string

Jump to

Keyboard shortcuts

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