adminui

package
v0.0.25 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DocsShellHTML

func DocsShellHTML(opts DocsShellOptions) string

DocsShellHTML renders the docs/admin shell HTML.

func OutcomeForStatus

func OutcomeForStatus(status int) string

OutcomeForStatus returns one of ok, invalid, or err for quick UI summaries.

Types

type DocsShellOptions

type DocsShellOptions struct {
	Title            string
	OpenAPIURL       string
	SQLCatalogURL    string
	EventsURL        string
	EventsStreamURL  string
	LoggingStatusURL string
}

DocsShellOptions configures the integrated docs/admin UI shell.

type Event

type Event struct {
	ID         int64  `json:"id"`
	Time       string `json:"time"`
	Kind       string `json:"kind"`
	Method     string `json:"method,omitempty"`
	Path       string `json:"path,omitempty"`
	Status     int    `json:"status,omitempty"`
	DurationMS int64  `json:"durationMs,omitempty"`
	Bytes      int64  `json:"bytes,omitempty"`
	Outcome    string `json:"outcome,omitempty"`
	Message    string `json:"message,omitempty"`
}

Event represents one admin-console activity row.

type EventFeed

type EventFeed struct {
	// contains filtered or unexported fields
}

EventFeed keeps a bounded in-memory feed and broadcasts live updates via SSE.

func NewEventFeed

func NewEventFeed(maxEvents int) *EventFeed

NewEventFeed returns an in-memory event feed with a bounded history.

func (*EventFeed) Capture

func (f *EventFeed) Capture(next http.Handler, methodHint, pathHint string) http.Handler

Capture wraps a handler and records method/path/status/duration/bytes.

func (*EventFeed) RecordRequest

func (f *EventFeed) RecordRequest(method, path string, status int, duration time.Duration, bytes int64)

RecordRequest appends one request outcome to the feed.

func (*EventFeed) RecordSystem

func (f *EventFeed) RecordSystem(message string)

RecordSystem appends a non-request event to the feed.

func (*EventFeed) ServeJSON

func (f *EventFeed) ServeJSON(w http.ResponseWriter, req *http.Request)

ServeJSON serves a JSON snapshot of recent events.

func (*EventFeed) ServeStream

func (f *EventFeed) ServeStream(w http.ResponseWriter, req *http.Request)

ServeStream serves live events using Server-Sent Events.

func (*EventFeed) Snapshot

func (f *EventFeed) Snapshot(limit int) []Event

Snapshot returns up to the latest limit events.

type SQLCatalog

type SQLCatalog struct {
	Root    string    `json:"root"`
	Missing bool      `json:"missing"`
	Error   string    `json:"error,omitempty"`
	Schemas []SQLFile `json:"schemas"`
	Queries []SQLFile `json:"queries"`
}

SQLCatalog summarizes schema/query files under db/sql for docs display.

func LoadSQLCatalog

func LoadSQLCatalog(root string) SQLCatalog

LoadSQLCatalog reads schema/query SQL files from root (defaults to db/sql).

type SQLFile

type SQLFile struct {
	Name      string `json:"name"`
	Path      string `json:"path"`
	Bytes     int64  `json:"bytes"`
	Lines     int    `json:"lines"`
	Truncated bool   `json:"truncated"`
	Content   string `json:"content"`
}

SQLFile describes one SQL file surfaced in the docs explorer.

Jump to

Keyboard shortcuts

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