Documentation ¶
Overview ¶
Package define implements functions separate of project.
Index ¶
- Variables
- func Abs[T constraints.Integer](a T) T
- func BasicAuth(username, password string) string
- func ChangeFieldOfName(imodel interface{}, field_name string, value interface{}) error
- func Check(imodel interface{}, field_name string) (*reflect.Value, error)
- func Compare(a, b any) int
- func Contains[T comparable](s []T, e T) bool
- func CopyMap[T1, T2 comparable](Map map[T1]T2) map[T1]T2
- func CopyMapAny[T1, T2 comparable](Map map[T1]T2) map[string]any
- func ErrorsToStr(errs []error) string
- func GetDecodeFunc(format string) func(io.Reader) (image.Image, error)
- func GetEncodeFunc(format string) func(io.Writer, image.Image) error
- func GetImagesFromRequestBody(body []byte, key ...string) ([]image.Image, []string)
- func GetJSONResponse(method, curl string, headers Headers, data Data) (int, any, error)
- func GetResponse(method, curl string, headers Headers, data Data) (int, []byte, error)
- func GetTagField(model any, fieldName string, tagName ...string) string
- func GetToday() string
- func GoToStruct(value reflect.Value) (*reflect.Value, error)
- func Hash(data []byte) string
- func ImagesToBytes(images []image.Image, formats []string) [][]byte
- func IndexOf[T comparable](lst []T, x T) int
- func Insert[T constraints.Ordered](a []T, index int, value T) []T
- func Max[T constraints.Ordered](args ...T) T
- func Min[T constraints.Ordered](args ...T) T
- func Pop[T comparable](lst []T, index int) ([]T, T)
- func Pow[T constraints.Integer](a T, b T) float64
- func Sum[T constraints.Ordered](args ...T) T
- type Data
- type Headers
- type Set
Constants ¶
This section is empty.
Variables ¶
View Source
var Atoi = func(x string) int { xInt, _ := strconv.Atoi(x); return xInt }
Atoi convet string to int.
View Source
var Itoa = strconv.Itoa
Itoa convet int to string.
View Source
var Itob = func(v int) []byte { b := make([]byte, 8) binary.BigEndian.PutUint64(b, uint64(v)) return b }
Itob convet int to []byte.
View Source
var ParseFloat = func(x string) float64 { xFloat, _ := strconv.ParseFloat(x, 64); return xFloat }
Functions ¶
func Abs ¶
func Abs[T constraints.Integer](a T) T
func ChangeFieldOfName ¶
func Compare ¶ added in v0.13.0
Compare returns
-2 if a == nil || b == nil -1 if a < b 0 if a == b +1 if a > b
func CopyMap ¶
func CopyMap[T1, T2 comparable](Map map[T1]T2) map[T1]T2
func CopyMapAny ¶
func CopyMapAny[T1, T2 comparable](Map map[T1]T2) map[string]any
func GetJSONResponse ¶ added in v0.10.0
func GetResponse ¶ added in v0.10.0
func GetTagField ¶ added in v0.11.0
func IndexOf ¶
func IndexOf[T comparable](lst []T, x T) int
func Insert ¶
func Insert[T constraints.Ordered](a []T, index int, value T) []T
func Pop ¶
func Pop[T comparable](lst []T, index int) ([]T, T)
func Pow ¶
func Pow[T constraints.Integer](a T, b T) float64
func Sum ¶ added in v0.13.0
func Sum[T constraints.Ordered](args ...T) T
Sum return sum value in args.
Types ¶
type Set ¶
type Set[T constraints.Ordered] struct { // contains filtered or unexported fields }
Click to show internal directories.
Click to hide internal directories.