32 lines
699 B
Go
32 lines
699 B
Go
// Package `tracking` defines a generic track (sort of record) type
|
|
// and a container type that allows storing of tracks in a SQL database.
|
|
package tracking
|
|
|
|
import (
|
|
"time"
|
|
|
|
lib "git.sr.ht/~cco/go-scopes"
|
|
sql "git.sr.ht/~cco/go-scopes/storage"
|
|
)
|
|
|
|
type Track struct {
|
|
TrackId uint
|
|
Head map[string]string
|
|
TimeStamp *time.Time
|
|
Data lib.Payload
|
|
Container *Container
|
|
}
|
|
|
|
type Container struct {
|
|
headFields []string
|
|
indexes [][]string
|
|
storage *sql.Storage
|
|
}
|
|
|
|
func MakeContainer(st *sql.Storage) Container {
|
|
return Container{
|
|
headFields: []string{"taskId", "userName"},
|
|
indexes: [][]string{[]string{"taskId", "userName"}, []string{"userName"}},
|
|
storage: st,
|
|
}
|
|
}
|