convert

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2018 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RFC822       = "Mon, 02 Jan 2006 15:04:05 GMT"
	ISO8601      = "2006-01-02T15:04:05Z"
	ISO8601Milli = "2006-01-02T15:04:05.000Z"
	NGINXTime    = "02/Jan/2006:15:04:05 -0700"
)

Supported time layouts

Variables

This section is empty.

Functions

func Bool

func Bool(v bool) *bool

Bool returns a pointer to the given bool value.

func BoolMap

func BoolMap(src map[string]bool) map[string]*bool

BoolMap converts a string map of bool values into a string map of bool pointers.

func BoolSlice

func BoolSlice(src []bool) []*bool

BoolSlice converts a slice of bool values into a slice of bool pointers.

func BoolValue

func BoolValue(v *bool) bool

BoolValue returns the value of the given bool pointer or false if the pointer is nil.

func BoolValueMap

func BoolValueMap(src map[string]*bool) map[string]bool

BoolValueMap converts a string map of bool pointers into a string map of bool values.

func BoolValueSlice

func BoolValueSlice(src []*bool) []bool

BoolValueSlice converts a slice of bool pointers into a slice of bool values.

func Float32

func Float32(v float32) *float32

Float32 returns a pointer to the given float32 value.

func Float32Map

func Float32Map(src map[string]float32) map[string]*float32

Float32Map converts a string map of float32 values into a string map of float32 pointers.

func Float32Slice

func Float32Slice(src []float32) []*float32

Float32Slice converts a slice of float32 values into a slice of float32 pointers.

func Float32Value

func Float32Value(v *float32) float32

Float32Value returns the value of the given float32 pointer or 0 if the pointer is nil.

func Float32ValueMap

func Float32ValueMap(src map[string]*float32) map[string]float32

Float32ValueMap converts a string map of float32 pointers into a string map of float32 values.

func Float32ValueSlice

func Float32ValueSlice(src []*float32) []float32

Float32ValueSlice converts a slice of float32 pointers into a slice of float32 values.

func Float64

func Float64(v float64) *float64

Float64 returns a pointer to the given float64 value.

func Float64Map

func Float64Map(src map[string]float64) map[string]*float64

Float64Map converts a string map of float64 values into a string map of float64 pointers.

func Float64Slice

func Float64Slice(src []float64) []*float64

Float64Slice converts a slice of float64 values into a slice of float64 pointers.

func Float64Value

func Float64Value(v *float64) float64

Float64Value returns the value of the given float64 pointer or 0 if the pointer is nil.

func Float64ValueMap

func Float64ValueMap(src map[string]*float64) map[string]float64

Float64ValueMap converts a string map of float64 pointers into a string map of float64 values.

func Float64ValueSlice

func Float64ValueSlice(src []*float64) []float64

Float64ValueSlice converts a slice of float64 pointers into a slice of float64 values.

func Int

func Int(v int) *int

Int returns a pointer to the given int value.

func Int32

func Int32(v int32) *int32

Int32 returns a pointer to the given int32 value.

func Int32Map

func Int32Map(src map[string]int32) map[string]*int32

Int32Map converts a string map of int32 values into a string map of int32 pointers.

func Int32Slice

func Int32Slice(src []int32) []*int32

Int32Slice converts a slice of int32 values into a slice of int32 pointers.

func Int32Value

func Int32Value(v *int32) int32

Int32Value returns the value of the given int32 pointer or 0 if the pointer is nil.

func Int32ValueMap

func Int32ValueMap(src map[string]*int32) map[string]int32

Int32ValueMap converts a string map of int32 pointers into a string map of int32 values.

func Int32ValueSlice

func Int32ValueSlice(src []*int32) []int32

Int32ValueSlice converts a slice of int32 pointers into a slice of int32 values.

func Int64

func Int64(v int64) *int64

Int64 returns a pointer to the given int64 value.

func Int64Map

func Int64Map(src map[string]int64) map[string]*int64

Int64Map converts a string map of int64 values into a string map of int64 pointers.

func Int64Slice

func Int64Slice(src []int64) []*int64

Int64Slice converts a slice of int64 values into a slice of int64 pointers.

func Int64Uint

func Int64Uint(src int64) *uint

Int64Uint returns a uint pointer to the given int64 value.

func Int64Value

func Int64Value(v *int64) int64

Int64Value returns the value of the given int64 pointer or 0 if the pointer is nil.

func Int64ValueMap

func Int64ValueMap(src map[string]*int64) map[string]int64

Int64ValueMap converts a string map of int64 pointers into a string map of int64 values.

func Int64ValueSlice

func Int64ValueSlice(src []*int64) []int64

Int64ValueSlice converts a slice of int64 pointers into a slice of int64 values.

func IntMap

func IntMap(src map[string]int) map[string]*int

IntMap converts a string map of int values into a string map of int pointers.

func IntSlice

func IntSlice(src []int) []*int

IntSlice converts a slice of int values into a slice of int pointers.

func IntValue

func IntValue(v *int) int

IntValue returns the value of the given int pointer or 0 if the pointer is nil.

func IntValueMap

func IntValueMap(src map[string]*int) map[string]int

IntValueMap converts a string map of int pointers into a string map of int values.

func IntValueSlice

func IntValueSlice(src []*int) []int

IntValueSlice converts a slice of int pointers into a slice of int values.

func String

func String(v string) *string

String returns a pointer to the given string value.

func StringMap

func StringMap(src map[string]string) map[string]*string

StringMap converts a string map of string values into a string map of string pointers.

func StringSlice

func StringSlice(src []string) []*string

StringSlice converts a slice of string values into a slice of string pointers.

func StringSliceWithConverter

func StringSliceWithConverter(s []string, c func(string) string) []string

StringSliceWithConverter converts a list of string using the passed converter function

func StringToTime

func StringToTime(timeString string, format string) (time.Time, error)

StringToTime transforms given string to time.

func StringToTimestamp added in v0.1.2

func StringToTimestamp(timeString string, format string) int64

StringToTimestamp transforms given string to unix time int64. It will return -1 when time string parse error.

func StringValue

func StringValue(v *string) string

StringValue returns the value of the given string pointer or "" if the pointer is nil.

func StringValueMap

func StringValueMap(src map[string]*string) map[string]string

StringValueMap converts a string map of string pointers into a string map of string values.

func StringValueSlice

func StringValueSlice(src []*string) []string

StringValueSlice converts a slice of string pointers into a slice of string values.

func Time

func Time(v time.Time) *time.Time

Time returns a pointer to the given time.Time value.

func TimeMap

func TimeMap(src map[string]time.Time) map[string]*time.Time

TimeMap converts a string map of time.Time values into a string map of time.Time pointers.

func TimePointerToTimestamp added in v0.1.2

func TimePointerToTimestamp(t *time.Time) int64

TimePointerToTimestamp transforms given time pointer to unix time int64.

func TimeSlice

func TimeSlice(src []time.Time) []*time.Time

TimeSlice converts a slice of time.Time values into a slice of time.Time pointers.

func TimeToString

func TimeToString(timeValue time.Time, format string) string

TimeToString transforms given time to string.

func TimeToTimestamp

func TimeToTimestamp(t time.Time) int64

TimeToTimestamp transforms given time to unix time int.

func TimeValue

func TimeValue(v *time.Time) time.Time

TimeValue returns the value of the given time.Time pointer or time.Time{} if the pointer is nil.

func TimeValueMap

func TimeValueMap(src map[string]*time.Time) map[string]time.Time

TimeValueMap converts a string map of time.Time pointers into a string map of time.Time values.

func TimeValueSlice

func TimeValueSlice(src []*time.Time) []time.Time

TimeValueSlice converts a slice of time.Time pointers into a slice of time.Time values.

func TimestampToString added in v0.1.2

func TimestampToString(unix int64, format string) string

TimestampToString converts unix timestamp to formatted string.

func TimestampToTime

func TimestampToTime(unix int64) time.Time

TimestampToTime transforms given unix time int64 to time in UTC.

func TimestampToTimePointer added in v0.1.2

func TimestampToTimePointer(unix int64) *time.Time

TimestampToTimePointer transforms given unix time int64 to time pointer in UTC.

func Uint32

func Uint32(src uint32) *uint32

Uint32 return a uint32 pointer to the given uint32 value.

func Uint32Value

func Uint32Value(v *uint32) uint32

Uint32Value returns the value of the given uint32 pointer or 0 if the pointer is nil.

func Uint64

func Uint64(src uint64) *uint64

Uint64 return a uint64 pointer to the given uint64 value.

func Uint64Slice

func Uint64Slice(src []uint64) []*uint64

Uint64Slice converts a slice of uint64 values into a slice of uint64 pointers.

func Uint64Value

func Uint64Value(v *uint64) uint64

Uint64Value returns the value of the given uint64 pointer or 0 if the pointer is nil.

func Uint64ValueSlice

func Uint64ValueSlice(src []*uint64) []uint64

Uint64ValueSlice converts a slice of uint64 pointers into a slice of uint64 values.

func Uint8

func Uint8(src uint8) *uint8

Uint8 return a uint8 pointer to the given uint8 value.

func Uint8Value

func Uint8Value(v *uint8) uint8

Uint8Value returns the value of the given uint8 pointer or 0 if the pointer is nil.

Types

This section is empty.

Jump to

Keyboard shortcuts

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