Document the other implemented marshallers.

This commit is contained in:
John Beisley 2013-10-09 21:39:55 +01:00
parent 0db75c9211
commit c9607c5123

View File

@ -9,6 +9,7 @@ import (
"unicode/utf8" "unicode/utf8"
) )
// MarshalFixed14_4 marshals float64 to SOAP "fixed.14.4" type.
func MarshalFixed14_4(v float64) (string, error) { func MarshalFixed14_4(v float64) (string, error) {
if v >= 1e14 || v <= -1e14 { if v >= 1e14 || v <= -1e14 {
return "", fmt.Errorf("soap fixed14.4: value %v out of bounds", v) return "", fmt.Errorf("soap fixed14.4: value %v out of bounds", v)
@ -16,6 +17,7 @@ func MarshalFixed14_4(v float64) (string, error) {
return strconv.FormatFloat(v, 'f', 4, 64), nil return strconv.FormatFloat(v, 'f', 4, 64), nil
} }
// UnmarshalFixed14_4 unmarshals float64 from SOAP "fixed.14.4" type.
func UnmarshalFixed14_4(s string) (float64, error) { func UnmarshalFixed14_4(s string) (float64, error) {
v, err := strconv.ParseFloat(s, 64) v, err := strconv.ParseFloat(s, 64)
if err != nil { if err != nil {
@ -27,6 +29,7 @@ func UnmarshalFixed14_4(s string) (float64, error) {
return v, nil return v, nil
} }
// MarshalChar marshals rune to SOAP "char" type.
func MarshalChar(v rune) (string, error) { func MarshalChar(v rune) (string, error) {
if v == 0 { if v == 0 {
return "", errors.New("soap char: rune 0 is not allowed") return "", errors.New("soap char: rune 0 is not allowed")
@ -34,6 +37,7 @@ func MarshalChar(v rune) (string, error) {
return string(v), nil return string(v), nil
} }
// UnmarshalChar unmarshals rune from SOAP "char" type.
func UnmarshalChar(s string) (rune, error) { func UnmarshalChar(s string) (rune, error) {
if len(s) == 0 { if len(s) == 0 {
return 0, errors.New("soap char: got empty string") return 0, errors.New("soap char: got empty string")