aidego

package module
v4.3.3 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2023 License: Apache-2.0 Imports: 18 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"

	// DatePatternYYYYMMDDTHHMMSS
	// ISO 8601 format with timezone offset
	// 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
	//   07 = Timezone offset hours with two digits
	//   00 = Timezone offset minutes with two digits
	DatePatternYYYYMMDDTHHMMSSOffset = "2006-01-02T15:04:05-07:00"

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

Variables

This section is empty.

Functions

func BeginningOfToday

func BeginningOfToday() time.Time

BeginningOfToday

func BeginningOfTodayIn

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

BeginningOfTodayIn

func CheckFloat64JSONData

func CheckFloat64JSONData(f float64) *float64

func CheckInt64JSONData

func CheckInt64JSONData(i int64) *int64

func CheckStringJSONData

func CheckStringJSONData(s string) *string

func DSN2MAP

func DSN2MAP(dsn string) map[string]string

func DSN2Publishable

func DSN2Publishable(dsn string) string

func DiffDays

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

DiffDays

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

func GetOnlyNumbers

func GetOnlyNumbers(s *string) *string

GetOnlyNumbers

func GetOnlyNumbersOrSpecial

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

GetOnlyNumbersOrSpecial

func GetStringBodyHTTPRequest

func GetStringBodyHTTPRequest(r *http.Request) *string

GetStringBodyHTTPRequest

func GetStringBodyHTTPRequestJSON

func GetStringBodyHTTPRequestJSON(r *http.Request) *string

GetStringBodyHTTPRequestJSON

func GetStringBodyHTTPResponse

func GetStringBodyHTTPResponse(r *http.Response) *string

GetStringBodyHTTPResponse

func GetStringBodyHTTPResponseJSON

func GetStringBodyHTTPResponseJSON(r *http.Response) *string

GetStringBodyHTTPResponseJSON

func IsArray

func IsArray(arg interface{}) bool

func IsPointer

func IsPointer(arg interface{}) bool

func IsString

func IsString(arg interface{}) bool

func Join

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

func ParseBoolToString

func ParseBoolToString(b bool) string

func ParseDateStringToTime

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

ParseDateStringToTime

func ParseDateStringToTimeIn added in v4.2.0

func ParseDateStringToTimeIn(dateString string, loc *time.Location) (*time.Time, error)

ParseDateStringToTimeIn parses a date string into time type in a specific location

func ParseDateYearMonthDay

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

ParseDateYearMonthDay

func ParseIntOrReturnZero

func ParseIntOrReturnZero(s string) int

func ParseIntToBool

func ParseIntToBool(i int) bool

func ParseStringToBool

func ParseStringToBool(s string) bool

func ParseStringToFloat64

func ParseStringToFloat64(s string) (float64, error)

ParseStringToFloat64 parse the string to float64

func ParseStringToInt

func ParseStringToInt(s string) (int, error)

func ParseStringToInt64

func ParseStringToInt64(s string) (int64, error)

func RandomInt

func RandomInt(bottom, top int) int

func RemoveNanoseconds

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

RemoveNanoseconds

func Round

func Round(value float64, precision int) float64

func StringToIntSlice

func StringToIntSlice(s string) []int

func StringToStringSlice

func StringToStringSlice(s string) []string

func ThisBytesContains

func ThisBytesContains(b []byte, s string) bool

func ToInt64Slice

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

func ToIntSlice

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

func ToStringSlice

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

func ToStringSlice64

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

func Truncate

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

Types

type Copier added in v4.3.0

type Copier struct {
	// contains filtered or unexported fields
}

func NewCopier added in v4.3.0

func NewCopier() (*Copier, error)

func (*Copier) Copy added in v4.3.0

func (copier *Copier) Copy(source, destination interface{}) error

type Stringer

type Stringer interface {
	String() string
}

Jump to

Keyboard shortcuts

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