go2flow

command
v0.0.0-...-eac9f62 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2015 License: BSD-3-Clause Imports: 11 Imported by: 0

README

go2flow

Generates Javascript Flow types corresponding to Go's JSON types.

All code for Go type package.Type is written in package_Type.js.

The type itself is in a type alias, package_Type.T. We use type aliases because Go type may include int, float, string, or bool, which cannot be represented by Javascript classes or compound types.

We make an empty() function, which returns a zero value for type T.

We make a marshal(t) function, which returns an object that can then be used with JSON.stringify(). Making marshal(t) independent of toJSON allows custom behavior to be attached to primitive types.

We make an unmarshal(data) function which, when passed an object from JSON.parse(), returns an instance of T or raises an UnmarshalException.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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