Documentation ¶
Index ¶
- Constants
- Variables
- func AddPrefix(path string, prefix string) string
- func BytesToString(b []byte) string
- func CRC(s string) int
- func CheckPath(path string) string
- func Copy(dst, src interface{})
- func Exists(path string) bool
- func Init()
- func IsDir(path string) bool
- func PrintStack() []byte
- func StringToBytes(s string) (b []byte)
- func TrimSuffix(path string, suffix string) string
- type MyError
- type RequestLogger
- type Semaphore
Constants ¶
View Source
const ( PieceSize = 32 // byte ReadTimeOut = 985 )
View Source
const ( MIMEJSON = "application/json" MIMEHTML = "text/html" MIMEXML = "application/xml" MIMEXML2 = "text/xml" MIMEPlain = "text/plain" MIMEPOSTForm = "application/x-www-form-urlencoded" MIMEMultipartPOSTForm = "multipart/form-data" MIMEPROTOBUF = "application/x-protobuf" MIMEMSGPACK = "application/x-msgpack" MIMEMSGPACK2 = "application/msgpack" MIMEYAML = "application/x-yaml" MethodGet = "GET" MethodHead = "HEAD" MethodPost = "POST" MethodPut = "PUT" MethodPatch = "PATCH" // RFC 5789 MethodDelete = "DELETE" MethodConnect = "CONNECT" MethodOptions = "OPTIONS" MethodTrace = "TRACE" )
View Source
const IOCGetterErrorCode = 4
Variables ¶
View Source
var NoRecord = &MyError{code: 1, description: "record not exists"}
View Source
var TokenInvalid = &MyError{code: 2, description: "token invalid"}
Functions ¶
func BytesToString ¶
BytesToString converts byte slice to string without a memory allocation.
func CRC ¶
String hashes a string to a unique hashcode.
crc32 returns a uint32, but for our use we need and non negative integer. Here we cast to an integer and invert it if the result is negative.
func PrintStack ¶
func PrintStack() []byte
Stack returns a formatted stack trace of the goroutine that calls it. It calls runtime.Stack with a large enough buffer to capture the entire trace.
func StringToBytes ¶
StringToBytes converts string to byte slice without a memory allocation.
func TrimSuffix ¶
Types ¶
type RequestLogger ¶
type Semaphore ¶
type Semaphore struct {
// contains filtered or unexported fields
}
func NewSemaphore ¶
func (*Semaphore) AvailablePermits ¶
func (*Semaphore) TryAcquire ¶
Click to show internal directories.
Click to hide internal directories.