Documentation
¶
Index ¶
- func AbsoluteDate(t time.Time) string
- func HasField(v any, name string) bool
- func HumanDuration(d time.Duration) string
- func IsImageThread(v string) bool
- func IsRobot(user any) bool
- func IsValidThread(v string) bool
- func MediaDuration(d time.Duration) string
- func NewWithVersionFunc(ctx context.Context, prefix string, fsys fs.FS) *withVersion
- func PrettyDuration(d time.Duration) string
- func PrintJSON(v any) (template.HTML, error)
- func Reverse(s any) any
- func SafeHTML(v any) (template.HTML, error)
- func SafeHTMLAttr(v any) (template.HTMLAttr, error)
- func SafeURL(v any) (template.URL, error)
- func TemplateFuncs() template.FuncMap
- func TimeAgo(now func() time.Time) func(time.Time, string) string
- func TimeagoDuration(d time.Duration) string
- type SongPairing
- type StatefulFuncs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AbsoluteDate ¶
func HumanDuration ¶
func IsImageThread ¶
IsImageThread tells you if the thread is an image thread
func IsValidThread ¶
IsValidThread tells you if a thread is valid, that is not-empty or is the literal 'none'
func MediaDuration ¶
func NewWithVersionFunc ¶
func PrettyDuration ¶
func Reverse ¶
Reverse reverses a slice input and returns an iter.Seq2 with both index and element, this means you always need to use {{range $i, $v := Reverse <slice>}} to get both values out, using a single only gets you the index.
func TemplateFuncs ¶
func TimeAgo ¶
example usage: {{ TimeAgo .CreatedAt "%y foo, %d, %h hours, %mbar" }} -> "2 foo, 23, 11 hours, 12bar" if >0 years have passed, otherwise "23, 11 hours, 12bar" etc.
func TimeagoDuration ¶
Types ¶
type SongPairing ¶
type StatefulFuncs ¶
type StatefulFuncs struct {
// contains filtered or unexported fields
}
func NewStatefulFunctions ¶
func NewStatefulFunctions(cfg config.Config, status util.StreamValuer[radio.Status]) *StatefulFuncs
func (*StatefulFuncs) FuncMap ¶
func (sf *StatefulFuncs) FuncMap() template.FuncMap
func (*StatefulFuncs) SongFileSize ¶
func (sf *StatefulFuncs) SongFileSize(song any) string
func (*StatefulFuncs) Status ¶
func (sf *StatefulFuncs) Status() radio.Status
func (*StatefulFuncs) UpdateWithVersion ¶
func (sf *StatefulFuncs) UpdateWithVersion(wv *withVersion)
func (*StatefulFuncs) WithVersion ¶
func (sf *StatefulFuncs) WithVersion(urlPath string) template.URL
Click to show internal directories.
Click to hide internal directories.