idvalidator

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FakeId

func FakeId() string

FakeId 生成假身份证号码

func FakeRequireId

func FakeRequireId(isEighteen bool, address string, birthday string, sex int) string

FakeRequireId 按要求生成假身份证号码 isEighteen 是否生成18位号码 address 省市县三级地区官方全称:如`北京市`、`台湾省`、`香港特别行政区`、`深圳市`、`黄浦区` birthday 出生日期:如 `2000`、`198801`、`19990101` sex 性别:1为男性,0为女性

func IsLooseValid

func IsLooseValid(id string) bool

IsLooseValid 宽松验证身份证号合法性

func IsStrictValid

func IsStrictValid(id string) bool

IsStrictValid 严格验证身份证号合法性

func IsValid

func IsValid(id string, strict bool) bool

IsValid 验证身份证号合法性

func IsValidBasic

func IsValidBasic(id string) bool

IsValidBasic 验证身份证号除地址信息之外的合法性

func IsValidButAds

func IsValidButAds(id string, strict bool, ignoreAdErr bool) bool

IsValid 验证身份证号合法性(排除县级地址错误,比如黑龙江阿城县这种离谱的

func UpgradeId

func UpgradeId(id string) (string, error)

UpgradeId 15位升级18位号码

Types

type BasicIdInfo

type BasicIdInfo struct {
	Birthday      time.Time
	Constellation string
	ChineseZodiac string
	Sex           int
	Length        int
	CheckBit      string
}

BasicIdInfo 不含地址码的身份证信息

func GetBasicInfo

func GetBasicInfo(id string) (BasicIdInfo, error)

GetBasicInfo 获取除地址信息之外的身份证信息

type IdInfo

type IdInfo struct {
	AddressCode   int
	Abandoned     int
	Address       string
	AddressTree   []string
	Birthday      time.Time
	Constellation string
	ChineseZodiac string
	Sex           int
	Length        int
	CheckBit      string
}

IdInfo 身份证信息

func GetInfo

func GetInfo(id string, strict bool) (IdInfo, error)

GetInfo 获取身份证信息

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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