cl

package
v1.1.10 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package cl provides a compatible layer for golang versions

Index

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

func GetUnexportedField(field reflect.Value) reflect.Value

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

func SetUnexportedField(field, value reflect.Value)

SetUnexportedField puts a new value into the unexported field.

func SetUnexportedFieldIfMap added in v0.4.1

func SetUnexportedFieldIfMap(field, key, value reflect.Value)

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

func (field *Field) GetUnexportedField() typ.Any

GetUnexportedField returns the value of the unexported field.

func (*Field) SetUnexportedField

func (field *Field) SetUnexportedField(value typ.Any)

SetUnexportedField puts a new value into the unexported field.

Jump to

Keyboard shortcuts

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