Documentation
¶
Overview ¶
Package dto holds the audit log's request and response shapes.
Index ¶
Constants ¶
const ( DefaultLimit = 100 MaxLimit = 500 )
Page-size bounds for listing events.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EventPage ¶
type EventPage struct {
Items []EventResponse `json:"items"`
// NextCursor is the "before" value that fetches the following page, or null when
// this was the last.
NextCursor *int64 `json:"nextCursor"`
}
EventPage is one page of events, newest first.
type EventQuery ¶
type EventQuery struct {
// UserID matches the actor exactly.
UserID string
// EntityType matches the record's table exactly, such as "processes".
EntityType string
// From is inclusive and To exclusive, both in milliseconds since the epoch; zero
// leaves that end open.
From, To int64
// Before returns only events with a smaller id than this, which is how a caller
// reads the next page. Zero starts from the newest.
Before int64
Limit int
}
EventQuery selects events. Every filter is optional and they combine with AND.
func ParseEventQuery ¶
func ParseEventQuery(q url.Values) (*EventQuery, error)
ParseEventQuery reads and validates the query string of a list request.
type EventResponse ¶
type EventResponse struct {
ID int64 `json:"id"`
OccurredAt int64 `json:"occurredAt"`
Actor string `json:"actor"`
Action string `json:"action"`
EntityType string `json:"entityType"`
EntityID string `json:"entityId"`
ChangedFields string `json:"changedFields"`
}
EventResponse is one audit event.
func NewEventResponse ¶
func NewEventResponse(e *model.Event) EventResponse
NewEventResponse maps an event to its response.