conv

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2024 License: Apache-2.0 Imports: 7 Imported by: 130

Documentation

Overview

Package conv contains helper functions for converting between various data types.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddrToString added in v0.40.0

func AddrToString(v netip.Addr) string

func BoolArrayToString

func BoolArrayToString(vs []bool) []string

func BoolToString

func BoolToString(v bool) string

func BytesArrayToString

func BytesArrayToString(vs [][]byte) []string

func BytesToString

func BytesToString(v []byte) string

func Date

func Date(t time.Time) time.Time

func DateTime

func DateTime(t time.Time) time.Time

func DateTimeToString added in v0.40.0

func DateTimeToString(v time.Time) string

func DateToString added in v0.40.0

func DateToString(v time.Time) string

func DurationToString

func DurationToString(v time.Duration) string

func Float32ArrayToString

func Float32ArrayToString(vs []float32) []string

func Float32ToString

func Float32ToString(v float32) string

func Float64ArrayToString

func Float64ArrayToString(vs []float64) []string

func Float64ToString

func Float64ToString(v float64) string

func Int16ToString added in v0.49.0

func Int16ToString(v int16) string

func Int32ArrayToString

func Int32ArrayToString(vs []int32) []string

func Int32ToString

func Int32ToString(v int32) string

func Int64ArrayToString

func Int64ArrayToString(vs []int64) []string

func Int64ToString

func Int64ToString(v int64) string

func Int8ToString added in v0.49.0

func Int8ToString(v int8) string

func IntToString

func IntToString(v int) string

func MACArrayToString added in v0.82.0

func MACArrayToString(vs []net.HardwareAddr) []string

func MACToString added in v0.82.0

func MACToString(v net.HardwareAddr) string

func StringArrayToString

func StringArrayToString(vs []string) []string

func StringFloat32ToString added in v0.70.0

func StringFloat32ToString(v float32) string

func StringFloat64ToString added in v0.70.0

func StringFloat64ToString(v float64) string

func StringInt16ToString added in v0.70.0

func StringInt16ToString(v int16) string

func StringInt32ToString added in v0.40.0

func StringInt32ToString(v int32) string

func StringInt64ToString added in v0.40.0

func StringInt64ToString(v int64) string

func StringInt8ToString added in v0.70.0

func StringInt8ToString(v int8) string

func StringIntToString added in v0.70.0

func StringIntToString(v int) string

func StringToString

func StringToString(v string) string

func StringUint16ToString added in v0.70.0

func StringUint16ToString(v uint16) string

func StringUint32ToString added in v0.70.0

func StringUint32ToString(v uint32) string

func StringUint64ToString added in v0.70.0

func StringUint64ToString(v uint64) string

func StringUint8ToString added in v0.70.0

func StringUint8ToString(v uint8) string

func StringUintToString added in v0.70.0

func StringUintToString(v uint) string

func Time

func Time(t time.Time) time.Time

func TimeArrayToString

func TimeArrayToString(vs []time.Time) []string

func TimeToString

func TimeToString(v time.Time) string

func ToAddr added in v0.40.0

func ToAddr(s string) (netip.Addr, error)

func ToBool

func ToBool(s string) (bool, error)

func ToBoolArray

func ToBoolArray(a []string) ([]bool, error)

func ToBytes

func ToBytes(s string) ([]byte, error)

func ToBytesArray

func ToBytesArray(a []string) ([][]byte, error)

func ToDate added in v0.40.0

func ToDate(s string) (time.Time, error)

func ToDateTime added in v0.40.0

func ToDateTime(s string) (time.Time, error)

func ToDuration

func ToDuration(s string) (time.Duration, error)

func ToFloat32

func ToFloat32(s string) (float32, error)

func ToFloat32Array

func ToFloat32Array(a []string) ([]float32, error)

func ToFloat64

func ToFloat64(s string) (float64, error)

func ToFloat64Array

func ToFloat64Array(a []string) ([]float64, error)

func ToInt

func ToInt(s string) (int, error)

func ToInt16 added in v0.49.0

func ToInt16(s string) (int16, error)

func ToInt32

func ToInt32(s string) (int32, error)

func ToInt32Array

func ToInt32Array(a []string) ([]int32, error)

func ToInt64

func ToInt64(s string) (int64, error)

func ToInt64Array

func ToInt64Array(a []string) ([]int64, error)

func ToInt8 added in v0.49.0

func ToInt8(s string) (int8, error)

func ToMAC added in v0.82.0

func ToMAC(s string) (net.HardwareAddr, error)

func ToMACArray added in v0.82.0

func ToMACArray(a []string) ([]net.HardwareAddr, error)

func ToString

func ToString(s string) (string, error)

func ToStringArray

func ToStringArray(a []string) ([]string, error)

func ToStringFloat32 added in v0.70.0

func ToStringFloat32(s string) (float32, error)

func ToStringFloat64 added in v0.70.0

func ToStringFloat64(s string) (float64, error)

func ToStringInt added in v0.70.0

func ToStringInt(s string) (int, error)

func ToStringInt16 added in v0.70.0

func ToStringInt16(s string) (int16, error)

func ToStringInt32 added in v0.40.0

func ToStringInt32(s string) (int32, error)

func ToStringInt64 added in v0.40.0

func ToStringInt64(s string) (int64, error)

func ToStringInt8 added in v0.70.0

func ToStringInt8(s string) (int8, error)

func ToStringUint added in v0.70.0

func ToStringUint(s string) (uint, error)

func ToStringUint16 added in v0.70.0

func ToStringUint16(s string) (uint16, error)

func ToStringUint32 added in v0.70.0

func ToStringUint32(s string) (uint32, error)

func ToStringUint64 added in v0.70.0

func ToStringUint64(s string) (uint64, error)

func ToStringUint8 added in v0.70.0

func ToStringUint8(s string) (uint8, error)

func ToTime

func ToTime(s string) (time.Time, error)

func ToTimeArray

func ToTimeArray(a []string) ([]time.Time, error)

func ToURL

func ToURL(s string) (url.URL, error)

func ToUUID

func ToUUID(s string) (uuid.UUID, error)

func ToUUIDArray

func ToUUIDArray(a []string) ([]uuid.UUID, error)

func ToUint added in v0.49.0

func ToUint(s string) (uint, error)

func ToUint16 added in v0.49.0

func ToUint16(s string) (uint16, error)

func ToUint32 added in v0.49.0

func ToUint32(s string) (uint32, error)

func ToUint64 added in v0.49.0

func ToUint64(s string) (uint64, error)

func ToUint8 added in v0.49.0

func ToUint8(s string) (uint8, error)

func ToUnixMicro added in v0.40.0

func ToUnixMicro(s string) (time.Time, error)

func ToUnixMilli added in v0.40.0

func ToUnixMilli(s string) (time.Time, error)

func ToUnixNano added in v0.40.0

func ToUnixNano(s string) (time.Time, error)

func ToUnixSeconds added in v0.40.0

func ToUnixSeconds(s string) (time.Time, error)

func URLToString

func URLToString(v url.URL) string

func UUIDArrayToString

func UUIDArrayToString(vs []uuid.UUID) []string

func UUIDToString

func UUIDToString(v uuid.UUID) string

func Uint16ToString added in v0.49.0

func Uint16ToString(v uint16) string

func Uint32ToString added in v0.49.0

func Uint32ToString(v uint32) string

func Uint64ToString added in v0.49.0

func Uint64ToString(v uint64) string

func Uint8ToString added in v0.49.0

func Uint8ToString(v uint8) string

func UintToString added in v0.49.0

func UintToString(v uint) string

func UnixMicroToString added in v0.40.0

func UnixMicroToString(v time.Time) string

func UnixMilliToString added in v0.40.0

func UnixMilliToString(v time.Time) string

func UnixNanoToString added in v0.40.0

func UnixNanoToString(v time.Time) string

func UnixSecondsToString added in v0.40.0

func UnixSecondsToString(v time.Time) string

Types

This section is empty.

Jump to

Keyboard shortcuts

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