util

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 17, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	HttpProtocol  = []byte("http://")
	HttpsProtocol = []byte("https://")
)

Functions

func AppendPaddingUint added in v0.0.2

func AppendPaddingUint(dst []byte, n, p int, c byte) []byte

AppendPaddingUint appends n with c padding that size of p to dst and returns the extended dst.

func AppendQueryString

func AppendQueryString(dst, qstr []byte) []byte

AppendQueryString appends qstr to dst.

func AppendSpacePaddingUint added in v0.0.2

func AppendSpacePaddingUint(dst []byte, n, p int) []byte

AppendSpacePaddingUint appends n with space padding that size of p to dst and returns the extended dst.

func AppendZeroPaddingUint

func AppendZeroPaddingUint(dst []byte, n, p int) []byte

AppendZeroPaddingUint appends n with zero padding that size of p to dst and returns the extended dst.

func IsHttpOrHttps

func IsHttpOrHttps(uri []byte) bool

func IsHttpStatusRedirect

func IsHttpStatusRedirect(status int) bool

func SplitRequestURI

func SplitRequestURI(uri []byte) ([]byte, []byte)

SplitRequestURI splits path and query string.

Types

type Cache

type Cache interface {
	Get(key string) interface{}
	Set(key string, value interface{})
}

Cache is an interface that defines accessor of the cache.

func NewExpireCache

func NewExpireCache(expire int64) Cache

NewExpireCache returns a new cache with the specified expire (ms) and default interval 1 min.

func NewExpireCacheInterval

func NewExpireCacheInterval(expire, interval int64) Cache

NewExpireCacheInterval returns a new cache with the specified expire (ms) and interval (ms).

type Strftime added in v0.0.2

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

Strftime is a strftime formatter.

func NewStrftime added in v0.0.2

func NewStrftime(format string) *Strftime

NewStrftime creates a new Strftime.

func NewStrftimeBytes added in v0.0.2

func NewStrftimeBytes(format []byte) *Strftime

NewStrftimeBytes creates a new Strftime.

func (*Strftime) AppendBytes added in v0.0.2

func (s *Strftime) AppendBytes(dst []byte, t time.Time) []byte

AppendBytes appends format result to dst and returns the extended buffer.

func (*Strftime) Format added in v0.0.2

func (s *Strftime) Format(t time.Time) string

Format formats the specified time.

func (*Strftime) FormatBytes added in v0.0.2

func (s *Strftime) FormatBytes(t time.Time) []byte

FormatBytes formats the specified time.

Jump to

Keyboard shortcuts

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