util

package
v0.1.13 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2021 License: MIT Imports: 20 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{} /* 115 elements not displayed */

nolint

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

nolint

Functions

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 MicrosToMillis

func MicrosToMillis(i int) string

func OxfordComma

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

func Plural

func Plural(count int, s string) string

func PluralMaybe

func PluralMaybe(s string, count int) string

func RandomBool

func RandomBool() bool

func RandomBytes

func RandomBytes(size int) []byte

func RandomInt

func RandomInt(maxInclusive 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 SplitAndTrim

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

func SplitString

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

func SplitStringLast

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

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 StringArrayQuoted

func StringArrayQuoted(a []string) []string

func StringForms

func StringForms(s string) (string, string)

func TimeFromJS

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

func TimeFromString

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

func TimeFromYMD

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

func TimeToString

func TimeToString(d *time.Time) string

func TimeToYMD

func TimeToYMD(d *time.Time) string

func TimerEnd

func TimerEnd(startNanos int64) int

func TimerStart

func TimerStart() int64

func ToCamel

func ToCamel(s string) string

func ToJSON

func ToJSON(x interface{}) string

func ToJSONBytes

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

func ToJSONCompact

func ToJSONCompact(x interface{}) string

func ToLowerCamel

func ToLowerCamel(s string) string

func ToPlural

func ToPlural(s string) string

func ToSingular

func ToSingular(s string) string

func ToTitle

func ToTitle(s string) 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 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) 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) 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