changes project layout

This commit is contained in:
Holger Cremer
2018-08-25 15:18:40 +02:00
parent 1e9b3ed354
commit 02c7464ce2
18 changed files with 36 additions and 34 deletions

53
pkg/structs/structs.go Normal file
View File

@@ -0,0 +1,53 @@
package structs
import (
"strings"
)
type WifiSession struct {
Ip string
Mac string
Vlan string
AP int
}
type Devices struct {
Name string `json:"name"`
Location string `json:"location"`
}
type DevicesSorter []Devices
func (s DevicesSorter) Len() int {
return len(s)
}
func (s DevicesSorter) Swap(i, j int) {
s[i], s[j] = s[j], s[i]
}
func (s DevicesSorter) Less(i, j int) bool {
return strings.Compare(s[i].Name, s[j].Name) < 0
}
type Person struct {
Name string `json:"name"`
Devices []Devices `json:"devices"`
}
type PersonSorter []Person
func (s PersonSorter) Len() int {
return len(s)
}
func (s PersonSorter) Swap(i, j int) {
s[i], s[j] = s[j], s[i]
}
func (s PersonSorter) Less(i, j int) bool {
return strings.Compare(s[i].Name, s[j].Name) < 0
}
type PeopleAndDevices struct {
People []Person `json:"people"`
PeopleCount uint16 `json:"peopleCount"`
DeviceCount uint16 `json:"deviceCount"`
UnknownDevicesCount uint16 `json:"unknownDevicesCount"`
}