sinparser

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2021 License: MIT Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

SIN Parser Go

Library for get data of Single Identity Number (No. KTP) from applications written with Go (requires Go v1.14 or newer).


Installation

Install sin-parser-go using Go Module by following command:

go get github.com/yusufthedragon/sin-parser-go

Then you import it by following code:

import sinparser "github.com/yusufthedragon/sin-parser-go"

Usage Example

var parsedData, err = sinparser.ParseSIN("3204110609970001")

if err != nil {
    panic(err.Error())
}

fmt.Printf("Parsed Data: %+v\n", parsedData)

// Result:
// {
//     "Age": 23,
//     "BornDate": "06 September 1997",
//     "CityID": 3204,
//     "CityName": "KAB. BANDUNG",
//     "DistrictID": 320411,
//     "DistrictName": "KATAPANG",
//     "Gender": "Male",
//     "IsValid": true,
//     "PostalCode": "40921",
//     "ProvinceID": 32,
//     "ProvinceName": "JAWA BARAT",
//     "UniqueCode": "0001",
//     "Zodiac": "Virgo"
// }

Test

You can run the test by following command:

go test -v

Contributing

For any requests, bugs, or comments, please open an issue or submit a pull request.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SIN

type SIN struct {
	Age          int
	BornDate     string
	CityID       int
	CityName     string
	DistrictID   int
	DistrictName string
	Gender       string
	IsValid      bool
	PostalCode   string
	ProvinceID   int
	ProvinceName string
	UniqueCode   string
	Zodiac       string
}

SIN struct contains data of Indonesian Identity Card.

func ParseSIN

func ParseSIN(sin string) (*SIN, error)

ParseSIN function gets the data from the given Single Identity Number.

Jump to

Keyboard shortcuts

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