Help us shape the future of Go! Take the 2026 Go Developer Survey

web

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2026 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package web holds what the server-rendered pages share: the one stylesheet, and the template helpers that format a number for an operator.

There is no JavaScript framework here and no content delivery network. The admin panel is HTML and one stylesheet, both inside the binary, which is what lets the content security policy be "default-src 'none'" and what keeps the panel working on a machine with no route to the internet.

Index

Constants

View Source
const AssetPrefix = "/assets/"

AssetPrefix is where the stylesheet is mounted. It is a constant because the content security policy, the templates and the route all have to agree.

Variables

This section is empty.

Functions

func Assets

func Assets() http.Handler

Assets serves the embedded stylesheet. Files are immutable for the life of a build, so they are cached for a day; a new build serves a new file at the same path, which is fine for one stylesheet on an admin page.

func Bytes

func Bytes(n int64) string

Bytes renders a size the way an operator reads one. Powers of 1024, because that is what PostgreSQL reports and disagreeing with the database about how big the database is would be its own support ticket.

func Count

func Count(n int64) string

Count renders a row count with thin separators, so six digits can be read at a glance.

func DateTime

func DateTime(t time.Time) string

DateTime renders an instant in the server's own time zone, seconds included, because a diagnostics page is read next to a log file.

func FuncMap

func FuncMap() template.FuncMap

FuncMap is the template helper set both the wizard and the admin panel use.

func LapTime

func LapTime(ms int) string

LapTime renders a lap in the spelling a driver reads on their own dash: minutes, seconds to the millisecond. Zero is a dash rather than "0:00.000", because zero here means "no clean lap in this stint" and a time of nothing is not a time.

func Since

func Since(d time.Duration) string

Since renders a duration as an operator would say it: the largest two units that matter and no more.

Types

This section is empty.

Jump to

Keyboard shortcuts

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