utils

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2023 License: Unlicense Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetEnv

func GetEnv(key string) string

GetEnv gets an environment variable or panics if it doesn't exist

func GetRecursiveFiles

func GetRecursiveFiles(fsys fs.FS, root string, filterFunction StringFilterFunction) ([]string, error)

GetRecursiveFiles gets all files in a directory recursively

func OobSwapWrap

func OobSwapWrap(id, html string) string

func RenderedTemplateString

func RenderedTemplateString(templatePath string, data map[string]interface{}) (string, error)

func SliceContains

func SliceContains[T comparable](list []T, item T) bool

SliceContains checks if a slice contains an item

Types

type StringFilterFunction

type StringFilterFunction func(string) bool

type WebsocketHeaders

type WebsocketHeaders struct {
	HxRequest     bool   `json:"Hx-Request,string"`
	HxTrigger     string `json:"Hx-Trigger"`
	HxTarget      string `json:"Hx-Target"`
	HxTriggerName string `json:"Hx-Trigger-Name"`
}

type WebsocketMessage

type WebsocketMessage struct {
	Data    map[string]string `json:"-"`
	Headers WebsocketHeaders  `json:"HEADERS"`
}

func DeserializeHtmxWebsocketMessage

func DeserializeHtmxWebsocketMessage(jsonStr string) (*WebsocketMessage, error)

Jump to

Keyboard shortcuts

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