mirror of
https://github.com/sascha-hemi/spaceDevices.git
synced 2026-03-21 02:04:32 +01:00
changes project layout
This commit is contained in:
53
pkg/structs/structs.go
Normal file
53
pkg/structs/structs.go
Normal 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"`
|
||||
}
|
||||
Reference in New Issue
Block a user