Source File
jsonvalue.go
Belonging Package
github.com/aws/aws-sdk-go/private/protocol
package protocol
import (
)
type EscapeMode uint
const (
NoEscape EscapeMode = iota
Base64Escape
QuotedEscape
)
func ( aws.JSONValue, EscapeMode) (string, error) {
, := json.Marshal()
if != nil {
return "",
}
switch {
case NoEscape:
return string(), nil
case Base64Escape:
return base64.StdEncoding.EncodeToString(), nil
case QuotedEscape:
return strconv.Quote(string()), nil
}
panic(fmt.Sprintf("EncodeJSONValue called with unknown EscapeMode, %v", ))
}
func ( string, EscapeMode) (aws.JSONValue, error) {
var []byte
var error
switch {
case NoEscape:
= []byte()
case Base64Escape:
, = base64.StdEncoding.DecodeString()
case QuotedEscape:
var string
, = strconv.Unquote()
= []byte()
default:
panic(fmt.Sprintf("DecodeJSONValue called with unknown EscapeMode, %v", ))
}
if != nil {
return nil,
}
:= aws.JSONValue{}
= json.Unmarshal(, &)
if != nil {
return nil,
}
return , nil
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |