events

package
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 27, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const EventCard = schema.EventCard
View Source
const EventCardName = schema.EventCardName
View Source
const EventDeviceID = schema.EventDeviceID
View Source
const EventDeviceName = schema.EventDeviceName
View Source
const EventDirection = schema.EventDirection
View Source
const EventDoor = schema.EventDoor
View Source
const EventDoorName = schema.EventDoorName
View Source
const EventGranted = schema.EventGranted
View Source
const EventIndex = schema.EventIndex
View Source
const EventReason = schema.EventReason
View Source
const EventTimestamp = schema.EventTimestamp
View Source
const EventType = schema.EventType
View Source
const EventsFirst = schema.EventsFirst
View Source
const EventsLast = schema.EventsLast
View Source
const EventsOID = schema.EventsOID

Variables

This section is empty.

Functions

func CanAdd added in v0.8.3

func CanAdd[T TAuthable](a auth.OpAuth, u T) error

func CanDelete added in v0.8.3

func CanDelete[T TAuthable](a auth.OpAuth, u T) error

func CanUpdate added in v0.8.3

func CanUpdate[T TAuthable](a auth.OpAuth, u T, field string, value any) error

func CanView added in v0.8.3

func CanView[T TAuthable](a auth.OpAuth, u T, field string, value any) error

Types

type Event

type Event struct {
	catalog.CatalogEvent
	Timestamp  core.DateTime
	Type       eventType
	Door       uint8
	Direction  direction
	Card       uint32
	Granted    bool
	Reason     reason
	DeviceName string
	DoorName   string
	CardName   string
}

func NewEvent

func NewEvent(oid schema.OID, e uhppoted.Event, device, door, card string) Event

func (Event) AsObjects

func (e Event) AsObjects(a auth.OpAuth) []schema.Object

func (Event) AsRuleEntity

func (e Event) AsRuleEntity() (string, interface{})

func (Event) CacheKey added in v0.8.10

func (e Event) CacheKey() string

func (Event) IsDeleted

func (e Event) IsDeleted() bool

func (Event) IsValid

func (e Event) IsValid() bool

type Events

type Events struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewEvents

func NewEvents() Events

func (*Events) AsObjects

func (ee *Events) AsObjects(start, max int, auth auth.OpAuth) []schema.Object

func (*Events) Clone

func (ee *Events) Clone() *Events

func (*Events) Load

func (ee *Events) Load(blob json.RawMessage) error

func (*Events) Missing

func (ee *Events) Missing(gaps int, controllers ...uint32) map[uint32][]types.Interval

NTS: for 1000000 events (i.e. in the expected range), binary search improves only slightly

on a sequential linear traverse but it's a cleaner algorithm and scales somewhat better.
Copying from the map is the dominant cost.

func (*Events) Print

func (ee *Events) Print()

func (*Events) Received

func (ee *Events) Received(deviceID uint32, recent []uhppoted.Event, lookup func(uhppoted.Event) (string, string, string))

func (*Events) Save

func (ee *Events) Save() (json.RawMessage, error)

func (*Events) UpdateByOID

func (ee *Events) UpdateByOID(auth auth.OpAuth, oid schema.OID, value string) ([]interface{}, error)

FIXME searches events list sequentially to find matching OID. But not ever actually invoked (as yet...)

func (*Events) Validate

func (ee *Events) Validate() error

type TAuthable added in v0.8.3

type TAuthable interface {
	Event

	AsRuleEntity() (string, any)
	CacheKey() string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL