mirror of
https://github.com/jefferyjob/go-easy-utils.git
synced 2025-10-05 06:56:50 +08:00
30 lines
347 B
Go
30 lines
347 B
Go
package mapx
|
|
|
|
import "fmt"
|
|
|
|
func ExampleKeyExists() {
|
|
m := map[string]string{
|
|
"foo": "bar",
|
|
"baz": "123",
|
|
}
|
|
res := KeyExists(m, "foo")
|
|
|
|
fmt.Println(res)
|
|
|
|
// Output:
|
|
// true
|
|
}
|
|
|
|
func ExampleValueExists() {
|
|
m := map[string]string{
|
|
"foo": "bar",
|
|
"baz": "123",
|
|
}
|
|
res := ValueExists(m, "123")
|
|
|
|
fmt.Println(res)
|
|
|
|
// Output:
|
|
// true
|
|
}
|