utils

package
v0.0.0-...-176f8cf Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ImageMdpi    = 160             // 160dpi
	ImageHdpi    = 1.5 * ImageMdpi // 240dpi
	ImageXhdpi   = 2 * ImageMdpi   // 320dpi
	ImageXxhdpi  = 3 * ImageMdpi   // 480dpi
	ImageXxxhdpi = 4 * ImageMdpi   // 640dpi
)

Variables

This section is empty.

Functions

func CreateDate

func CreateDate(year, month, day, hour, min int) time.Time

func CreateThumbnails

func CreateThumbnails(srcImage image.Image, size_xy int, forDpi []int32) (map[int32][]byte, error)

Creates picture thumbnails for every supported dpi. Thumbnails size are (size_xy, size_xy)*scale_factor. Thumbnails are returned as byte slide JPEG encoded.

func GenParams

func GenParams(size int) string

func GenValues

func GenValues(values []int64) []interface{}

func GetCurrentTimeMillis

func GetCurrentTimeMillis() int64

func GetCurrentTimeUTC

func GetCurrentTimeUTC() time.Time

Get current time in millis

func HashPasswordWithSalt

func HashPasswordWithSalt(password string, salt [32]byte) [32]byte

func IsValidEmail

func IsValidEmail(email string) bool

func MaxDuration

func MaxDuration(a, b time.Duration) time.Duration

func MaxInt

func MaxInt(a, b int) int

func MaxInt64

func MaxInt64(a, b int64) int64

func MaxTime

func MaxTime(a, b time.Time) time.Time

func MillisToTimeUTC

func MillisToTimeUTC(timestamp int64) time.Time

func MinDuration

func MinDuration(a, b time.Duration) time.Duration

func MinInt

func MinInt(a, b int) int

func MinInt64

func MinInt64(a, b int64) int64

func MinUint

func MinUint(a, b uint) uint

func NewRandomSalt32

func NewRandomSalt32() [32]byte

func RandUint16

func RandUint16() (uint16, error)

func ResizeImage

func ResizeImage(picture image.Image, width int) ([]byte, error)

func TimeToMillis

func TimeToMillis(t time.Time) int64

Return time as millis

Types

type LinkedHashMap

type LinkedHashMap struct {
	list.List
	// contains filtered or unexported fields
}

func NewLinkedHashMap

func NewLinkedHashMap() *LinkedHashMap

func (*LinkedHashMap) KeyForItem

func (l *LinkedHashMap) KeyForItem(item *list.Element) string

func (*LinkedHashMap) PushBackWithCollapseKey

func (l *LinkedHashMap) PushBackWithCollapseKey(key string, value interface{}) *list.Element

func (*LinkedHashMap) PushFrontWithCollapseKey

func (l *LinkedHashMap) PushFrontWithCollapseKey(key string, value interface{}) *list.Element

func (*LinkedHashMap) Remove

func (l *LinkedHashMap) Remove(e *list.Element) interface{}

func (*LinkedHashMap) RemoveCollapseKey

func (l *LinkedHashMap) RemoveCollapseKey(key string) bool

func (*LinkedHashMap) RemoveItemWithCollapseKey

func (l *LinkedHashMap) RemoveItemWithCollapseKey(key string) interface{}

type QueryValues

type QueryValues struct {
	Params []interface{}
}

func (*QueryValues) AddArrayInt32

func (self *QueryValues) AddArrayInt32(array []int32)

func (*QueryValues) AddArrayInt64

func (self *QueryValues) AddArrayInt64(array []int64)

func (*QueryValues) AddValue

func (self *QueryValues) AddValue(val interface{})

type Queue

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

func NewQueue

func NewQueue() *Queue

func (*Queue) Add

func (q *Queue) Add(item interface{})

func (*Queue) AddWithKey

func (q *Queue) AddWithKey(key string, item interface{})

func (*Queue) Element

func (q *Queue) Element() interface{}

func (*Queue) Remove

func (q *Queue) Remove() interface{}

Jump to

Keyboard shortcuts

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