view

package
v1.7.21 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2025 License: MIT Imports: 12 Imported by: 0

README

View Component Helpers

This directory contains quicktemplate component functions for rendering various data types and UI elements.

Function Reference

Any.html
  • {% func Any(x any, ps *cutil.PageState) %} - Renders any value by type-switching to appropriate handlers
AnyByType.html
  • {% func AnyByType(x any, t *types.Wrapped, ps *cutil.PageState) %} - Renders any value based on explicit type information
  • {% func Default(x any, t string, ps *cutil.PageState) %} - Default handler for unhandled types
  • {% func Type(v types.Type) %} - Renders type information
  • {% func Option(x any, t *types.Option, ps *cutil.PageState) %} - Renders optional values with null toggle
Bool.html
  • {% func Bool(b bool) %} - Renders boolean as "true"/"false" text
  • {% func BoolIcon(b bool, size int, cls string, ps *cutil.PageState, titles ...string) %} - Renders boolean as check/times icon
Color.html
  • {% func Color(clr string, cls string, ps *cutil.PageState) %} - Renders color value with background preview
Diff.html
  • {% func Diffs(value util.Diffs) %} - Renders diff table showing path/old/new changes
  • {% func DiffsSet(key string, value util.DiffsSet, limit int, ps *cutil.PageState) %} - Renders grouped diffs as accordion
Float.html
  • {% func Float(f any) %} - Renders float value
  • {% func FloatArray(value []any) %} - Renders array of floats
Int.html
  • {% func Int(i any) %} - Renders integer value
  • {% func IntArray(value []any) %} - Renders array of integers
Map.html
  • {% func Map(preserveWhitespace bool, m util.ValueMap, ps *cutil.PageState) %} - Renders key-value map as table
  • {% func MapKeys(m util.ValueMap) %} - Renders map keys as tags
  • {% func MapArray(preserveWhitespace bool, ps *cutil.PageState, maps ...util.ValueMap) %} - Renders array of maps as table
  • {% func OrderedMap(preserveWhitespace bool, m *util.OrderedMap[any], ps *cutil.PageState) %} - Renders ordered map as table
  • {% func OrderedMapArray(preserveWhitespace bool, ps *cutil.PageState, maps ...*util.OrderedMap[any]) %} - Renders array of ordered maps as table
Package.html
  • {% func Package(v util.Pkg) %} - Renders package path segments
String.html
  • {% func String(value string, classes ...string) %} - Renders string with optional CSS classes
  • {% func StringRich(value string, code bool, maxLength int, classes ...string) %} - Renders string with code formatting and length limit
  • {% func StringArray(value []string) %} - Renders string array with overflow handling
  • {% func FormatLang(v string, ext string) %} - Renders formatted code with syntax highlighting
Tags.html
  • {% func Tags(values []string, titles []string, url ...string) %} - Renders string array as tag elements with optional links
Timestamp.html
  • {% func Timestamp(value *time.Time) %} - Renders timestamp with verbose tooltip
  • {% func TimestampMillis(value *time.Time) %} - Renders timestamp with millisecond precision
  • {% func TimestampRelative(value *time.Time, static bool) %} - Renders relative time ("2 hours ago")
  • {% func TimestampDay(value *time.Time) %} - Renders date only (YYYY-MM-DD)
  • {% func DurationSeconds(seconds float64) %} - Renders duration from seconds value
URL.html
  • {% func URL(u any, content string, includeExternalIcon bool, ps *cutil.PageState) %} - Renders clickable URL link
  • {% func CodeLink(path string, title string, ps *cutil.PageState) %} - Renders link to source code
UUID.html
  • {% func UUID(value *uuid.UUID) %} - Renders UUID as string

Usage Notes

  • Most functions accept ps *cutil.PageState for context and theme information
  • Functions starting with capital letters are exported quicktemplate functions
  • preserveWhitespace parameter controls whether content should maintain spacing/formatting
  • Array functions typically include overflow handling for large datasets
  • Icon functions use the SVG icon system via components.SVGRef()

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Any

func Any(x any, ps *cutil.PageState) string

func AnyByType added in v1.2.17

func AnyByType(x any, t *types.Wrapped, ps *cutil.PageState) string

func Bool

func Bool(b bool) string

func BoolIcon added in v1.2.21

func BoolIcon(b bool, size int, cls string, ps *cutil.PageState, titles ...string) string
func CodeLink(path string, title string, ps *cutil.PageState) string

func Color added in v1.2.18

func Color(clr string, cls string, ps *cutil.PageState) string

func Default

func Default(x any, t string, ps *cutil.PageState) string

func Diffs

func Diffs(value util.Diffs) string

func DiffsSet

func DiffsSet(key string, value util.DiffsSet, limit int, ps *cutil.PageState) string

func DurationSeconds added in v1.2.19

func DurationSeconds(seconds float64) string

func Float

func Float(f any) string

func FloatArray

func FloatArray(value []any) string

func FormatLang added in v1.6.0

func FormatLang(v string, ext string) string

func Int

func Int(i any) string

func IntArray

func IntArray(value []any) string

func Map added in v1.2.17

func Map(preserveWhitespace bool, m util.ValueMap, ps *cutil.PageState) string

func MapArray

func MapArray(preserveWhitespace bool, ps *cutil.PageState, maps ...util.ValueMap) string

func MapKeys added in v1.5.4

func MapKeys(m util.ValueMap) string

func Option

func Option(x any, t *types.Option, ps *cutil.PageState) string

func OrderedMap added in v1.5.31

func OrderedMap(preserveWhitespace bool, m *util.OrderedMap[any], ps *cutil.PageState) string

func OrderedMapArray added in v1.5.31

func OrderedMapArray(preserveWhitespace bool, ps *cutil.PageState, maps ...*util.OrderedMap[any]) string

func Package

func Package(v util.Pkg) string

func Percent added in v1.7.20

func Percent(f float64) string

func StreamAny

func StreamAny(qw422016 *qt422016.Writer, x any, ps *cutil.PageState)

func StreamAnyByType added in v1.2.17

func StreamAnyByType(qw422016 *qt422016.Writer, x any, t *types.Wrapped, ps *cutil.PageState)

func StreamBool

func StreamBool(qw422016 *qt422016.Writer, b bool)

func StreamBoolIcon added in v1.2.21

func StreamBoolIcon(qw422016 *qt422016.Writer, b bool, size int, cls string, ps *cutil.PageState, titles ...string)
func StreamCodeLink(qw422016 *qt422016.Writer, path string, title string, ps *cutil.PageState)

func StreamColor added in v1.2.18

func StreamColor(qw422016 *qt422016.Writer, clr string, cls string, ps *cutil.PageState)

func StreamDefault

func StreamDefault(qw422016 *qt422016.Writer, x any, t string, ps *cutil.PageState)

func StreamDiffs

func StreamDiffs(qw422016 *qt422016.Writer, value util.Diffs)

func StreamDiffsSet

func StreamDiffsSet(qw422016 *qt422016.Writer, key string, value util.DiffsSet, limit int, ps *cutil.PageState)

func StreamDurationSeconds added in v1.2.19

func StreamDurationSeconds(qw422016 *qt422016.Writer, seconds float64)

func StreamFloat

func StreamFloat(qw422016 *qt422016.Writer, f any)

func StreamFloatArray

func StreamFloatArray(qw422016 *qt422016.Writer, value []any)

func StreamFormatLang added in v1.6.0

func StreamFormatLang(qw422016 *qt422016.Writer, v string, ext string)

func StreamInt

func StreamInt(qw422016 *qt422016.Writer, i any)

func StreamIntArray

func StreamIntArray(qw422016 *qt422016.Writer, value []any)

func StreamMap added in v1.2.17

func StreamMap(qw422016 *qt422016.Writer, preserveWhitespace bool, m util.ValueMap, ps *cutil.PageState)

func StreamMapArray

func StreamMapArray(qw422016 *qt422016.Writer, preserveWhitespace bool, ps *cutil.PageState, maps ...util.ValueMap)

func StreamMapKeys added in v1.5.4

func StreamMapKeys(qw422016 *qt422016.Writer, m util.ValueMap)

func StreamOption

func StreamOption(qw422016 *qt422016.Writer, x any, t *types.Option, ps *cutil.PageState)

func StreamOrderedMap added in v1.5.31

func StreamOrderedMap(qw422016 *qt422016.Writer, preserveWhitespace bool, m *util.OrderedMap[any], ps *cutil.PageState)

func StreamOrderedMapArray added in v1.5.31

func StreamOrderedMapArray(qw422016 *qt422016.Writer, preserveWhitespace bool, ps *cutil.PageState, maps ...*util.OrderedMap[any])

func StreamPackage

func StreamPackage(qw422016 *qt422016.Writer, v util.Pkg)

func StreamPercent added in v1.7.20

func StreamPercent(qw422016 *qt422016.Writer, f float64)

func StreamString

func StreamString(qw422016 *qt422016.Writer, value string, classes ...string)

func StreamStringArray

func StreamStringArray(qw422016 *qt422016.Writer, value []string)

func StreamStringRich

func StreamStringRich(qw422016 *qt422016.Writer, value string, code bool, maxLength int, classes ...string)

func StreamTags added in v1.5.4

func StreamTags(qw422016 *qt422016.Writer, values []string, titles []string, url ...string)

func StreamTimestamp

func StreamTimestamp(qw422016 *qt422016.Writer, value *time.Time)

func StreamTimestampDay

func StreamTimestampDay(qw422016 *qt422016.Writer, value *time.Time)

func StreamTimestampMillis added in v1.1.1

func StreamTimestampMillis(qw422016 *qt422016.Writer, value *time.Time)

func StreamTimestampRelative

func StreamTimestampRelative(qw422016 *qt422016.Writer, value *time.Time, static bool)

func StreamType

func StreamType(qw422016 *qt422016.Writer, v types.Type)

func StreamURL added in v1.2.17

func StreamURL(qw422016 *qt422016.Writer, u any, content string, includeExternalIcon bool, ps *cutil.PageState)

func StreamUUID

func StreamUUID(qw422016 *qt422016.Writer, value *uuid.UUID)

func String

func String(value string, classes ...string) string

func StringArray

func StringArray(value []string) string

func StringRich

func StringRich(value string, code bool, maxLength int, classes ...string) string

func Tags added in v1.5.4

func Tags(values []string, titles []string, url ...string) string

func Timestamp

func Timestamp(value *time.Time) string

func TimestampDay

func TimestampDay(value *time.Time) string

func TimestampMillis added in v1.1.1

func TimestampMillis(value *time.Time) string

func TimestampRelative

func TimestampRelative(value *time.Time, static bool) string

func Type

func Type(v types.Type) string

func URL added in v1.2.17

func URL(u any, content string, includeExternalIcon bool, ps *cutil.PageState) string

func UUID

func UUID(value *uuid.UUID) string

func WriteAny

func WriteAny(qq422016 qtio422016.Writer, x any, ps *cutil.PageState)

func WriteAnyByType added in v1.2.17

func WriteAnyByType(qq422016 qtio422016.Writer, x any, t *types.Wrapped, ps *cutil.PageState)

func WriteBool

func WriteBool(qq422016 qtio422016.Writer, b bool)

func WriteBoolIcon added in v1.2.21

func WriteBoolIcon(qq422016 qtio422016.Writer, b bool, size int, cls string, ps *cutil.PageState, titles ...string)
func WriteCodeLink(qq422016 qtio422016.Writer, path string, title string, ps *cutil.PageState)

func WriteColor added in v1.2.18

func WriteColor(qq422016 qtio422016.Writer, clr string, cls string, ps *cutil.PageState)

func WriteDefault

func WriteDefault(qq422016 qtio422016.Writer, x any, t string, ps *cutil.PageState)

func WriteDiffs

func WriteDiffs(qq422016 qtio422016.Writer, value util.Diffs)

func WriteDiffsSet

func WriteDiffsSet(qq422016 qtio422016.Writer, key string, value util.DiffsSet, limit int, ps *cutil.PageState)

func WriteDurationSeconds added in v1.2.19

func WriteDurationSeconds(qq422016 qtio422016.Writer, seconds float64)

func WriteFloat

func WriteFloat(qq422016 qtio422016.Writer, f any)

func WriteFloatArray

func WriteFloatArray(qq422016 qtio422016.Writer, value []any)

func WriteFormatLang added in v1.6.0

func WriteFormatLang(qq422016 qtio422016.Writer, v string, ext string)

func WriteInt

func WriteInt(qq422016 qtio422016.Writer, i any)

func WriteIntArray

func WriteIntArray(qq422016 qtio422016.Writer, value []any)

func WriteMap added in v1.2.17

func WriteMap(qq422016 qtio422016.Writer, preserveWhitespace bool, m util.ValueMap, ps *cutil.PageState)

func WriteMapArray

func WriteMapArray(qq422016 qtio422016.Writer, preserveWhitespace bool, ps *cutil.PageState, maps ...util.ValueMap)

func WriteMapKeys added in v1.5.4

func WriteMapKeys(qq422016 qtio422016.Writer, m util.ValueMap)

func WriteOption

func WriteOption(qq422016 qtio422016.Writer, x any, t *types.Option, ps *cutil.PageState)

func WriteOrderedMap added in v1.5.31

func WriteOrderedMap(qq422016 qtio422016.Writer, preserveWhitespace bool, m *util.OrderedMap[any], ps *cutil.PageState)

func WriteOrderedMapArray added in v1.5.31

func WriteOrderedMapArray(qq422016 qtio422016.Writer, preserveWhitespace bool, ps *cutil.PageState, maps ...*util.OrderedMap[any])

func WritePackage

func WritePackage(qq422016 qtio422016.Writer, v util.Pkg)

func WritePercent added in v1.7.20

func WritePercent(qq422016 qtio422016.Writer, f float64)

func WriteString

func WriteString(qq422016 qtio422016.Writer, value string, classes ...string)

func WriteStringArray

func WriteStringArray(qq422016 qtio422016.Writer, value []string)

func WriteStringRich

func WriteStringRich(qq422016 qtio422016.Writer, value string, code bool, maxLength int, classes ...string)

func WriteTags added in v1.5.4

func WriteTags(qq422016 qtio422016.Writer, values []string, titles []string, url ...string)

func WriteTimestamp

func WriteTimestamp(qq422016 qtio422016.Writer, value *time.Time)

func WriteTimestampDay

func WriteTimestampDay(qq422016 qtio422016.Writer, value *time.Time)

func WriteTimestampMillis added in v1.1.1

func WriteTimestampMillis(qq422016 qtio422016.Writer, value *time.Time)

func WriteTimestampRelative

func WriteTimestampRelative(qq422016 qtio422016.Writer, value *time.Time, static bool)

func WriteType

func WriteType(qq422016 qtio422016.Writer, v types.Type)

func WriteURL added in v1.2.17

func WriteURL(qq422016 qtio422016.Writer, u any, content string, includeExternalIcon bool, ps *cutil.PageState)

func WriteUUID

func WriteUUID(qq422016 qtio422016.Writer, value *uuid.UUID)

Types

This section is empty.

Jump to

Keyboard shortcuts

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