Help us shape the future of Go! Take the 2026 Go Developer Survey

mapext

package module
v0.0.0-...-89f8031 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2017 License: GPL-2.0 Imports: 3 Imported by: 0

README

mapext

目的与作用

在开发 RESTful 服务的时候,需要将 request 中的 JSON 先转换成 map[string]interface{} 后,再从中找到指定的值,同时还需要判断值的类型。

mapext 可以从 map 中搜索到指定的 key,并根据要求的数据类型返回其值。

完成

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBoolValue

func GetBoolValue(m map[string]interface{}, k string) (bool, error)

GetBoolValue - Search the map for k, and return its value as bool. The value in JSON can be - bool values: true, True, TRUE, false, False, FALSE - int values: 0, 1 - string values: "true", "True", "TRUE", fa"lse, "False", "FALSE", "0", "1"

func GetFloat32Value

func GetFloat32Value(m map[string]interface{}, k string) (float32, error)

GetFloat32Value - Search the map for k, and return its value as float32.

func GetFloat64Value

func GetFloat64Value(m map[string]interface{}, k string) (float64, error)

GetFloat64Value - Search the map for k, and return its value as float64.

func GetInt8Value

func GetInt8Value(m map[string]interface{}, k string) (int8, error)

GetInt8Value - Search the map for k, and return its value as int8.

func GetInt16Value

func GetInt16Value(m map[string]interface{}, k string) (int16, error)

GetInt16Value - Search the map for k, and return its value as int16.

func GetInt32Value

func GetInt32Value(m map[string]interface{}, k string) (int32, error)

GetInt32Value - Search the map for k, and return its value as int32.

func GetInt64Value

func GetInt64Value(m map[string]interface{}, k string) (int64, error)

GetInt64Value - Search the map for k, and return its value as int64.

func GetIntValue

func GetIntValue(m map[string]interface{}, k string) (int, error)

GetIntValue - Search the map for k, and return its value as int.

func GetStringValue

func GetStringValue(m map[string]interface{}, k string) (string, error)

func GetUint8Value

func GetUint8Value(m map[string]interface{}, k string) (uint8, error)

func GetUint16Value

func GetUint16Value(m map[string]interface{}, k string) (uint16, error)

func GetUint32Value

func GetUint32Value(m map[string]interface{}, k string) (uint32, error)

func GetUint64Value

func GetUint64Value(m map[string]interface{}, k string) (uint64, error)

func GetUintValue

func GetUintValue(m map[string]interface{}, k string) (uint, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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