config

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2020 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunReverse

func RunReverse(source *ReverseSource, target *ReverseTarget) error

func SaveSettings

func SaveSettings(file string) error

Types

type AppConfig

type AppConfig struct {
	Debug       bool `json:"debug" yaml:"debug"`
	PluralTable bool `json:"plural_table" yaml:"plural_table"`
}

type ConnConfig

type ConnConfig struct {
	DriverName  string `json:"driver_name" yaml:"driver_name"`
	TablePrefix string `json:"table_prefix" yaml:"table_prefix"`
	ReadOnly    string `json:"read_only" yaml:"read_only"`
	Params      dialect.ConnParams
}

type ReverseConfig

type ReverseConfig struct {
	Kind    string          `yaml:"kind"`
	Name    string          `yaml:"name"`
	Source  ReverseSource   `yaml:"source"`
	Targets []ReverseTarget `yaml:"targets"`
}

ReverseConfig represents a reverse configuration

type ReverseSource

type ReverseSource struct {
	Database string `yaml:"database"`
	ConnStr  string `yaml:"conn_str"`
}

ReverseSource represents a reverse source which should be a database connection

type ReverseTarget

type ReverseTarget struct {
	Type          string   `yaml:"type"`
	IncludeTables []string `yaml:"include_tables"`
	ExcludeTables []string `yaml:"exclude_tables"`
	TableMapper   string   `yaml:"table_mapper"`
	ColumnMapper  string   `yaml:"column_mapper"`
	TemplatePath  string   `yaml:"template_path"`
	Template      string   `yaml:"template"`
	MultipleFiles bool     `yaml:"multiple_files"`
	OutputDir     string   `yaml:"output_dir"`
	TablePrefix   string   `yaml:"table_prefix"`
	Language      string   `yaml:"language"`

	Funcs     map[string]string `yaml:"funcs"`
	Formatter string            `yaml:"formatter"`
	Importter string            `yaml:"importter"`
	ExtName   string            `yaml:"ext_name"`
}

ReverseTarget represents a reverse target

type ServConfig

type ServConfig struct {
	Protocol string `json:"protocol" yaml:"protocol"`
	Params   dialect.ConnParams
}

type Settings

type Settings struct {
	IsEmpty        bool                  `json:"-" yaml:"-"`
	Application    AppConfig             `json:"application" yaml:"application"`
	Connections    map[string]ConnConfig `json:"connections" yaml:"connections"`
	MicroServices  []ServConfig          `json:"micro_services" yaml:"micro_services"`
	ReverseTargets []ReverseTarget       `json:"reverse_targets" yaml:"reverse_targets"`
}

func GetSettings

func GetSettings() *Settings

func ReadSettings

func ReadSettings(file string) (*Settings, error)

func (Settings) GetSource

func (cfg Settings) GetSource(name string) (ReverseSource, ConnConfig)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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