dto

package
v1.0.0-alpha1 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: Apache-2.0 Imports: 4 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package dto holds the audit log's request and response shapes.

Index

Constants

View Source
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.

Jump to

Keyboard shortcuts

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