-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathtypes.go
More file actions
33 lines (27 loc) · 707 Bytes
/
types.go
File metadata and controls
33 lines (27 loc) · 707 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package gozk
import (
"fmt"
"time"
)
type Response struct {
Status bool
Code int
TCPLength int
CommandID int
Data []byte
ReplyID int
}
type User struct {
}
type ScanEvent struct {
DeviceID string // An unique identifier for the device
UserID int64 // An unique identifier for the user
Timestamp time.Time // The time when the event was scanned
Error error // An error if the event is invalid
}
func (event ScanEvent) String() string {
return fmt.Sprintf("device_id:%s user_id:%d at:%v", event.DeviceID, event.UserID, event.Timestamp.Format(time.RFC3339))
}
func (r Response) String() string {
return fmt.Sprintf("Status %v Code %d", r.Status, r.Code)
}