vertabelo2gorm

package module
v0.0.0-...-83c1380 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2018 License: MIT Imports: 9 Imported by: 0

README

vertabelo2gorm

Generates GORM models using Vertabelo diagram

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Column

type Column struct {
	// FIXME add other nodes
	ID          string `xml:"Id,attr"`
	Name        string `xml:"Name"`
	Type        string `xml:"Type"`
	Description string `xml:"Description"`
	Nullable    string `xml:"Nullable"`
}

type DatabaseModel

type DatabaseModel struct {
	Tables     []Table     `xml:"Tables>Table"`
	References []Reference `xml:"References>Reference"`
}

func Parse

func Parse(input []byte) (model *DatabaseModel, error error)

type Field

type Field struct {
	Name       string
	Type       string
	Annotation string
}

type GormDatabase

type GormDatabase struct {
	Package string
	Imports []string
	Models  []*Model
}

FIXME add other nodess Annotation string

func (*GormDatabase) Emit

func (g *GormDatabase) Emit(w io.Writer) error

type Model

type Model struct {
	Name    string
	SQLName string
	Fields  []*Field
}

type PrimaryKey

type PrimaryKey struct {
	Name     string   `xml:"Name"`
	ColumnID []string `xml:"Columns>Column"`
}

type Processor

type Processor struct {
	Package    string
	TypeMapper TypeMapper
}

func NewProcessor

func NewProcessor() *Processor

func (*Processor) Process

func (p *Processor) Process(in io.Reader, out io.Writer) error

type Reference

type Reference struct {
	// FIXME add other nodes
	Name             string            `xml:"Name"`
	Type             string            `xml:"Type"`
	Description      string            `xml:"Description"`
	PKTable          string            `xml:"PKTable"`
	FKTable          string            `xml:"FKTable"`
	ReferenceColumns []ReferenceColumn `xml:"ReferenceColumns>ReferenceColumn"`
}

type ReferenceColumn

type ReferenceColumn struct {
	PKColumn string `xml:"PKColumn"`
	FKColumn string `xml:"FKColumn"`
}

type Table

type Table struct {
	ID         string     `xml:"Id,attr"`
	Name       string     `xml:"Name"`
	Columns    []Column   `xml:"Columns>Column"`
	PrimaryKey PrimaryKey `xml:"PrimaryKey"`
}

type TypeMapper

type TypeMapper interface {
	GoType(sqlType string, nullable bool) (out string)
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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