crude

package module
v0.0.0-...-ab26f43 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2021 License: MIT Imports: 8 Imported by: 0

README

crude

Usage

See example.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	FuncMap = template.FuncMap{
		"join":      join,
		"repeat":    repeat,
		"toString":  toString,
		"toStrings": toStrings,
		"wrap":      wrap,
		"zip":       zip,
	}
)

Functions

This section is empty.

Types

type Converter

type Converter func(string) string

type Entity

type Entity struct {
	// Required
	Name         string
	Table        string
	Receiver     string
	InsertFields []string
	FieldColumns map[string]string

	// Optional
	Custom interface{}

	// Computed
	Fields       []string          `toml:"-"`
	ColumnFields map[string]string `toml:"-"`
	Columns      []string          `toml:"-"`
}

func (*Entity) ToColumns

func (e *Entity) ToColumns(fields []string) []string

func (*Entity) ToFields

func (e *Entity) ToFields(columns []string) []string

type Generator

type Generator struct {
	Entities map[string]*Entity
	Template *template.Template
}

func (*Generator) Run

func (g *Generator) Run(writer io.Writer) error

type Parser

type Parser struct {
	Input             io.Reader
	FileName          string
	ReceiverConverter Converter
	TableConverter    Converter
	ColumnConverter   Converter
}

func (*Parser) Run

func (p *Parser) Run() (map[string]Entity, error)

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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