utils

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddQueryParamLink(URL string, queryParam map[string]string) (string, error)

AddQueryParamLink will add queryParam from given link. It still return original URL if any err occurred.

func Concat

func Concat(str ...string) string

Concat is faster way to concatenate between strings.

func DecodeBase64

func DecodeBase64(s string) string

DecodeBase64 do decoding base64 w/o return err

func DecodeURL

func DecodeURL(s string) string

DecodeURL do query unescape to url w/o return err

func EncodeBase64

func EncodeBase64(b []byte) string

EncodeBase64 do encoding base64

func EncodeURL

func EncodeURL(s string) string

EncodeURL do query escape to url

func FormatInt

func FormatInt(i int) string

FormatInt will format from int to string.

Alternatively can use strconv.Itoa(i)

func FormatInt64

func FormatInt64(i int64) string

FormatInt64 will format from int64 to string.

Alternatively can use strconv.FormatInt(i, 10)

func FormatSliceInt

func FormatSliceInt(arr []int) []string

FormatSliceInt will format from slice int to slice string.

func FormatSliceInt64

func FormatSliceInt64(arr []int64) []string

FormatSliceInt64 will format from slice int64 to slice string.

func GetFileFromPaths

func GetFileFromPaths(filePaths []string) ([]byte, error)

GetFileFromPaths will find file from given paths. It will return error if not found.

func GetLocalIP

func GetLocalIP() string

GetLocalIP returns the non loopback local IP of the host. Will return empty if not found / err.

func HighestInt

func HighestInt(arr ...int) int

HighestInt will return highest int from slice of int.

func InSliceInt64

func InSliceInt64(target int64, arr []int64) bool

InSliceInt64 check if the target(int64) exist inside given slice(int64).

func InSliceString

func InSliceString(target string, arr []string) bool

InSliceString check if the target(string) exist inside given slice(string).

func LowestInt

func LowestInt(arr ...int) int

LowestInt will return lowest int from slice of int.

func Marshal

func Marshal(intf interface{}) ([]byte, error)

Marshal marshal given interface.

func Max

func Max(a, b int64) int64

Max will return the maximum number from given number in int64.

func Min

func Min(a, b int64) int64

Min will return the maximum number from given number in int64.

func NewDecoder

func NewDecoder(body io.ReadCloser, intf interface{}) (err error)

NewDecoder decode given interface.

func ParseInt

func ParseInt(s string) int

ParseInt will parse from string to int w/o return err.

func ParseInt64

func ParseInt64(s string) int64

ParseInt64 will parse from string to int64 w/o return err.

func ParseSliceInt

func ParseSliceInt(arr []string) []int

ParseSliceInt will parse from slice string to slice int.

func ParseSliceInt64

func ParseSliceInt64(arr []string) []int64

ParseSliceInt64 will parse from slice string to slice int64.

func Rand

func Rand(min, max int) int

Rand will random value from min-max inclusively.

func RandPermLimit

func RandPermLimit(min, max int) []int

RandPermLimit give perm of random value from min-max.

func RemoveBracers

func RemoveBracers(s string) string

RemoveBracers will remove "{" and "}".

func RemoveBrackets

func RemoveBrackets(s string) string

RemoveBrackets will remove "[" and "]".

func RemoveParentheses

func RemoveParentheses(s string) string

RemoveParentheses will remove "(" and ")".

func RemoveSpaces

func RemoveSpaces(s string) string

RemoveSpaces will remove " ".

func SplitByCombineBy

func SplitByCombineBy(s, splitBy, combineBy string) string

SplitByCombineBy provides splitting then combining from given string.

func Unmarshal

func Unmarshal(data []byte, intf interface{}) (err error)

Unmarshal unmarshals given interface.

Types

This section is empty.

Jump to

Keyboard shortcuts

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