net

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DelayDo

func DelayDo(d time.Duration, fn func())

func IsDigits

func IsDigits(s string) bool

func PPrint

func PPrint(obj interface{})

PPrint 格式化打印任意对象

func PreprocessInput

func PreprocessInput(input string) string

func PtrBool

func PtrBool(b bool) *bool

func PtrBytes

func PtrBytes(b []byte) *[]byte

func PtrFloat32

func PtrFloat32(f float32) *float32

func PtrFloat64

func PtrFloat64(f float64) *float64

func PtrInt

func PtrInt(i int) *int

func PtrInt8

func PtrInt8(i int8) *int8

func PtrInt16

func PtrInt16(i int16) *int16

func PtrInt32

func PtrInt32(i int32) *int32

func PtrInt64

func PtrInt64(i int64) *int64

func PtrString

func PtrString(s string) *string

Ptr helpers for common DB types

func PtrTime

func PtrTime(t time.Time) *time.Time

func PtrUUID

func PtrUUID(id uuid.UUID) *uuid.UUID

func PtrUint

func PtrUint(u uint) *uint

func PtrUint8

func PtrUint8(u uint8) *uint8

func PtrUint16

func PtrUint16(u uint16) *uint16

func PtrUint32

func PtrUint32(u uint32) *uint32

func PtrUint64

func PtrUint64(u uint64) *uint64

func RetryWork

func RetryWork(work func() error, retryTimes int)

RetryWork 执行工作函数,捕获panic或error并最多重试retryTimes次 work: 需要执行的工作函数 retryTimes: 最大重试次数(不包括首次执行)

func ReturnCSVResponse

func ReturnCSVResponse(w http.ResponseWriter, filename string, headers []string, rows [][]string)

ReturnCSVResponse 返回 CSV 格式的响应

func ReturnErrorResponse

func ReturnErrorResponse(w http.ResponseWriter, code int, errorMsg string)

func ReturnJsonResponse

func ReturnJsonResponse(w http.ResponseWriter, code int, payload interface{})

ReturnJsonResponse is a helper function to send JSON responses

Types

type UniversalResponse

type UniversalResponse struct {
	Data      interface{} `json:"data"`
	Error     string      `json:"error"`
	IsSuccess bool        `json:"isSuccess"`
}

Jump to

Keyboard shortcuts

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