Documentation
¶
Overview ¶
Package zkteco parses the output files from zkteco device.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // DEBUG is debug mode. It'll output debug messages if it's true. DEBUG = true )
Functions ¶
func GetCSVRecords ¶
GetCSVRecords returns records of a CSV file by given a type of io.Reader.
Example ¶
1. Run "go test -c && ./zkteco.test" to generate test binary under root of project dir and start test.
2. Run "go test" will generate test binary under "/tmp" with a random test dir
package main
import (
"log"
"os"
"github.com/athrunecho/zkteco"
"github.com/northbright/pathhelper"
)
const (
kaoqinFilePath = "./example/csv/attendance/attendance.csv"
)
// 1. Run "go test -c && ./zkteco.test" to generate test binary under root of project dir and start test.
//
// 2. Run "go test" will generate test binary under "/tmp" with a random test dir
func main() {
var (
err error
p string
f *os.File
re [][]string
)
log.Printf("\n")
log.Printf("--------- GetCSVRecords() Test Begin --------\n")
if p, err = pathhelper.GetAbsPath(kaoqinFilePath); err != nil {
goto end
}
if f, err = os.Open(p); err != nil {
goto end
}
defer f.Close()
if re, err = zkteco.GetCSVRecords(f); err != nil {
goto end
}
log.Printf("%v\n", re)
end:
if err != nil {
log.Printf("err: %v\n", err)
}
log.Printf("--------- BatchCreate() Test End --------\n")
}
func GetField ¶
GetField adds days and returns according to i.
func GetRedisConn ¶
GetRedisConn gets the Redis connection.
Types ¶
type Kaoqin ¶
type Kaoqin struct {
// contains filtered or unexported fields
}
Kaoqin contains Redis address, Redis password and Redis connection
func NewKaoqin ¶
NewKaoqin returns an pointer to Kaoqin by given Redis address, Redis password.
func (*Kaoqin) Close ¶
Close close the redis connection from Kaoqin struct
Source Files
¶
- csv.go
- date.go
- debug.go
- doc.go
- util.go
- zkteco.go
Click to show internal directories.
Click to hide internal directories.