jenshared

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: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateTypes

func GenerateTypes(data interface{}, config *Config) string

GenerateTypes parses the provided JSON payload and returns the matching Go types.

func GenerateTypesFile

func GenerateTypesFile(data interface{}, config *Config) error

GenerateTypesFile parses the provided JSON payload and generates matching Go types file.

Types

type Config

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

Config presents configurations to CreateTypes

type TypeItem

type TypeItem struct {
	Name      string
	Type      string
	OmitEmpty bool
}

TypeItem represents a parsed JSON variable

func (TypeItem) TagJSON added in v0.3.0

func (t TypeItem) TagJSON() string

TagJSON prepares the tag for provided item

func (TypeItem) Tags added in v0.3.0

func (t TypeItem) Tags() map[string]string

Tags creates tha Tags map

func (TypeItem) Title

func (t TypeItem) Title() string

Title converts the JSON name to TitleCase

type TypeItems

type TypeItems []TypeItem

TypeItems is an array of TypeItem objects

type TypeItemsMap

type TypeItemsMap map[string]TypeItems

TypeItemsMap is a map of TypeItems arrays

Jump to

Keyboard shortcuts

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