0.0.1 • Published 5 years ago
fx416 v0.0.1
go-const-gen
JSON to Go constants.
Installation
yarn add go-const-gen
Example
import gen from 'go-const-gen';
(async () => {
const result = await gen(
{
hello: '1',
world: '2',
intProp: 123,
doubleProp: 12.3,
},
{ packageName: 'test', typeName: 'Test' },
'basic',
);
console.log(result);
})();
It prints:
******************************************************************************************
* This code was automatically generated by go-const-gen.
* Do not edit this file manually, your changes will be overwritten.
******************************************************************************************/
package test
// Test ...
type Test struct {
DoubleProp float64 `json:"doubleProp"`
Hello string `json:"hello"`
IntProp int `json:"intProp"`
World string `json:"world"`
}
0.0.1
5 years ago