idcard_cn

package
v0.0.0-...-849f898 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	V1 Version = 1
	V2 Version = 2

	Unknown Gender = 0
	Female  Gender = 1
	Male    Gender = 2
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Gender

type Gender uint8

Gender 性别定义

type IDCard

type IDCard interface {
	GetCity() (string, error)        // 获取市、县
	GetProvince() (string, error)    // 获取省、直辖市
	GetCode() string                 // 获取身份证号码
	GetAge() int                     // 获取年龄
	GetBirthday() (time.Time, error) // 获取生日
	GetGender() Gender               // 获取性别,2:女 1:男
	GetVersion() Version             // 获取身份证版本
	IsLegal() bool                   // 校验是否为合法身份证,仅校验身份证合法性
}

IDCard 身份证解析器

func MakeIDCard

func MakeIDCard(uniqueIDCode string, check bool) (IDCard, error)

type IDParser

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

func (*IDParser) GetAge

func (s *IDParser) GetAge() int

func (*IDParser) GetBirthday

func (s *IDParser) GetBirthday() (time.Time, error)

func (*IDParser) GetCity

func (s *IDParser) GetCity() (string, error)

func (*IDParser) GetCode

func (s *IDParser) GetCode() string

func (*IDParser) GetGender

func (s *IDParser) GetGender() Gender

func (*IDParser) GetProvince

func (s *IDParser) GetProvince() (string, error)

func (*IDParser) GetVersion

func (s *IDParser) GetVersion() Version

func (*IDParser) Init

func (s *IDParser) Init(uniqueIDCode string, doCheck bool) error

func (*IDParser) IsLegal

func (s *IDParser) IsLegal() bool

type Version

type Version uint8

Version 身份证版本

Jump to

Keyboard shortcuts

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