value

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EmptyMode

type EmptyMode int

EmptyMode 值为空时的Encode模式

const (
	EmptyDefault EmptyMode = iota // 默认:bar=baz&foo=
	EmptyIgnore                   // 忽略:bar=baz
	EmptyOnlyKey                  // 仅保留Key:bar=baz&foo
)

type Option

type Option func(o *options)

Option V Encode 选项

func WithEmptyMode

func WithEmptyMode(mode EmptyMode) Option

WithEmptyMode 设置值为空时的Encode模式

func WithIgnoreKeys

func WithIgnoreKeys(keys ...string) Option

WithIgnoreKeys 设置Encode时忽略的key

func WithKVEscape

func WithKVEscape() Option

WithKVEscape 设置K-V是否需要QueryEscape

type V

type V map[string]string

V 用于处理 k-v 需要格式化的场景,如:签名

func (V) Del

func (v V) Del(key string)

Del 删除Key

func (V) Encode

func (v V) Encode(sym, sep string, opts ...Option) string

Encode 通过自定义的符号和分隔符按照key的ASCII码升序格式化为字符串。 例如:("=", "&") ---> bar=baz&foo=quux; 例如:(":", "#") ---> bar:baz#foo:quux;

func (V) Get

func (v V) Get(key string) string

Get 获取值

func (V) Has

func (v V) Has(key string) bool

Has 判断Key是否存在

func (V) Set

func (v V) Set(key, value string)

Set 设置 k-v

Jump to

Keyboard shortcuts

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