一个优雅的手机归属地查询包

分享链接:https://github.com/dingdayu/phonedata
新鲜出炉一个优雅的手机归属地查询包!

install

go get -u github.com/dingdayu/phonedata

example

package main

import (
    "fmt"
    "phonedata"
)

func main() {
    info, _ := phonedata.Find("13298181006")
    fmt.Println(info)
}

Output:

PhoneNum:  13298181000 
AreaZone:  0371 
CardType: 中国联通 
City: 郑州 
ZipCode:  450000 
Province: 河南 

at go 1.12, go models

file: example/main.go

benchmark

go test -v -bench=".*" -benchmem -memprofile memprofile.out -cpuprofile cpuprofile.out
=== RUN   TestIsPhone
--- PASS: TestIsPhone (0.00s)
=== RUN   TestTotalRecord
--- PASS: TestTotalRecord (0.00s)
=== RUN   TestVersion
--- PASS: TestVersion (0.00s)
=== RUN   TestLoadDataFile
--- PASS: TestLoadDataFile (0.00s)
=== RUN   Example
--- PASS: Example (0.00s)
goos: darwin
goarch: amd64
pkg: phonedata
BenchmarkIsPhone-4        200000             13505 ns/op            9209 B/op        114 allocs/op
BenchmarkVersion-4      300000000                5.21 ns/op            0 B/op          0 allocs/op
BenchmarkFind-4          3000000               449 ns/op             224 B/op          6 allocs/op
PASS
ok      phonedata       6.922s

at: MacBook Pro(Intel Core i7/3.1 GHz)

讨论数量: 2

@诺大的院子 421051条记录,支持 13*,15*,18*,14[5,7],17[0,6,7,8]

4年前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!