gen

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultOutputFile string = "types.go"

DefaultOutputFile is the name of the default output file

View Source
const DefaultPackage string = "main"

DefaultPackage is the name of the default package

View Source
const DefaultRootName string = "Root"

DefaultRootName is the default name of the top-level JSON object

View Source
const DefaultTimeFormat string = "RFC3339"

DefaultTimeFormat is the default time format to parse with.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Debugger       *log.Logger
	URL            string
	File           string
	RootName       string
	PackageName    string
	OutputFileName string
	TimeFormat     string
	OmitEmpty      bool
	Alphabetical   bool
}

Config presents Gen configurations.

type Gen

type Gen struct {
	// contains filtered or unexported fields
}

Gen presents a generate tool for json2go.

func New

func New() *Gen

New creates a new Gen.

func (*Gen) Build

func (g *Gen) Build(config *Config) (string, error)

Build builds the type structs Go payload.

func (*Gen) Generate

func (g *Gen) Generate(config *Config) error

Generate builds the type structs Go file.

func (*Gen) ReadBytes

func (g *Gen) ReadBytes(r io.Reader) *Gen

ReadBytes allows for the explicit setting of raw bytes via io.Reader

func (*Gen) SetBytes

func (g *Gen) SetBytes(bytes []byte) *Gen

SetBytes allows for the explicit setting of raw bytes prior to parsing for JSON

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL