xlib

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var HttpNotJsonHandler = func(str string) string {
	if !gjson.Valid(str) {
		return gjson.MustEncodeString(g.Map{"resp": str})
	}
	return str
}

HttpNotJsonHandler 处理 http 返回的不是个 json

Functions

func HttpClient

func HttpClient(method, url string, data any, opt ...any) (gJson *gjson.Json, err error)

HttpClient 发起一个http请求

func IF

func IF(condition bool, a, b any) any

func InArr

func InArr[T any](a T, arr []T) bool

InArr 是否在数组中

func Maintain

func Maintain(handler func())

Maintain 维持函数

func SafeExit

func SafeExit()

SafeExit 安全触发退出

func SelectAllToStruct

func SelectAllToStruct[T any](all gdb.Result) []T

SelectAllToStruct 查询多条转换为结构体组

func SelectOneToStruct

func SelectOneToStruct[T any](one gdb.Record) *T

SelectOneToStruct 查询单条转换为结构体

func Sha256

func Sha256(text string) string

Sha256 获取数据的 sha256

Types

This section is empty.

Jump to

Keyboard shortcuts

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