This repository has been archived on 2025-07-20. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
analytics/ingest/db/models/session.go
2023-04-05 14:24:23 +01:00

21 lines
406 B
Go

package models
import (
"fmt"
"github.com/uptrace/bun"
"time"
)
type Session struct {
bun.BaseModel
ID string `bun:",pk"`
UserAgent string `bun:"type:VARCHAR COLLATE NOCASE"`
IPAddr string
LastSeen time.Time `bun:",scanonly"`
}
func (s *Session) String() string {
return fmt.Sprintf("ID:%s UA:%#v IP:%s LastSeen:%s", s.ID, s.UserAgent, s.IPAddr, s.LastSeen.Format(time.DateTime))
}