json2struct

command module
v0.0.0-...-48218c4 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2021 License: MPL-2.0 Imports: 9 Imported by: 0

README

json2struct

Generates go type struct from json struct

Installation

go get -insecure gurpscc.ddns.net/git/hellcat/json2struct

You need -insecure flag because of problems on our git server. Will be fixed after switching domain.

It will download and install json2struct to %gopath%\bin

Usage

Usage: json2struct [options] <input file>

Options:

flag type description defaults
-c string Select json struct to save as a comment for something comment
-h int Set json data height. Currently WIP. 2
-o string Set output path current dir
-p string Set package name for generated file main

Accessing data

Json2struct generates functions that returns types with default values.

All functions has the same structure:

func GetYourTypeNameHereDefaults() *yourType {
 // ...
 // some basic stuff here
 // ...
 return yourTypeVariable
}

So to get data you need just to call this func and save return.

Why do I need it?

I don't know, but in my opinion:

  • easier to acess default values
  • save types in json format
  • save some time

License

MPL 2.0

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