utils

package
v0.0.0-...-07365c2 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2021 License: Apache-2.0 Imports: 6 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoolPointer

func BoolPointer(val bool) *bool

BoolPointer returns bool pointer.

func ContainsString

func ContainsString(value string, values []string) bool

ContainsString checks whether the `values` string slice contains `value`.

func DurationPointer

func DurationPointer(d time.Duration) *time.Duration

DurationPointer returns time.Duration pointer.

func Float64Pointer

func Float64Pointer(num float64) *float64

Float64Pointer returns float64 pointer.

func FormCompositeKey

func FormCompositeKey(objectType string, attributes ...string) string

FormCompositeKey provides composite key for specified `objectType` by combining the given `attributes`.

func Hash

func Hash(value string) string

Hash calculates hash-sum for the given `value` by encrypting it with FNV-1A algorithm.

func Int64Pointer

func Int64Pointer(num int64) *int64

Int64Pointer returns int64 pointer.

func IntPointer

func IntPointer(num int) *int

IntPointer returns int pointer.

func MustEncode

func MustEncode(v interface{}) string

MustEncode tries to serialize object without error, otherwise it panics.

func Prettify

func Prettify(obj interface{}) string

Prettify returns a JSON-like properly indented string representation of objects. delimited with space.

func SplitCompositeKey

func SplitCompositeKey(compositeKey string) (string, []string)

SplitCompositeKey retrieves object type and attributes from `compositeKey`.

func StringPointer

func StringPointer(str string) *string

StringPointer returns string pointer.

func Uint64Pointer

func Uint64Pointer(num uint64) *uint64

Uint64Pointer returns uint64 pointer.

Types

This section is empty.

Jump to

Keyboard shortcuts

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