goutil

package module
v0.0.0-...-1229bf8 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2024 License: MIT Imports: 14 Imported by: 0

README

goutil

Utility functions for go

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Boolp

func Boolp(b bool) *bool

func Bytep

func Bytep(b byte) *byte

func DoBatchWork

func DoBatchWork[T any](size int, items []T, f func(int, T))

func Float32p

func Float32p(f float32) *float32

func Float64p

func Float64p(f float64) *float64

func Getenv

func Getenv(name, fallback string) string

func Int16p

func Int16p(x int16) *int16

func Int32p

func Int32p(x int32) *int32

func Int64p

func Int64p(x int64) *int64

func Int8p

func Int8p(x int8) *int8

func Intp

func Intp(x int) *int

func Keys

func Keys[T comparable, U any](m map[T]U) []T

func MustEnv

func MustEnv(varname string) string

func MustExec

func MustExec(command string) string

func MustExecArgs

func MustExecArgs(command string, args ...string) string

func MustExecArgsStdin

func MustExecArgsStdin(command string, args []string, r io.Reader) string

func MustJson

func MustJson(x any, pretty ...bool) string

func Runep

func Runep(r rune) *rune

func Sort

func Sort[T constraints.Ordered](xs []T) []T

func Stringp

func Stringp(s string) *string

func Uint16p

func Uint16p(x uint16) *uint16

func Uint32p

func Uint32p(x uint32) *uint32

func Uint64p

func Uint64p(x uint64) *uint64

func Uint8p

func Uint8p(x uint8) *uint8

func Uintp

func Uintp(x uint) *uint

Types

type Map

type Map map[string]any

func (*Map) Scan

func (m *Map) Scan(src interface{}) error

func (Map) Value

func (m Map) Value() (driver.Value, error)

type OrderedJsonObj

type OrderedJsonObj struct {
	Keys   []string
	Values []any
	Map    map[string]any
	Nulls  bool
}

Marshals a JSON object using the given key order and values from a slice or map. The "Values" and "Map" fields are mutually exclusive.

func (OrderedJsonObj) MarshalJSON

func (o OrderedJsonObj) MarshalJSON() ([]byte, error)

Jump to

Keyboard shortcuts

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