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

display

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package display is how a field's value reaches a person: the text a control carries, the word a screen shows, and the name a field is called by.

It is the one place these are decided, so a list cell, a description list and a select's option label agree about what a boolean or an enum looks like. It knows the schema and nothing else: no database, no router and no markup library, so a screen renderer that must not link the storage adapter can still show a value the way the generated screens do. kit/rest keeps delegates under the same names for the callers that already read them there.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Display

func Display(f entity.Field, v any) string

Display is a field's value as a screen shows it, and it is the only one: a cell, a description list and a select's option label all come through here, so a status is "In progress" in all three rather than "in_progress" in two of them. An instant is in the form a person reads, a boolean is Yes or No, and nothing at all is a dash, because a blank cell reads as a bug rather than as an empty field.

func FieldHelp

func FieldHelp(f entity.Field) string

FieldHelp is the note under a control: the field's own Doc, when it has one.

func FieldLabel

func FieldLabel(f entity.Field) string

FieldLabel is what a control, a column header and a description term call a field. It is Humanize today, in one place, so that the entity gaining a way to name its own fields is one line here rather than three at three call sites. Field.Doc is not that name: the entities in this repository write a sentence there — "Short summary of the task" — which is a description and belongs under the control, not on it. See Field.Doc.

func Humanize

func Humanize(name string) string

Humanize turns a JSON name or an enum value into something a person reads: "slaDeadline" becomes "Sla deadline" and "in_progress" becomes "In progress". It is not a dictionary and does not try to be one; a field that wants a better word is a field that should say so, which is what Field.Doc is for.

func Text

func Text(v any) string

Text is a value as a form control and a link read it: the raw one. Everything arrives as encoding/json made it, so a number is a float64 and a list is a []any.

It is not Display. A select's value attribute has to be the enum's own spelling and a checkbox's has to be "true"; what a person reads is Display's business, and confusing the two is how a form posts back "Yes".

Types

This section is empty.

Jump to

Keyboard shortcuts

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