reflectjs

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2021 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BigInt js.Value = js.Global().Get("BigInt")
	Map    js.Value = js.Global().Get("Map")
	Set    js.Value = js.Global().Get("Set")
)

Functions

func ToJs

func ToJs(v interface{}) js.Value

Transform a Go value into a JavaScript value.

For the type: js.Value, js.Wrapper, js.Func, nil, bool, string, int, int8, int16, int32, uint, uint8, uint16, uint32, float32, float64 it's like js.ValueOf function.

| Go                     | JavaScript             |
| ---------------------- | ---------------------- |
| int64                  | BigInt                 |
| uint64                 | BigInt                 |
| []byte                 | Uint8array             |
| time.Time              | Date                   |
| map[...]bool           | Set                    |
| map[...]...            | Map                    |
| struct{...}            | Object                 |
| []... (slice or array) | Array                  |

Other type like function or channel panics.

Struct field support tag:

struct{
	Int int `js:"int"`
}

Types

This section is empty.

Jump to

Keyboard shortcuts

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