togo

package module
Version: v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2021 License: MIT Imports: 11 Imported by: 0

README

togo

Convert

  • JSON
  • TOML
  • YAML

to Go

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SpecialCases = map[string]string{
	"ip":   "IP",
	"dob":  "DOB",
	"id":   "ID",
	"uuid": "UUID",
	"url":  "URL",
	"html": "HTML",
	"json": "JSON",
	"yaml": "YAML",
	"toml": "TOML",
}

Functions

This section is empty.

Types

type Field

type Field struct {
	Name    string
	Type    string
	Tag     string
	Comment string
}

type GoStruct

type GoStruct struct {
	Structs []Struct
	// contains filtered or unexported fields
}

func FromJSON

func FromJSON(name string, data []byte) (GoStruct, error)

func FromTOML

func FromTOML(name string, data []byte) (GoStruct, error)

func FromYAML

func FromYAML(name string, data []byte) (GoStruct, error)

func ToGo

func ToGo(name string, raw map[string]interface{}) GoStruct

func (GoStruct) DefaultTagOptions

func (g GoStruct) DefaultTagOptions() *TagOptions

func (GoStruct) Fprint

func (g GoStruct) Fprint(w io.Writer, opts *TagOptions) error

type Struct

type Struct struct {
	Name   string
	Fields []Field
}

type TagOptions

type TagOptions struct {
	JSON bool
	YAML bool
	TOML bool
}

func (TagOptions) Tags

func (p TagOptions) Tags() bool

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL