generator

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2017 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

View Source
const (
	Name        = "2gobytes"
	Version     = "0.4.2"
	URL         = "http://github.com/paulvollmer/2gobytes"
	GeneratedBy = "// File generated by " + Name + " v" + Version + " (" + URL + ")"
)

Variables

This section is empty.

Functions

func FilepathToStructName

func FilepathToStructName(fPath string) string

split down to the filename, remove extension and change first char to Uppercase http://play.golang.org/p/ic5dxOKdcU

Types

type Generator

type Generator struct {
	PackageName     string
	Data            []Var
	Index           bool
	IndexName       string
	GeneratePackage bool
	GenerateInfo    bool
}

func NewGenerator

func NewGenerator() *Generator

func (*Generator) AddData

func (g *Generator) AddData(name string, data []byte)

func (*Generator) AddFile

func (g *Generator) AddFile(fPath, varName string) error

func (*Generator) GenerateCode

func (g *Generator) GenerateCode() []byte

type Var

type Var struct {
	File string
	Name string
	Data []byte
}

func NewVar

func NewVar() *Var

func (*Var) GenerateCode

func (v *Var) GenerateCode() string

func (*Var) SetData

func (v *Var) SetData(name string, data []byte)

func (*Var) SetDataFromFile

func (v *Var) SetDataFromFile(fPath string) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳