lib

package
v4.4.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2022 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// HTTPStatusUnprocessableEntity Deprecated: use http.StatusUnprocessableEntity instead
	HTTPStatusUnprocessableEntity = 422

	// DatePatternYYYYMMDD
	// 2006 = Year with four digits
	//   01 = Month with two digits
	//   02 = Day with two digits
	DatePatternYYYYMMDD = "2006-01-02"

	// DatePatternYYYYMMDDHHMMSS
	// 2006 = Year with four digits
	//   01 = Month with two digits
	//   02 = Day with two digits
	//   15 = Hour with two digits (24h)
	//   04 = Minute with two digits
	//   05 = Seconds with two digits
	DatePatternYYYYMMDDHHMMSS = "2006-01-02 15:04:05"

	// DatePatternYYYYMMDDTHHMMSS
	// 2006 = Year with four digits
	//   01 = Month with two digits
	//   02 = Day with two digits
	//   15 = Hour with two digits (24h)
	//   04 = Minute with two digits
	//   05 = Seconds with two digits
	DatePatternYYYYMMDDTHHMMSS = "2006-01-02T15:04:05"

	DatePatternYYYYMMDDTHHMMSSZ = time.RFC3339 // NOTE: backward compatibility
)

Variables

View Source
var (
	RFC3339NanoWithoutTAndTimezone string = strings.ReplaceAll(
		strings.ReplaceAll(time.RFC3339Nano, `T`, ` `),
		`Z07:00`, ``)
)

Functions

func BeginningOfToday

func BeginningOfToday() time.Time

BeginningOfToday REQUIRE THEM TO DOCUMENT THIS FUNCTION

func BeginningOfTodayIn

func BeginningOfTodayIn(loc *time.Location) time.Time

BeginningOfTodayIn REQUIRE THEM TO DOCUMENT THIS FUNCTION

func CheckFloat64JSONData

func CheckFloat64JSONData(f float64) *float64

CheckFloat64JSONData REQUIRE THEM TO DOCUMENT THIS FUNCTION

func CheckInt64JSONData

func CheckInt64JSONData(i int64) *int64

CheckInt64JSONData REQUIRE THEM TO DOCUMENT THIS FUNCTION

func CheckStringJSONData

func CheckStringJSONData(s string) *string

CheckStringJSONData REQUIRE THEM TO DOCUMENT THIS FUNCTION

func DSN2MAP

func DSN2MAP(dsn string) map[string]string

DSN2MAP REQUIRE THEM TO DOCUMENT THIS FUNCTION

func DSN2Publishable

func DSN2Publishable(dsn string) string

DSN2Publishable REQUIRE THEM TO DOCUMENT THIS FUNCTION

func DiffDays

func DiffDays(date1 time.Time, date2 time.Time) (int64, error)

DiffDays REQUIRE THEM TO DOCUMENT THIS FUNCTION

func ErrorGroup

func ErrorGroup(ctx context.Context, args ...func() error) error

ErrorGroup resolves all go routines. It fails at first error encountered warning: Creating goroutines in the args will cause them to run in background

func Fill

func Fill(dest interface{}, src interface{})

Fill merges data from struct instance to another By @titpetric suggested in https://scene-si.org/2016/06/01/golang-tips-and-tricks

func GetByteArrayAndBufferFromRequestBody

func GetByteArrayAndBufferFromRequestBody(body io.ReadCloser) ([]byte, *bytes.Buffer, error)

GetByteArrayAndBufferFromRequestBody REQUIRE THEM TO DOCUMENT THIS FUNCTION

func GetOnlyNumbers

func GetOnlyNumbers(s *string) *string

GetOnlyNumbers REQUIRE THEM TO DOCUMENT THIS FUNCTION

func GetOnlyNumbersOrSpecial

func GetOnlyNumbersOrSpecial(s *string, sp string) *string

GetOnlyNumbersOrSpecial REQUIRE THEM TO DOCUMENT THIS FUNCTION

func GetStringBodyHTTPRequest

func GetStringBodyHTTPRequest(r *http.Request) *string

GetStringBodyHTTPRequest REQUIRE THEM TO DOCUMENT THIS FUNCTION

func GetStringBodyHTTPRequestJSON

func GetStringBodyHTTPRequestJSON(r *http.Request) *string

GetStringBodyHTTPRequestJSON REQUIRE THEM TO DOCUMENT THIS FUNCTION

func GetStringBodyHTTPResponse

func GetStringBodyHTTPResponse(r *http.Response) *string

GetStringBodyHTTPResponse REQUIRE THEM TO DOCUMENT THIS FUNCTION

func GetStringBodyHTTPResponseJSON

func GetStringBodyHTTPResponseJSON(r *http.Response) *string

GetStringBodyHTTPResponseJSON REQUIRE THEM TO DOCUMENT THIS FUNCTION

func IsArray

func IsArray(arg interface{}) bool

IsArray REQUIRE THEM TO DOCUMENT THIS FUNCTION

func IsPointer

func IsPointer(arg interface{}) bool

IsPointer REQUIRE THEM TO DOCUMENT THIS FUNCTION

func IsString

func IsString(arg interface{}) bool

IsString REQUIRE THEM TO DOCUMENT THIS FUNCTION

func Join

func Join(sep string, args ...interface{}) string

Join REQUIRE THEM TO DOCUMENT THIS FUNCTION

func ParseBoolToString

func ParseBoolToString(b bool) string

ParseBoolToString REQUIRE THEM TO DOCUMENT THIS FUNCTION

func ParseDateStringToTime

func ParseDateStringToTime(dateString string) (*time.Time, error)

ParseDateStringToTime REQUIRE THEM TO DOCUMENT THIS FUNCTION

func ParseDateYearMonthDay

func ParseDateYearMonthDay(dateString string) (time.Time, error)

ParseDateYearMonthDay REQUIRE THEM TO DOCUMENT THIS FUNCTION

func ParseIntOrReturnZero

func ParseIntOrReturnZero(s string) int

ParseIntOrReturnZero REQUIRE THEM TO DOCUMENT THIS FUNCTION

func ParseIntToBool

func ParseIntToBool(i int) bool

ParseIntToBool REQUIRE THEM TO DOCUMENT THIS FUNCTION

func ParseStringToBool

func ParseStringToBool(s string) bool

ParseStringToBool REQUIRE THEM TO DOCUMENT THIS FUNCTION

func ParseStringToFloat64

func ParseStringToFloat64(s string) (float64, error)

ParseStringToFloat64 parse the string to float64

func ParseStringToInt

func ParseStringToInt(s string) (int, error)

ParseStringToInt REQUIRE THEM TO DOCUMENT THIS FUNCTION

func ParseStringToInt64

func ParseStringToInt64(s string) (int64, error)

ParseStringToInt64 REQUIRE THEM TO DOCUMENT THIS FUNCTION

func RandomInt

func RandomInt(bottom, top int) int

RandomInt REQUIRE THEM TO DOCUMENT THIS FUNCTION

func RemoveNanoseconds

func RemoveNanoseconds(date time.Time) (time.Time, error)

RemoveNanoseconds REQUIRE THEM TO DOCUMENT THIS FUNCTION

func Round

func Round(value float64, precision int) float64

Round REQUIRE THEM TO DOCUMENT THIS FUNCTION

func StringToIntSlice

func StringToIntSlice(s string) []int

StringToIntSlice REQUIRE THEM TO DOCUMENT THIS FUNCTION

func StringToStringSlice

func StringToStringSlice(s string) []string

StringToStringSlice REQUIRE THEM TO DOCUMENT THIS FUNCTION

func ToInt64Slice

func ToInt64Slice(stringSlice []string) (int64Slice []int64)

ToInt64Slice REQUIRE THEM TO DOCUMENT THIS FUNCTION

func ToIntSlice

func ToIntSlice(stringSlice []string) (intSlice []int)

ToIntSlice REQUIRE THEM TO DOCUMENT THIS FUNCTION

func ToStringSlice

func ToStringSlice(intslice []int) (stringSlice []string)

ToStringSlice REQUIRE THEM TO DOCUMENT THIS FUNCTION

func ToStringSlice64

func ToStringSlice64(int64Slice []int64) (stringSlice []string)

ToStringSlice64 REQUIRE THEM TO DOCUMENT THIS FUNCTION

func Truncate

func Truncate(s string, i int) (r string)

Truncate REQUIRE THEM TO DOCUMENT THIS FUNCTION

func WithRetries

func WithRetries(ctx context.Context, retryFn func() error, options RetryOptions) error

Types

type RetryOptions

type RetryOptions struct {
	RetriesCount    int
	RetriesInterval time.Duration
}

type Stringer

type Stringer interface {
	String() string
}

Stringer REQUIRE THEM TO DOCUMENT THIS TYPE

Jump to

Keyboard shortcuts

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