utils

package
v0.0.0-...-0efcd2a Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: AGPL-3.0 Imports: 19 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrImageDataTooShort = errors.New("image data is too short")
)

Functions

func B2S

func B2S(b []byte) string

B2S converts byte slice to a string without memory allocation.

func Bool2Int

func Bool2Int(v bool) int

func CompressData

func CompressData(input []byte) ([]byte, error)

func DecompressData

func DecompressData(compressed []byte) ([]byte, error)

func DisableLogOutput

func DisableLogOutput()

func EnableLogOutput

func EnableLogOutput()

func GetLogger

func GetLogger(prefix string) *logrus.Entry

func MustParseHexStr

func MustParseHexStr(s string) []byte

func ReadLine

func ReadLine(s string) string

func S2B

func S2B(s string) (b []byte)

S2B converts string to a byte slice without memory allocation.

Note it may break if string and/or slice header will change in the future go versions.

func SignProvider

func SignProvider(rawUrl string) func(string, uint32, []byte) map[string]string

func TimeStamp

func TimeStamp() int64

Types

type ColoredFormatter

type ColoredFormatter struct{}

func (*ColoredFormatter) Format

func (f *ColoredFormatter) Format(entry *logrus.Entry) ([]byte, error)

type ImageFormat

type ImageFormat uint32
const (
	Unknown ImageFormat = 0000
	Jpeg    ImageFormat = 1000
	Png     ImageFormat = 1001
	Gif     ImageFormat = 2000
	Webp    ImageFormat = 1002
	Bmp     ImageFormat = 1005
	Tiff    ImageFormat = 1006
)

func ImageResolve

func ImageResolve(image []byte) (format ImageFormat, size imgsz.Size, err error)

func (ImageFormat) String

func (format ImageFormat) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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