cmap

package
v1.30.36 Latest Latest
Warning

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

Go to latest
Published: May 16, 2022 License: MIT Imports: 8 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 NewCMap added in v1.9.4

func NewCMap() CMap

func StructToCMap added in v1.20.2

func StructToCMap(v interface{}) (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 added in v1.9.10

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

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

func (CMap) BSON added in v1.10.0

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 added in v1.20.8

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

Drop to remove string if it contains value

func (CMap) Encode added in v1.20.2

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 added in v1.9.10

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

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

func (CMap) Obtain added in v1.9.10

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

Obtain get all values associated with the given key.

func (CMap) Pop added in v1.9.4

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 interface{}) 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