define

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package define implements functions separate of project.

Index

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 }
View Source
var ParseUint = func(x string) uint { xUint, _ := strconv.ParseUint(x, 10, 0); return uint(xUint) }

Functions

func Abs

func Abs[T constraints.Integer](a T) T

func ChangeFieldOfName

func ChangeFieldOfName(imodel interface{}, field_name string, value interface{}) error

func Check

func Check(imodel interface{}, field_name string) (*reflect.Value, error)

func Contains

func Contains[T comparable](s []T, e T) bool

Contains returns

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 Dict

func Dict(dict interface{}) fiber.Map

Dict convet interface{} to fiber.Map.

func ErrorsToStr

func ErrorsToStr(errs []error) string

ErrorToStr convert []error to string.

func GetDecodeFunc

func GetDecodeFunc(format string) func(io.Reader) (image.Image, error)

func GetEncodeFunc

func GetEncodeFunc(format string) func(io.Writer, image.Image) error

func GetImagesFromRequestBody

func GetImagesFromRequestBody(body []byte, key ...string) ([]image.Image, []string)

func GetToday

func GetToday() string

GetToday returns string today date.

func GoToStruct

func GoToStruct(value reflect.Value) (*reflect.Value, error)

func Hash

func Hash(data []byte) string

Hash returns hash data

func ImagesToBytes

func ImagesToBytes(images []image.Image, formats []string) [][]byte

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 Max

func Max[T constraints.Ordered](args ...T) T

Max return maximal value in args.

func Min

func Min[T constraints.Ordered](args ...T) T

Min return minimal value in args.

func Pop

func Pop[T comparable](lst []T, index int) ([]T, T)

func Pow

func Pow[T constraints.Integer](a T, b T) float64

Types

type Set

type Set[T constraints.Ordered] struct {
	// contains filtered or unexported fields
}

func (*Set[T]) Add

func (this *Set[T]) Add(x T)

func (*Set[T]) Adds

func (this *Set[T]) Adds(lst ...T)

func (*Set[T]) Count

func (this *Set[T]) Count() int

func (*Set[T]) Get

func (this *Set[T]) Get(index int) T

func (*Set[T]) GetItems

func (this *Set[T]) GetItems() []T

Jump to

Keyboard shortcuts

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