config

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GoEntityRepositorySpecRepoInterfacesPlaceUnspecified    = ""
	GoEntityRepositorySpecRepoInterfacesPlaceWithEntity     = "with_entity"
	GoEntityRepositorySpecRepoInterfacesPlaceWithRepository = "with_repository"
	GoEntityRepositorySpecRepoInterfacesPlaceEntity         = "entity"
)
View Source
const (
	DefaultDatabaseSchema = "public"
)

Variables

Functions

This section is empty.

Types

type Activity

type Activity struct {
	Export ExportActivity // fill export or import
	Import ImportActivity

	Database string         `yaml:"database" json:"database"`
	Tables   ActivityTables `yaml:"tables" json:"tables"`
}

func (*Activity) IsExport

func (s *Activity) IsExport() bool

func (*Activity) UnmarshalYAML

func (s *Activity) UnmarshalYAML(n *yaml.Node) error

type ActivityTables

type ActivityTables struct {
	List        stringOrStringSlice `yaml:"list" json:"list"`
	ListFromEnv string              `yaml:"from_env" json:"from_env"`
	Prefix      string              `yaml:"prefix" json:"prefix"`
}

type CSVExportSpec

type CSVExportSpec struct {
	Delimiter string                           `yaml:"delimiter"`
	Transform map[string][]ExportSpecTransform `yaml:"transform"`
}

type Commit

type Commit struct {
	Message string `yaml:"message"`
	Author  string `yaml:"author"`
	Push    bool   `yaml:"push"`
}

func (*Commit) Valid

func (c *Commit) Valid() bool

type Config

type Config struct {
	Databases map[string]Database `yaml:"databases"`
	Tasks     map[string]Task     `yaml:"tasks"`
	Options   struct {
		WithMigrationsTable bool `yaml:"with_migrations_table"`
		PrintStat           bool `yaml:"print_stat"`
		Debug               bool `yaml:"debug"`
	} `yaml:"options"`
}

func (*Config) GetDefaultDatabaseName

func (c *Config) GetDefaultDatabaseName() (string, bool)

type Database

type Database struct {
	Driver DatabaseDriver `yaml:"driver"`
	DSN    string         `yaml:"dsn"`
	Schema string         `yaml:"schema"`
}

type DatabaseDriver

type DatabaseDriver string
const (
	DatabaseDriverPostgres DatabaseDriver = "postgres"
	DatabaseDriverDBML     DatabaseDriver = "dbml"
	DatabaseDriverMySQL    DatabaseDriver = "mysql"
)

func (DatabaseDriver) CanMigrate added in v0.4.0

func (d DatabaseDriver) CanMigrate() bool

func (DatabaseDriver) CanRead added in v0.4.0

func (d DatabaseDriver) CanRead() bool

func (DatabaseDriver) CanWrite added in v0.4.0

func (d DatabaseDriver) CanWrite() bool

func (DatabaseDriver) Valid

func (d DatabaseDriver) Valid() bool

type ExportActivity

type ExportActivity struct {
	Format       ExporterName
	TablePerFile bool `yaml:"table_per_file" json:"table_per_file"`
	SkipExists   bool `yaml:"skip_exists" json:"skip_exists"`
	Out          struct {
		Dir        string `yaml:"dir" json:"dir"`
		FilePrefix string `yaml:"file_prefix" json:"file_prefix"`
	} `yaml:"out" json:"out"`
	Spec interface{} `yaml:"-" json:"spec"`
}

type ExportSpecTransform

type ExportSpecTransform struct {
	OnlyColumns   []string          `yaml:"only_columns"`
	SkipColumns   []string          `yaml:"skip_columns"`
	RenameColumns map[string]string `yaml:"rename_columns"`
}

type ExporterName

type ExporterName string
const (
	ExporterNameMd                   ExporterName = "md"
	ExporterNameDiagram              ExporterName = "diagram"
	ExporterNameGoEntities           ExporterName = "go-entities"
	ExporterNameGoEntityRepository   ExporterName = "go-entity-repository"
	ExporterNameGoose                ExporterName = "goose"
	ExporterNameGooseFixtures        ExporterName = "goose-fixtures"
	ExporterNameGoSQLMigrate         ExporterName = "go-sql-migrate"
	ExporterNameLaravelMigrationsRaw ExporterName = "laravel-migrations-raw"
	ExporterNameLaravelModels        ExporterName = "laravel-models"
	ExporterNameGrpcCrud             ExporterName = "grpc-crud"
	ExporterNameYamlFixtures         ExporterName = "yaml-fixtures"
	ExporterNameCSV                  ExporterName = "csv"
	ExporterNameJSONSchema           ExporterName = "json-schema"
	ExporterNameGraphql              ExporterName = "graphql"
	ExporterNameDBML                 ExporterName = "dbml"
)

type GRPCCrudExportSpec

type GRPCCrudExportSpec struct {
	Package string                                     `yaml:"package"`
	Options orderedmap.OrderedMap[string, interface{}] `yaml:"options"`
}

type GoEntitiesExportSpec

type GoEntitiesExportSpec struct {
	GoModule string `yaml:"go_module"`
	Package  string `yaml:"package"` // default: entities
}

type GoEntityRepositorySpec

type GoEntityRepositorySpec struct {
	GoModule string `yaml:"go_module" json:"go_module"`
	Entities struct {
		Package string `yaml:"package" json:"package"`
	} `yaml:"entities" json:"entities"`
	Repositories struct {
		Package   string `yaml:"package" json:"package"`
		Container struct {
			StructName string `yaml:"struct_name" json:"struct_name"`
		} `yaml:"container" json:"container"`
		Interfaces struct {
			Place     GoEntityRepositorySpecRepoInterfacesPlace `yaml:"place" json:"place"`
			WithMocks bool                                      `yaml:"with_mocks" json:"with_mocks"`
		} `yaml:"interfaces" json:"interfaces"`
	} `yaml:"repositories" json:"repositories"`
}

type GoEntityRepositorySpecRepoInterfacesPlace

type GoEntityRepositorySpecRepoInterfacesPlace string

type ImportActivity

type ImportActivity struct {
	Format ImporterName
	Spec   interface{} `yaml:"-"`
	From   string      `yaml:"from" json:"from"` // path to file or dir
}

type ImporterName

type ImporterName string
const (
	ImporterNameYamlFixtures ImporterName = "yaml-fixtures"
)

type JSONSchemaExportSpec

type JSONSchemaExportSpec struct {
	Pretty bool `yaml:"pretty" json:"pretty"`
	Schema struct {
		Title       string `yaml:"title" json:"title"`
		Description string `yaml:"description" json:"description"`
	} `yaml:"schema" json:"schema"`
}

type LaravelModelsExportSpec

type LaravelModelsExportSpec struct {
	Namespace string `yaml:"namespace"`
	TimeAs    string `yaml:"time_as"` // datetime, carbon
}

type Loader

type Loader struct {
	// contains filtered or unexported fields
}

func NewLoader

func NewLoader(
	files fs.Driver,
	envInjector *env.Injector,
	parsers map[string]Parser,
) *Loader

func (*Loader) Load

func (l *Loader) Load(path string) (*Config, error)

type MarkdownExportSpec

type MarkdownExportSpec struct {
	WithDiagram bool `yaml:"with_diagram"`
}

type MigrationsSpec

type MigrationsSpec struct {
	Use struct {
		IfNotExists bool `yaml:"if_not_exists"`
		IfExists    bool `yaml:"if_exists"`
	} `yaml:"use"`
	Target DatabaseDriver
}

func (*MigrationsSpec) Validate added in v0.4.0

func (m *MigrationsSpec) Validate() error

type Parser

type Parser func(content []byte) (*Config, error)

func JSONParser

func JSONParser() Parser

func YAMLParser

func YAMLParser() Parser

type Task

type Task struct {
	Activities []Activity `yaml:"activities"`
	Commit     Commit     `yaml:"commit"`
}

type ValidatableSpec added in v0.4.0

type ValidatableSpec interface {
	Validate() error
}

Jump to

Keyboard shortcuts

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