utils

package
v1.19.0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ViperJson *viper.Viper
View Source
var ViperYaml *viper.Viper

Functions

func CalculateStartDate

func CalculateStartDate(then time.Time, monday bool, tuesday bool, wednesday bool, thursday bool, friday bool, saturday bool, sunday bool) (time.Time, bool)

func CheckJsonData

func CheckJsonData(jsondata map[string]interface{}, mapGenerateID ...[]string) map[string]interface{}

func ContainInSlice

func ContainInSlice(slice []string, val string) bool

func ConvertOperators

func ConvertOperators(data interface{}) interface{}

ConvertOperators is to convert Query Operators

func ConvertStringToInt

func ConvertStringToInt(input string) int

func ConvertToSlice

func ConvertToSlice(s string) []string

convertToSlice is to convert string to array

func FetchTime

func FetchTime(input string) (hr string, min string)

fetch input time 30m0s , 1h30m0s

func FindNextDate

func FindNextDate(then time.Time, monday bool, tuesday bool, wednesday bool, thursday bool, friday bool, saturday bool, sunday bool) time.Time

func FormatDateStartGen

func FormatDateStartGen(input string) string

/input 2022-07-01T08:44:18.127Z / 01/07/2022

func FormatDateStartNotT

func FormatDateStartNotT(input string) string

/input 2022-07-26 16:39:48.5215856 +0700 +07 / 01/07/2022

func FormatDateTimeTH

func FormatDateTimeTH(raw string) string

23 สิงหาคม 2564 18:27:50

func FormatSortDate

func FormatSortDate(intput string) time.Time

input 26/08/2022 13:30

func GenerateID

func GenerateID(prefix string) string

GenerateID function is for Generate Document id

func GenerateUUID

func GenerateUUID() string

func GetDataFromReflectValue

func GetDataFromReflectValue(value reflect.Value, dataType string) interface{}

func GetDateFromString

func GetDateFromString(intput string) (year int, month int, day int, hour int, min int)

input formate 2022-03-17 08:00

func GetEnv

func GetEnv(key string) string

func GetEnvBool

func GetEnvBool(key string) bool

func GetMonthNameTH

func GetMonthNameTH(month int) string

func GetStructField

func GetStructField(v *interface{}, field string) reflect.Value

func GetUrl

func GetUrl(ipAddress string, apiGroup string, apiEndpoint string) string

func GetViperJson

func GetViperJson() *viper.Viper

func GetYaml

func GetYaml(key string) string

func GetYamlBool

func GetYamlBool(key string) bool

func GetYamlDuration

func GetYamlDuration(key string) time.Duration

func GetYamlInt

func GetYamlInt(key string) int

func MapMinuteHour

func MapMinuteHour(input string) (string, string)

0 = 0.00 15 = 0.25 30 = 0.50 45 = 0.75 60 = 1

func MapMonth

func MapMonth(monthStr string) string

input : string month

func MapOperators

func MapOperators(str string) string

MapOperators for set Query Operators

func NewBoolean

func NewBoolean(state bool) *bool

func ParseFloat64ToInt64

func ParseFloat64ToInt64(input float64) int64

func RandomCode

func RandomCode(length int) string

func ReverseFormatDate

func ReverseFormatDate(input string) string

func SetViperJson

func SetViperJson(v *viper.Viper)

func SetViperYaml

func SetViperYaml(v *viper.Viper)

func SpilitCodeForLastIndex

func SpilitCodeForLastIndex(input string) string

rr-2305-001 input

func SpilitDate

func SpilitDate(input string) (year string, month string, day string)

01/07/2022 input format1 2022-08-20T08:44:18.127Z input format2

func SpilitOnlyYMD

func SpilitOnlyYMD(input string) (day string, month string, year string)

01-02-2006 15:04:05 input

func SpilitTime

func SpilitTime(input string) (hour string, min string)

formate 08:00

func StringWithCharset

func StringWithCharset(length int, charset string) string

func ToString

func ToString(input interface{}) string

Types

type StrSlice

type StrSlice struct {
	Str []string
}

Jump to

Keyboard shortcuts

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