json2go

package
v0.0.0-...-5c5f118 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultOptions = Json2Go{TypeName: "T"}

Functions

func Generate

func Generate(json string) (string, error)

Generate generates a Go type definition from a JSON string.

func GenerateCode

func GenerateCode(json string) (jen.Code, error)

GenerateCode generates a Go type definition from a JSON string as jen.Code.

func GenerateCodeFromBytes

func GenerateCodeFromBytes(json []byte) (jen.Code, error)

GenerateCodeFromBytes generates a Go type definition from a slice of JSON bytes as jen.Code.

func GenerateFromBytes

func GenerateFromBytes(json []byte) (string, error)

GenerateFromBytes generates a Go type definition from a slice of JSON bytes.

func RenderCode

func RenderCode(code jen.Code) (string, error)

RenderCode renders jen.Code.

Types

type Json2Go

type Json2Go struct {
	TypeName     string
	AllCapsWords []string
}

func NewJson2Go

func NewJson2Go(typeName string, allCapsWords ...string) *Json2Go

func (Json2Go) Generate

func (o Json2Go) Generate(json string) (string, error)

Generate generates a Go type definition from a JSON string.

func (Json2Go) GenerateCode

func (o Json2Go) GenerateCode(json string) (jen.Code, error)

GenerateCode generates a Go type definition from a JSON string as jen.Code.

func (Json2Go) GenerateCodeFromBytes

func (o Json2Go) GenerateCodeFromBytes(json []byte) (jen.Code, error)

GenerateCodeFromBytes generates a Go type definition from a slice of JSON bytes as jen.Code.

func (Json2Go) GenerateFromBytes

func (o Json2Go) GenerateFromBytes(json []byte) (string, error)

GenerateFromBytes generates a Go type definition from a slice of JSON bytes.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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