Documentation ¶
Overview ¶
Content managed by Project Forge, see [projectforge.md] for details.
Content managed by Project Forge, see [projectforge.md] for details.
Content managed by Project Forge, see [projectforge.md] for details.
Content managed by Project Forge, see [projectforge.md] for details.
Content managed by Project Forge, see [projectforge.md] for details.
Content managed by Project Forge, see [projectforge.md] for details.
Content managed by Project Forge, see [projectforge.md] for details.
Content managed by Project Forge, see [projectforge.md] for details.
Content managed by Project Forge, see [projectforge.md] for details.
Content managed by Project Forge, see [projectforge.md] for details.
Content managed by Project Forge, see [projectforge.md] for details.
Content managed by Project Forge, see [projectforge.md] for details.
Content managed by Project Forge, see [projectforge.md] for details.
Content managed by Project Forge, see [projectforge.md] for details.
Content managed by Project Forge, see [projectforge.md] for details.
Content managed by Project Forge, see [projectforge.md] for details.
Content managed by Project Forge, see [projectforge.md] for details.
Content managed by Project Forge, see [projectforge.md] for details.
Content managed by Project Forge, see [projectforge.md] for details.
Content managed by Project Forge, see [projectforge.md] for details.
Content managed by Project Forge, see [projectforge.md] for details.
Content managed by Project Forge, see [projectforge.md] for details.
Content managed by Project Forge, see [projectforge.md] for details.
Package util $PF_IGNORE$ Code generated from files in client/src/svg. See https://projectforge.dev for details. DO NOT EDIT.
Content managed by Project Forge, see [projectforge.md] for details.
Content managed by Project Forge, see [projectforge.md] for details.
Index ¶
- Constants
- Variables
- func ArrayFromAny(dest any) []any
- func ArrayRemoveDuplicates[T comparable](x []T) []T
- func AsyncCollect[T any, R any](items []T, f func(item T) (R, error)) ([]R, []error)
- func ByteSizeIEC(b int64) string
- func ByteSizeSI(b int64) string
- func CycleJSON(src any, tgt any) error
- func DecryptMessage(key []byte, message string, logger Logger) (string, error)
- func EncryptMessage(key []byte, message string, logger Logger) (string, error)
- func FromJSON(msg json.RawMessage, tgt any) error
- func FromJSONInterface(msg json.RawMessage) (any, error)
- func FromJSONReader(r io.Reader, tgt any) error
- func FromJSONStrict(msg json.RawMessage, tgt any) error
- func GetEnv(name string, defaultValue ...string) string
- func GetEnvBool(name string, defaultValue bool) bool
- func GetEnvDuration(name string, defaultValue time.Duration) time.Duration
- func GetEnvInt(name string, defaultValue int) int
- func HashFNV32(s string) uint32
- func HashSHA256(s string) string
- func InterfaceArrayFrom[T any](x ...T) []any
- func JSONToMap(i any) map[string]any
- func LengthAny(dest any) int
- func MarkdownTable(header []string, rows [][]string) (string, error)
- func MicrosToMillis(i int) string
- func NowPointer() *time.Time
- func RandomBool() bool
- func RandomBytes(size int) []byte
- func RandomDate() time.Time
- func RandomInt(maxExclusive int) int
- func RandomString(length int) string
- func ReplaceEnvVars(s string, logger Logger) string
- func RunProcess(cmd string, path string, in io.Reader, out io.Writer, er io.Writer) (int, error)
- func RunProcessSimple(cmd string, path string) (int, string, error)
- func StringArrayFromInterfaces(a []any, maxLength int) []string
- func StringArrayMaxLength(a []string) int
- func StringArrayOxfordComma(names []string, separator string) string
- func StringArrayQuoted(a []string) []string
- func StringForms(s string) (string, string)
- func StringPad(s string, size int) string
- func StringPlural(count int, s string) string
- func StringPluralMaybe(s string, count int) string
- func StringRepeat(s string, n int) string
- func StringSplit(s string, sep byte, cutc bool) (string, string)
- func StringSplitAndTrim(s string, delim string) []string
- func StringSplitLast(s string, sep byte, cutc bool) (string, string)
- func StringToCamel(s string) string
- func StringToLowerCamel(s string) string
- func StringToPlural(s string) string
- func StringToSingular(s string) string
- func StringToTitle(s string) string
- func StringTruncate(s string, max int) string
- func TimeCurrentMillis() int64
- func TimeFromFull(s string) (*time.Time, error)
- func TimeFromHTML(s string) (*time.Time, error)
- func TimeFromJS(s string) (*time.Time, error)
- func TimeFromString(s string) (*time.Time, error)
- func TimeFromStringFmt(s string, fmt string) (*time.Time, error)
- func TimeFromYMD(s string) (*time.Time, error)
- func TimeRelative(t *time.Time) string
- func TimeToFull(d *time.Time) string
- func TimeToHTML(d *time.Time) string
- func TimeToJS(d *time.Time) string
- func TimeToString(d *time.Time, fmt string) string
- func TimeToYMD(d *time.Time) string
- func ToJSON(x any) string
- func ToJSONBytes(x any, indent bool) []byte
- func ToJSONCompact(x any) string
- func UUID() uuid.UUID
- func UUIDFromString(s string) *uuid.UUID
- func UUIDP() *uuid.UUID
- type DebugInfo
- type Diff
- type Diffs
- type ErrorDetail
- type ErrorFrame
- type KeyTypeDesc
- type KeyTypeDescs
- type KeyValInt
- type KeyValInts
- type Logger
- type OrderedMap
- func (o *OrderedMap[V]) Append(k string, v V)
- func (o *OrderedMap[V]) Get(k string) (V, bool)
- func (o *OrderedMap[V]) GetSimple(k string) V
- func (o OrderedMap[V]) MarshalJSON() ([]byte, error)
- func (o OrderedMap[V]) MarshalXML(e *xml.Encoder, start xml.StartElement) error
- func (o OrderedMap[V]) MarshalYAML() (any, error)
- func (o *OrderedMap[V]) UnmarshalJSON(b []byte) error
- type Pkg
- func (p Pkg) Drop(n int) Pkg
- func (p Pkg) Equals(other Pkg) bool
- func (p Pkg) Last() string
- func (p Pkg) Push(name string) Pkg
- func (p Pkg) Quoted(quote string) string
- func (p Pkg) Shift() Pkg
- func (p Pkg) StartsWith(t Pkg) bool
- func (p Pkg) String() string
- func (p Pkg) StringWith(extra ...string) string
- func (p Pkg) ToPath(extra ...string) string
- func (p Pkg) Trim(src Pkg) Pkg
- func (p Pkg) With(key string) Pkg
- type Timer
- type ValueMap
- func (m ValueMap) Add(kvs ...any)
- func (m ValueMap) AsChanges() (ValueMap, error)
- func (m ValueMap) Clone() ValueMap
- func (m ValueMap) GetArray(key string, allowEmpty bool, allowNonArray bool) ([]any, error)
- func (m ValueMap) GetBool(key string, allowEmpty bool) (bool, error)
- func (m ValueMap) GetBoolOpt(key string) bool
- func (m ValueMap) GetFloat(key string, allowEmpty bool) (float64, error)
- func (m ValueMap) GetInt(key string, allowEmpty bool) (int, error)
- func (m ValueMap) GetInt64(key string, allowEmpty bool) (int64, error)
- func (m ValueMap) GetMap(key string, allowEmpty bool) (ValueMap, error)
- func (m ValueMap) GetPath(path string, allowMissing bool) (any, error)
- func (m ValueMap) GetRequired(k string) (any, error)
- func (m ValueMap) GetString(key string, allowEmpty bool) (string, error)
- func (m ValueMap) GetStringArray(key string, allowEmpty bool) ([]string, error)
- func (m ValueMap) GetStringOpt(key string) string
- func (m ValueMap) GetTime(key string, allowEmpty bool) (*time.Time, error)
- func (m ValueMap) GetType(key string, ret any) error
- func (m ValueMap) GetUUID(key string, allowEmpty bool) (*uuid.UUID, error)
- func (m ValueMap) Keys() []string
- func (m ValueMap) KeysAndValues() ([]string, []any)
- func (m ValueMap) MarshalXML(e *xml.Encoder, start xml.StartElement) error
- func (m ValueMap) Merge(args ...ValueMap) ValueMap
- func (m ValueMap) ParseArray(path string, allowMissing bool, allowEmpty bool, allowNonArray bool) ([]any, error)
- func (m ValueMap) ParseBool(path string, allowMissing bool, allowEmpty bool) (bool, error)
- func (m ValueMap) ParseFloat(path string, allowMissing bool, allowEmpty bool) (float64, error)
- func (m ValueMap) ParseInt(path string, allowMissing bool, allowEmpty bool) (int, error)
- func (m ValueMap) ParseMap(path string, allowMissing bool, allowEmpty bool) (ValueMap, error)
- func (m ValueMap) ParseString(path string, allowMissing bool, allowEmpty bool) (string, error)
- func (m ValueMap) ParseTime(path string, allowMissing bool, allowEmpty bool) (*time.Time, error)
- func (m ValueMap) ParseUUID(path string, allowMissing bool, allowEmpty bool) (*uuid.UUID, error)
- func (m ValueMap) SetPath(path string, val any) any
- func (m ValueMap) ToQueryString() string
Constants ¶
const ( BoolTrue = "true" AppKey = "projectforge" AppName = "Project Forge" AppSummary = "Build and maintain feature-rich applications using Golang" AppPort = 40000 AppContact = "Kyle <kyle@kyleu.com>" AppURL = "https://projectforge.dev" AppSource = "https://github.com/kyleu/projectforge" AppLegal = `Built by <a href="mailto:kyle@kyleu.com">Kyle</a>, all rights reserved` )
Variables ¶
var SVGIconKeys = []string{} /* 124 elements not displayed */
nolint
var SVGLibrary = map[string]string{}/* 125 elements not displayed */
nolint
Functions ¶
func ArrayFromAny ¶ added in v0.2.32
func ArrayRemoveDuplicates ¶ added in v0.2.33
func ArrayRemoveDuplicates[T comparable](x []T) []T
func AsyncCollect ¶ added in v0.2.29
func ByteSizeIEC ¶ added in v0.2.38
func ByteSizeSI ¶ added in v0.2.38
func DecryptMessage ¶
func EncryptMessage ¶
func FromJSONInterface ¶
func FromJSONInterface(msg json.RawMessage) (any, error)
func FromJSONStrict ¶
func FromJSONStrict(msg json.RawMessage, tgt any) error
func GetEnvBool ¶ added in v0.2.14
func GetEnvDuration ¶ added in v0.3.8
func HashSHA256 ¶
HashSHA256 returns a Base64-encoded string representing the SHA-256 hash of the argument.
func InterfaceArrayFrom ¶ added in v0.2.10
func MarkdownTable ¶ added in v0.2.9
func MicrosToMillis ¶
func NowPointer ¶
func RandomBool ¶
func RandomBool() bool
func RandomBytes ¶
func RandomDate ¶
func RandomString ¶
func ReplaceEnvVars ¶
func RunProcess ¶
func StringArrayMaxLength ¶
func StringArrayOxfordComma ¶
func StringArrayQuoted ¶
func StringForms ¶
func StringPlural ¶
func StringPluralMaybe ¶
func StringRepeat ¶
func StringSplitAndTrim ¶
func StringToCamel ¶
func StringToLowerCamel ¶
func StringToPlural ¶
func StringToSingular ¶
func StringToTitle ¶
func StringTruncate ¶
func TimeCurrentMillis ¶
func TimeCurrentMillis() int64
func TimeRelative ¶
func TimeToFull ¶
func TimeToHTML ¶
func ToJSONBytes ¶
func ToJSONCompact ¶
func UUIDFromString ¶
Types ¶
type DebugInfo ¶
type DebugInfo struct { Tags *OrderedMap[string] Mods []*debug.Module }
func GetDebugInfo ¶
type Diff ¶
type ErrorDetail ¶
type ErrorDetail struct { Message string `json:"message"` StackTrace errors.StackTrace `json:"-"` Cause *ErrorDetail `json:"cause,omitempty"` }
func GetErrorDetail ¶
func GetErrorDetail(e error) *ErrorDetail
type ErrorFrame ¶
func TraceDetail ¶
func TraceDetail(trace errors.StackTrace) []ErrorFrame
type KeyTypeDesc ¶ added in v0.2.9
type KeyTypeDesc struct { Key string `json:"key"` Type string `json:"type"` Description string `json:"description"` }
func (*KeyTypeDesc) Array ¶ added in v0.2.9
func (k *KeyTypeDesc) Array(key string) []string
type KeyTypeDescs ¶ added in v0.2.9
type KeyTypeDescs []*KeyTypeDesc
func (KeyTypeDescs) Array ¶ added in v0.2.9
func (k KeyTypeDescs) Array(key string) [][]string
func (KeyTypeDescs) Sort ¶ added in v0.2.9
func (k KeyTypeDescs) Sort()
type KeyValInts ¶ added in v0.2.30
type KeyValInts []*KeyValInt
func (KeyValInts) String ¶ added in v0.2.30
func (k KeyValInts) String() string
func (KeyValInts) ToMap ¶ added in v0.2.30
func (k KeyValInts) ToMap() map[string]int
type Logger ¶ added in v0.2.35
type Logger = *zap.SugaredLogger
type OrderedMap ¶
func NewOrderedMap ¶
func NewOrderedMap[V any](lexical bool, capacity int) *OrderedMap[V]
func (*OrderedMap[V]) Append ¶
func (o *OrderedMap[V]) Append(k string, v V)
func (*OrderedMap[V]) Get ¶
func (o *OrderedMap[V]) Get(k string) (V, bool)
func (*OrderedMap[V]) GetSimple ¶
func (o *OrderedMap[V]) GetSimple(k string) V
func (OrderedMap[V]) MarshalJSON ¶
func (o OrderedMap[V]) MarshalJSON() ([]byte, error)
func (OrderedMap[V]) MarshalXML ¶
func (o OrderedMap[V]) MarshalXML(e *xml.Encoder, start xml.StartElement) error
func (OrderedMap[V]) MarshalYAML ¶
func (o OrderedMap[V]) MarshalYAML() (any, error)
func (*OrderedMap[V]) UnmarshalJSON ¶
func (o *OrderedMap[V]) UnmarshalJSON(b []byte) error
type Timer ¶ added in v0.2.9
func TimerStart ¶
func TimerStart() *Timer