util

package
v0.1.24 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2021 License: MIT Imports: 28 Imported by: 0

Documentation

Overview

Package util $PF_IGNORE$ Code generated from files in client/src/svg. See https://projectforge.dev for details. DO NOT EDIT.

Index

Constants

View Source
const (
	AppKey     = "projectforge"
	AppName    = "Project Forge"
	AppSummary = "Build and maintain feature-rich applications using Golang"
	AppPort    = 40000
	AppContact = "Kyle U <kyle@kyleu.com>"
	AppURL     = "https://projectforge.dev"
	AppSource  = "https://github.com/kyleu/projectforge"
	AppLegal   = `Built by <a href="mailto:kyle@kyleu.com">Kyle U</a>, all rights reserved`
)

Variables

View Source
var SVGIconKeys = []string{} /* 117 elements not displayed */

nolint

View Source
var SVGLibrary = map[string]string{}/* 118 elements not displayed */

nolint

Functions

func CycleJSON added in v0.1.19

func CycleJSON(src interface{}, tgt interface{}) error

func DecryptMessage added in v0.1.22

func DecryptMessage(key []byte, message string, logger *zap.SugaredLogger) (string, error)

func EncryptMessage added in v0.1.22

func EncryptMessage(key []byte, message string, logger *zap.SugaredLogger) (string, error)

func FromJSON

func FromJSON(msg json.RawMessage, tgt interface{}) error

func FromJSONInterface

func FromJSONInterface(msg json.RawMessage) (interface{}, error)

func FromJSONReader

func FromJSONReader(r io.Reader, tgt interface{}) error

func FromJSONStrict

func FromJSONStrict(msg json.RawMessage, tgt interface{}) error

func GetEnvStringWithDefault added in v0.1.12

func GetEnvStringWithDefault(envName string, defaultValue string) string

func GetUUIDFromString

func GetUUIDFromString(s string) *uuid.UUID

func HashFNV32 added in v0.1.22

func HashFNV32(s string) uint32

func HashSHA256 added in v0.1.22

func HashSHA256(s string) string

Returns a Base64-encoded string representing the SHA-256 hash of the argument.

func InterfaceArrayFromStrings added in v0.1.17

func InterfaceArrayFromStrings(s []string) []interface{}

func MicrosToMillis

func MicrosToMillis(i int) string

func RandomBool

func RandomBool() bool

func RandomBytes

func RandomBytes(size int) []byte

func RandomDate added in v0.1.19

func RandomDate() time.Time

func RandomInt

func RandomInt(maxExclusive int) int

func RandomString

func RandomString(length int) string

func ReplaceEnvVars

func ReplaceEnvVars(s string, logger *zap.SugaredLogger) string

func RunProcess

func RunProcess(cmd string, path string, in io.Reader, out io.Writer, er io.Writer) (int, error)

func RunProcessSimple

func RunProcessSimple(cmd string, path string) (int, string, error)

func StringArrayContains

func StringArrayContains(a []string, str string) bool

func StringArrayCopy

func StringArrayCopy(a []string) []string

func StringArrayFromInterfaces

func StringArrayFromInterfaces(a []interface{}, maxLength int) []string

func StringArrayIndexOf

func StringArrayIndexOf(a []string, str string) int

func StringArrayMaxLength added in v0.1.24

func StringArrayMaxLength(a []string) int

func StringArrayOxfordComma added in v0.1.24

func StringArrayOxfordComma(names []string, separator string) string

func StringArrayQuoted

func StringArrayQuoted(a []string) []string

func StringForms

func StringForms(s string) (string, string)

func StringPad added in v0.1.24

func StringPad(s string, size int) string

func StringPlural added in v0.1.24

func StringPlural(count int, s string) string

func StringPluralMaybe added in v0.1.24

func StringPluralMaybe(s string, count int) string

func StringSplit added in v0.1.24

func StringSplit(s string, sep byte, cutc bool) (string, string)

func StringSplitAndTrim added in v0.1.24

func StringSplitAndTrim(s string, delim string) []string

func StringSplitLast added in v0.1.24

func StringSplitLast(s string, sep byte, cutc bool) (string, string)

func StringToCamel added in v0.1.24

func StringToCamel(s string) string

func StringToLowerCamel added in v0.1.24

func StringToLowerCamel(s string) string

func StringToPlural added in v0.1.24

func StringToPlural(s string) string

func StringToSingular added in v0.1.24

func StringToSingular(s string) string

func StringToTitle added in v0.1.24

func StringToTitle(s string) string

func TimeCurrentMillis added in v0.1.20

func TimeCurrentMillis() int64

func TimeFromFull added in v0.1.22

func TimeFromFull(s string) (*time.Time, error)

func TimeFromHTML added in v0.1.22

func TimeFromHTML(s string) (*time.Time, error)

func TimeFromJS

func TimeFromJS(s string) (*time.Time, error)

func TimeFromString

func TimeFromString(s string, fmt string) (*time.Time, error)

func TimeFromYMD

func TimeFromYMD(s string) (*time.Time, error)

func TimeRelative added in v0.1.20

func TimeRelative(t *time.Time) string

func TimeToFull added in v0.1.22

func TimeToFull(d *time.Time) string

func TimeToHTML added in v0.1.22

func TimeToHTML(d *time.Time) string

func TimeToJS added in v0.1.22

func TimeToJS(d *time.Time) string

func TimeToString

func TimeToString(d *time.Time, fmt string) string

func TimeToYMD

func TimeToYMD(d *time.Time) string

func TimerEnd

func TimerEnd(startNanos int64) int

func TimerStart

func TimerStart() int64

func ToJSON

func ToJSON(x interface{}) string

func ToJSONBytes

func ToJSONBytes(x interface{}, indent bool) []byte

func ToJSONCompact

func ToJSONCompact(x interface{}) string

func UUID

func UUID() uuid.UUID

func UUIDP

func UUIDP() *uuid.UUID

Types

type Diff

type Diff struct {
	Path string `json:"path"`
	Old  string `json:"o,omitempty"`
	New  string `json:"n"`
}

func NewDiff

func NewDiff(p string, o string, n string) *Diff

func (Diff) String

func (d Diff) String() string

type Diffs

type Diffs []*Diff

func DiffObjects

func DiffObjects(l interface{}, r interface{}, path ...string) Diffs

func (Diffs) String

func (d Diffs) String() string

type ErrorDetail

type ErrorDetail struct {
	Message    string
	StackTrace errors.StackTrace
	Cause      *ErrorDetail
}

func GetErrorDetail

func GetErrorDetail(e error) *ErrorDetail

type ErrorFrame

type ErrorFrame struct {
	Key string
	Loc string
}

func TraceDetail

func TraceDetail(trace errors.StackTrace) []ErrorFrame

type Pkg added in v0.1.23

type Pkg []string

func (Pkg) Drop added in v0.1.23

func (p Pkg) Drop(n int) Pkg

func (Pkg) Equals added in v0.1.23

func (p Pkg) Equals(other Pkg) bool

func (Pkg) Last added in v0.1.23

func (p Pkg) Last() string

func (Pkg) Push added in v0.1.23

func (p Pkg) Push(name string) Pkg

func (Pkg) Quoted added in v0.1.23

func (p Pkg) Quoted(quote string) string

func (Pkg) Shift added in v0.1.23

func (p Pkg) Shift() Pkg

func (Pkg) StartsWith added in v0.1.23

func (p Pkg) StartsWith(t Pkg) bool

func (Pkg) String added in v0.1.23

func (p Pkg) String() string

func (Pkg) StringWith added in v0.1.23

func (p Pkg) StringWith(extra ...string) string

func (Pkg) ToPath added in v0.1.23

func (p Pkg) ToPath(extra ...string) string

func (Pkg) Trim added in v0.1.23

func (p Pkg) Trim(src Pkg) Pkg

func (Pkg) With added in v0.1.23

func (p Pkg) With(key string) Pkg

type ValueMap

type ValueMap map[string]interface{}

func RandomValueMap

func RandomValueMap(keys int) ValueMap

func ValueMapFor

func ValueMapFor(kvs ...interface{}) ValueMap

func (ValueMap) Add

func (m ValueMap) Add(kvs ...interface{})

func (ValueMap) AsChanges

func (m ValueMap) AsChanges() (ValueMap, error)

func (ValueMap) Clone

func (m ValueMap) Clone() ValueMap

func (ValueMap) GetBool

func (m ValueMap) GetBool(k string) (bool, error)

func (ValueMap) GetInt64 added in v0.1.9

func (m ValueMap) GetInt64(k string, allowEmpty bool) (int64, error)

func (ValueMap) GetInteger

func (m ValueMap) GetInteger(k string, allowEmpty bool) (int, error)

func (ValueMap) GetMap added in v0.1.18

func (m ValueMap) GetMap(key string, allowEmpty bool) (ValueMap, error)

func (ValueMap) GetPath

func (m ValueMap) GetPath(path string) interface{}

func (ValueMap) GetRequired

func (m ValueMap) GetRequired(k string) (interface{}, error)

func (ValueMap) GetString

func (m ValueMap) GetString(k string, allowEmpty bool) (string, error)

func (ValueMap) GetStringArray

func (m ValueMap) GetStringArray(k string, allowMissing bool) ([]string, error)

func (ValueMap) GetStringOpt

func (m ValueMap) GetStringOpt(k string) string

func (ValueMap) GetTime added in v0.1.12

func (m ValueMap) GetTime(k string) (*time.Time, error)

func (ValueMap) GetType added in v0.1.9

func (m ValueMap) GetType(k string, ret interface{}) error

func (ValueMap) Keys

func (m ValueMap) Keys() []string

func (ValueMap) KeysAndValues

func (m ValueMap) KeysAndValues() ([]string, []interface{})

func (ValueMap) MarshalXML added in v0.1.19

func (m ValueMap) MarshalXML(e *xml.Encoder, start xml.StartElement) error

func (ValueMap) Merge

func (m ValueMap) Merge(args ValueMap) ValueMap

func (ValueMap) SetPath

func (m ValueMap) SetPath(path string, val interface{}) interface{}

func (ValueMap) ToQueryString

func (m ValueMap) ToQueryString() string

func (ValueMap) Unset

func (m ValueMap) Unset(s string)

Jump to

Keyboard shortcuts

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