Skip to content

NIK (Nomor Induk Kependudukan) parser written in golang

Notifications You must be signed in to change notification settings

fanchann/nik-parser

Repository files navigation

NIK Parser Written in Go

installation

go get github.com/fanchann/nik-parser

example:

nik_parser.go

package main

import (
	"encoding/json"
	"fmt"

	nikparser "github.com/fanchann/nik-parser"
)

func main() {
	nik := "3203012503770011"
	result, err := nikparser.ParseNIK(nik)
	if err != nil {
		fmt.Printf("%v \n", err)
		return
	}

	jsonByte, _ := json.Marshal(result)

	fmt.Println(string(jsonByte))
}

nik_gen.go

package main

import (
	"fmt"

	nikparser "github.com/fanchann/nik-parser"
)

func main() {
	nikOpts := &nikparser.NIKOpts{District: "Your District", PostalCode: "PostCode",Ttl: 20}
	niks := nikparser.NIKGen(nikOpts)
	fmt.Printf("niks: %v\n", niks)

	jsonByte, _ := json.Marshal(&niks)

	ioutil.WriteFile("nik.json", jsonByte, fs.ModePerm)
}

author

About

NIK (Nomor Induk Kependudukan) parser written in golang

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages