util

package
v0.0.0-...-f2f1574 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

README

Util

框架工具

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLogger

func GetLogger() *zap.Logger

func GetSugar

func GetSugar() *zap.SugaredLogger

Types

type FastHttp

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

func NewClient

func NewClient(readTimeout, writeTimeout, maxIdleConnDuration, timeout time.Duration) *FastHttp

func (*FastHttp) SendGetRequest

func (f *FastHttp) SendGetRequest(uri string) ([]byte, error)

SendGetRequest send a get request return []byte, error

func (*FastHttp) SendPostRequest

func (f *FastHttp) SendPostRequest(reqBody interface{}, uri string, contentType string) ([]byte, error)

type IpInfo

type IpInfo struct {
	LocalIp  string
	RemoteIp string
}

func GetIp

func GetIp(ctx context.Context) (ipInfo IpInfo)

GetIp return a IpInfo from content.Content

type List

type List struct {
	HeadNode *Node `json:"head_node"`
}

func NewList

func NewList() *List

func (*List) AddHeader

func (l *List) AddHeader(data interface{})

func (*List) AddTail

func (l *List) AddTail(data interface{})

func (*List) IsEmpty

func (l *List) IsEmpty() bool

func (*List) Length

func (l *List) Length() int64

type Node

type Node struct {
	Pre  *Node       `json:"pre"`
	Next *Node       `json:"next"`
	Data interface{} `json:"data"`
}

type RedSync

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

func NewRedSync

func NewRedSync(client *redis.Client, mutexName string) *RedSync

NewRedSync return a *RedSync

func (*RedSync) Lock

func (r *RedSync) Lock(ctx context.Context) (bool, error)

Lock return a bool, error

func (*RedSync) UnLock

func (r *RedSync) UnLock(ctx context.Context) (bool, error)

UnLock return a bool,error

Jump to

Keyboard shortcuts

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