cmap

package
v1.2.10-beta11 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CMap

type CMap map[string][]string

func Add

func Add(key, value string) CMap

func NewCMap

func NewCMap() CMap

func Set

func Set(key, value string) CMap

func StructToCMap

func StructToCMap(v any) (values CMap)

StructToCMap struct to CMap, maybe use Encode

func (CMap) Add

func (v CMap) Add(key, value string) CMap

Add adds the value to key. It appends to any existing values associated with key.

func (CMap) Append

func (v CMap) Append(key, value string) CMap

Append set the key to value if it doesn't exist. append if it exists.

func (CMap) BSON

func (v CMap) BSON() (bm bson.M)

BSON url.Values to mongo bson CMap

func (CMap) Del

func (v CMap) Del(key string) CMap

Del deletes the values associated with key.

func (CMap) Drop

func (v CMap) Drop(key, value string) CMap

Drop to remove string if it contains value

func (CMap) Encode

func (v CMap) Encode() string

Encode encodes the values into “URL encoded” form ("bar=baz&foo=quux") sorted by key.

func (CMap) Get

func (v CMap) Get(key string) string

Get gets the first value associated with the given key. If there are no values associated with the key, Get returns the empty string. To access multiple values, use the map directly.

func (CMap) Insert

func (v CMap) Insert(key, value string) CMap

Insert set the key to value if it doesn't exist. insert if it exists.

func (CMap) Obtain

func (v CMap) Obtain(key string) []string

Obtain get all values associated with the given key.

func (CMap) Pop

func (v CMap) Pop(key string) string

Pop return Get value and Del key

func (CMap) Set

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

Set sets the key to value. It replaces any existing values.

func (CMap) Struct

func (v CMap) Struct(value any) error

Struct CMap to struct data value like

type Te struct {
		Name string `json:"name"` // must string type
		ID   string `json:"id"` // must string type
	}

Jump to

Keyboard shortcuts

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