f2go

package module
v0.0.0-...-8dcf319 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

README

f2go converter

Converts any file to Golang variable file.

Build Status Go Report Card GoDoc Coverage Status

License Apache 2.0

Using

f2go --help

NAME:
   f2go - converts any file to golang

USAGE:
   main [global options] command [command options] source_file [destination file]

VERSION:
   0.1.0

COMMANDS:
     help, h  Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --bytes           convert to the bytes array (default: false)
   --template value  (default: "data.go")
   --package value   Custom name of the package
   --varname value   Custom name of the variable
   -f                Save result to the file (default: false)
   --help, -h        show help (default: false)
   --version, -v     print the version (default: false)
f2go swagger.json > 'swagger.json.go'

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func VariableNamePrepare

func VariableNamePrepare(name string) string

VariableNamePrepare from some string

Types

type Converter

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

Converter wrapper

func NewConverter

func NewConverter(r io.Reader, w io.Writer, enc Encoder) *Converter

NewConverter object

func (*Converter) Render

func (c *Converter) Render(template string, ctx *RenderContext) error

Render template object

type Encoder

type Encoder int

Encoder of data tupe

const (
	ByteEncoder Encoder = iota
	StringEncoder
)

Type of encoders

type RenderContext

type RenderContext struct {
	Filename    string
	Filepath    string
	PackageName string
	DataName    string
}

RenderContext data

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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