database

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnectorGenerator

type ConnectorGenerator struct {
	*base.Generator
	Config *config.Config
	Models []*ModelGenerator
	Data   *ConnectorGeneratorData
}

ConnectorGenerator manages generation of the database connector

func NewConnectorGenerator

func NewConnectorGenerator(cfg *config.Config, models []*ModelGenerator) *ConnectorGenerator

NewConnectorGenerator creates and returns a ConnectorGenerator

func (*ConnectorGenerator) Execute

func (g *ConnectorGenerator) Execute() error

Execute configures and generates the database connector

type ConnectorGeneratorData

type ConnectorGeneratorData struct {
	Package string
	Models  []map[string]string
	Repo    string
}

ConnectorGeneratorData stores the data for the database connector template

type Field

type Field struct {
	Name   string
	Camel  string
	Type   string
	Json   string
	Bson   string
	Tags   string
	Fields []*Field
}

Field holds the data from the YAML field

type FieldGenerator

type FieldGenerator struct {
	Definition *Field
	// contains filtered or unexported fields
}

FieldGenerator is the generator of model fields

func (*FieldGenerator) Execute

func (f *FieldGenerator) Execute(s *bytes.Buffer) error

Execute generates the field using the template

func (*FieldGenerator) Prepare

func (f *FieldGenerator) Prepare() error

Prepare configures the data for the template

type Generator

type Generator struct {
	Config *config.Config
	Models []*ModelGenerator
}

Generator manages the generation of all database related files

func (*Generator) Execute

func (g *Generator) Execute() error

Execute configures and generates all of the database related files

type Model

type Model struct {
	Package string
	Camel   string
	Name    string
	Type    string
	Imports []string
	Fields  []*Field
}

Model holds the data from the YAML model

type ModelGenerator

type ModelGenerator struct {
	*base.Generator
	Config     *config.Config
	Name       string
	Path       string
	Definition *Model
	// contains filtered or unexported fields
}

ModelGenerator is the database model generator

func NewModelGenerator

func NewModelGenerator(cfg *config.Config, name, path string) (*ModelGenerator, error)

NewModelGenerator creates and returns an instance of ModelGenerator

func (*ModelGenerator) Execute

func (m *ModelGenerator) Execute() error

Execute generates the model file from the template

Jump to

Keyboard shortcuts

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