akshaybharambe14 / godmt

Tool that can parse Go files into an abstract syntax tree and translate it to several programming languages.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GoDMT

Build Go Report Card PkgGoDev Maintainability codecov License

GoDMT, the one and only Go Data Model Translator. The goal of this project is to provide a tool that can parse Go files that include var, const, map, struct and type into an abstract syntax tree, aka AST.

That AST will then be transformed into data models for several programming languages. Currently GoDMT can perform translations to:

  • TypeScript
  • Swift (using Decodable structs)
  • JSON
  • PHP

Some small adjustments may need to be made to integrate the output into a project, but this should already save you a lot of time and hassle, and will help you stay in sync with the Go version of your data models, in other languages. Comments will be carried over 😉.

Currently, the supported operating systems are all of UNIX family:

  • Linux
  • BSD
  • macOS

Talk is cheap, show code

Feel free to browse some examples that I am happy to provide here:

Usage

See the CLI Usage wiki page for more details on using the tool.

See the Tags and Name Conversion section to understand more about how entities get parsed and converted to other languages.

Building

To build this application as a binary simply navigate to cmd/godmt and run go build.

About

Tool that can parse Go files into an abstract syntax tree and translate it to several programming languages.

License:MIT License


Languages

Language:Go 99.5%Language:Shell 0.5%