Convert your Go structs to other languages, including TypeScript / Flow, Elm and Rust among others!
type User struct {
ID int `json:"id"`
Friends []Friend `json:"friends"`
}
type Friend struct {
FirstName string `json:"firstname"`
LastName string `json:"lastname"`
}
in TypeScript becomes...
export interface User {
friends: Friend[],
id: number,
}
export interface Friend {
firstname: string,
lastname: string,
}
First get go-bridge
go get github.com/oeb25/go-bridge
Then import and use it in your code
import (
"fmt"
"github.com/oeb25/go-bridge/targets"
)
func main() {
result, _ := targets.TypeScript{}.Format(MyStruct{})
fmt.Println(result)
}
- TypeScript / Flow
- Elm (partial)
- Rust (partial)
- C (very much work in progress)