docs_code

package module
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: 5 Imported by: 0

README

docs-code

GoDoc Go Coverage License Go Report Card

It is validator about official of documents codes in Go

Alert

It is not production ready public API! It is API could be change it the future. To be attentive for this.

Status

Status of implementation by code package:

  • OKATO
    • Generate method
    • Validate method
  • SNILS
    • Generate method
    • Validate method

Full supported codes: BIK, INN, KPP, OGRN, OGRNIP

Usage

go get github.com/sshaplygin/docs-code
Example

import (
	"log"
	
	"github.com/sshaplygin/docs-code"
)

...

isValid, err := docs_code.Validate(docs_code.INN, "526317984689")
if err != nil {
  log.Error(err)
}
if !isValid {
  log.Println("INN is invalid")
} else {
  log.Println("INN is valid")
}

Documentation

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(docType DocType) string

func Validate

func Validate(docType DocType, code string) (bool, error)

Types

type DocType

type DocType uint
const (
	BIK DocType = iota
	INN
	KPP
	OGRN
	OGRNIP
)

type GenerateFunc

type GenerateFunc func() string

type ValidateFunc

type ValidateFunc func(code string) (bool, error)

Directories

Path Synopsis
parser
bik
fns
subjects Module

Jump to

Keyboard shortcuts

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