param

package
v1.0.0-beta8 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2021 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package param provide some util for param parse

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Base64DecodeString

func Base64DecodeString(s string) ([]byte, error)

Base64DecodeString decode base64 with avx2 see https://github.com/segmentio/asm/issues/50 avoid incorrect unsafe usage in origin library

func EnsureBool

func EnsureBool(p interface{}, defaultVal bool) bool

EnsureBool 判断给定的p是否可表示为合法Bool类型,否则返回defaultVal

支持的合法类型有

type bool

type gjson.True or gjson.False

type string "true","yes","1" or "false","no","0" (case insensitive)

func SetAtDefault

func SetAtDefault(variable, value, defaultValue interface{})

SetAtDefault 在变量 variable 为默认值 defaultValue 的时候修改为 value

func SetExcludeDefault

func SetExcludeDefault(variable, value, defaultValue interface{})

SetExcludeDefault 在目标值 value 不为默认值 defaultValue 时修改 variable 为 value

func SplitURL

func SplitURL(s string) []string

SplitURL 将给定URL字符串分割为两部分,用于URL预处理防止风控

Types

This section is empty.

Jump to

Keyboard shortcuts

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