kv

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(ctx context.Context, kvs ...any) context.Context

Add add kvs to ctx. Add multi times, the last added kvs is at the first place when Get.

往 ctx 上附加 kv 键值对. 多次添加再 Get, 后添加的会出现在前面.

func Get

func Get(ctx context.Context) []any

Get get kvs of this ctx.

获取 ctx 上附加的键值对.

func Set added in v0.0.2

func Set(ctx context.Context, kvs []any) context.Context

Set set kvs to ctx and ignore the previous added.

在 ctx 上设置键值对, 如果之前已经 Add 过会忽略.

func Uniq added in v0.0.2

func Uniq(kvs []any) []any

Uniq filter the duplicate key of kvs. if a key apperance more than once, only the first value will retain.

过滤 kvs 中重复的 key. 保留第一次出现的 key-value

[key1, first, key1, second] => [key1, first]

Types

This section is empty.

Jump to

Keyboard shortcuts

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