utils

package
v0.0.0-...-a82ac39 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AtArrayPosition

func AtArrayPosition(val interface{}, array interface{}) (index int)

AtArrayPosition finds the position(int) of val in an Array(Slice)

func CreateFileIfNotExist

func CreateFileIfNotExist(filePath string) error

CreateFileIfNotExist creates a file (absoulte path) returns error when failed

func GetDatetimeEnd

func GetDatetimeEnd(datetime time.Time) time.Time

GetDatetimeStart returns the latest time of datetime ex: 2022-01-01 23:59:59

func GetDatetimeStart

func GetDatetimeStart(datetime time.Time) time.Time

GetDatetimeStart returns the earliest time of datetime ex: 2022-01-01 00:00:00

func InArray

func InArray(val interface{}, array interface{}) bool

InArray checks is val exists in an Array(Slice)

func ParseStrToDate

func ParseStrToDate(input string, format string) (time.Time, error)

ParseStrToDate converts string to time.Time with specific format

func RemoveEmptyString

func RemoveEmptyString(s []string) []string

RemoveEmptyString removes empty string from string slice

func ToDate

func ToDate(datetime time.Time) time.Time

ToDate converts datetime to date format, which sets hour, min, sec to zero

func WriteToTempFile

func WriteToTempFile(content string, tempFilePattern string) (string, error)

WriteToTempFile writes given content to a tmpFile and returns the filename

Types

This section is empty.

Jump to

Keyboard shortcuts

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