Documentation ¶
Overview ¶
Package cl provides a compatible layer for golang versions
Index ¶
- func FormatComplex(c complex128, fmt byte, prec, bitSize int) string
- func GetUnexportedField(field reflect.Value) reflect.Value
- func ParseComplex(s string) (v complex128, err error)
- func SetUnexportedField(field, value reflect.Value)
- func SetUnexportedFieldIfMap(field, key, value reflect.Value)
- type Field
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatComplex ¶
func FormatComplex(c complex128, fmt byte, prec, bitSize int) string
FormatComplex converts the complex number c to a string of the form (a+bi) where a and b are the real and imaginary parts, formatted according to the format fmt and precision prec.
The format fmt and precision prec have the same meaning as in FormatFloat. It rounds the result assuming that the original was obtained from a complex value of bitSize bits, which must be 64 for complex64 and 128 for complex128.
func GetUnexportedField ¶
GetUnexportedField return the value of the unexported field.
func ParseComplex ¶
func ParseComplex(s string) (v complex128, err error)
ParseComplex converts a string to complex number. If the string is not valid complex format, return err not nil.
Examples:
c1 := cmdr.ParseComplex("3-4i") c2 := cmdr.ParseComplex("3.13+4.79i")
func SetUnexportedField ¶
SetUnexportedField puts a new value into the unexported field.
func SetUnexportedFieldIfMap ¶ added in v0.4.1
Types ¶
type Field ¶
type Field struct { Type reflect.StructField Value reflect.Value }
Field wraps a struct field with its type and value pair.
func (*Field) GetUnexportedField ¶
GetUnexportedField returns the value of the unexported field.
func (*Field) SetUnexportedField ¶
SetUnexportedField puts a new value into the unexported field.