generator

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2019 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BigQ

func BigQ(s string) string

func Generate

func Generate(ctx context.Context, settings Settings, parser Parser) <-chan error

func GeneratePackageMembers

func GeneratePackageMembers(settings Settings, info TableInfo, dbToPath DBToPathType) (string, error)

func GenerateSchema

func GenerateSchema(schema string) (string, error)

func GenerateTable

func GenerateTable(settings Settings, info TableInfo, dbToPath DBToPathType) (string, error)

func LittleQ

func LittleQ(s string) string

func Render

func Render(jenFile *File) (string, error)

func ToExported

func ToExported(s string) string

func ToNonExported

func ToNonExported(s string) string

func ToPackageName

func ToPackageName(s string) string

func ToTableStruct

func ToTableStruct(tableName string) string

Types

type Column

type Column interface {
	Name() string
	Table() string
	Type() *sql.ColumnType
}

type DBToPathType

type DBToPathType map[string][2]string

DBToPathType is a map of database data/column type names to an array of [import package path, path type]

type ForeignKey

type ForeignKey interface {
	Name() string
}

type Parser

type Parser interface {
	Tables(ctx context.Context, schema string) (<-chan string, <-chan error)
	Columns(ctx context.Context, schema, table string) (<-chan Column, <-chan error)
	ForeignKeys(ctx context.Context, schema, table string) (<-chan ForeignKey, <-chan error)
	DBTypesToPaths() map[string][2]string
}

type Settings

type Settings interface {
	RootDirectory() string
	Schemas() []string
	ReplaceFieldName(name string) string
	OverrideDBTypesToPaths() map[string][2]string
}

type TableInfo

type TableInfo interface {
	Name() string
	Schema() string
	Columns() []Column
	ForeignKeys() []ForeignKey
}

Jump to

Keyboard shortcuts

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