util

package
v0.1.26 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const MaxHeaderBytes = 8192
View Source
const MaxReadHeaderTimeout = time.Second * 30
View Source
const MaxReadTimeout = time.Second * 120

Variables

View Source
var TimestampFormat = "2006-01-02 15:04:05"

Functions

func ContainsArray added in v0.1.6

func ContainsArray(str string, targetStr ...string) bool

func ContainsInArray added in v0.1.1

func ContainsInArray(strArray []string, targetStr string) bool

func FormatTime

func FormatTime(tm *time.Time) string

func GetGroupId

func GetGroupId(re *http.Request) string

func GetGroupIds

func GetGroupIds(re *http.Request) []string

func GetLiveTime

func GetLiveTime(re *http.Request) int

func GetMessage

func GetMessage(re *http.Request) string

func GetSize

func GetSize(re *http.Request) int

func GetStart

func GetStart(re *http.Request) int

func GetUsername

func GetUsername(re *http.Request) string

func Go added in v0.1.14

func Go(handle func())

func HttpCross

func HttpCross(w http.ResponseWriter)

func HttpCrossChunked

func HttpCrossChunked(w http.ResponseWriter)

func Millisecond

func Millisecond() uint32

func NewPtr

func NewPtr(v interface{}) interface{}

func NewWaitNumGroup added in v0.1.10

func NewWaitNumGroup() *waitNumGroup

func RecoverGo added in v0.1.13

func RecoverGo(handle func())

Types

type HttpServer

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

func NewServer

func NewServer() *HttpServer

func (*HttpServer) AddRoute

func (hs *HttpServer) AddRoute(pattern string, handler func(http.ResponseWriter, *http.Request))

func (*HttpServer) IsTls

func (hs *HttpServer) IsTls() bool

func (*HttpServer) Start

func (hs *HttpServer) Start(port int) error

func (*HttpServer) StartAutoTLS

func (hs *HttpServer) StartAutoTLS(port int, certFile, keyFile string) error

func (*HttpServer) StartTLS

func (hs *HttpServer) StartTLS(port int, certFile, keyFile string) error

type Queue

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

func NewQueue

func NewQueue() *Queue

func (*Queue) Dequeue

func (queue *Queue) Dequeue(ctx context.Context) (value interface{}, num int32, cols bool)

func (*Queue) Num

func (queue *Queue) Num() int32

func (*Queue) Offer

func (queue *Queue) Offer(value interface{}) (num int32)

func (*Queue) Peek

func (queue *Queue) Peek() (value interface{}, num int32)

func (*Queue) Poll

func (queue *Queue) Poll() (value interface{}, num int32)

func (*Queue) Take

func (queue *Queue) Take(duration time.Duration) (value interface{}, num int32)

type Request

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

func NewRequest

func NewRequest() *Request

func (*Request) Call

func (r *Request) Call(link string, jsonData []byte) ([]byte, error)

func (*Request) CallBreak added in v0.1.3

func (r *Request) CallBreak(link string, jsonData []byte) ([]byte, error)

func (*Request) Get

func (r *Request) Get(link string) ([]byte, error)

func (*Request) JustCall

func (r *Request) JustCall(link string, jsonData []byte) error

type RetryTransport

type RetryTransport struct {
	Transport http.RoundTripper
	Retries   int
}

func (*RetryTransport) RoundTrip

func (r *RetryTransport) RoundTrip(req *http.Request) (*http.Response, error)

type VQueue

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

func NewVQueue

func NewVQueue() *VQueue

func (*VQueue) Dequeue

func (queue *VQueue) Dequeue(ctx context.Context) (value interface{}, num int32, hasClose bool)

func (*VQueue) Num

func (queue *VQueue) Num() int32

func (*VQueue) Offer

func (queue *VQueue) Offer(value interface{}) (nu int32)

func (*VQueue) Poll

func (queue *VQueue) Poll() (value interface{}, nu int32)

func (*VQueue) Take

func (queue *VQueue) Take(duration time.Duration) (value interface{}, num int32)

Jump to

Keyboard shortcuts

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