Skip to content

Convert your Go structs to other languages, including TypeScript / Flow, Elm and Rust among others!

License

Notifications You must be signed in to change notification settings

oeb25/go-bridge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-bridge

GoDoc Build Status

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,
}

Usage

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)
}

Officially supported targets

  • TypeScript / Flow
  • Elm (partial)
  • Rust (partial)
  • C (very much work in progress)

About

Convert your Go structs to other languages, including TypeScript / Flow, Elm and Rust among others!

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages