config

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2025 License: MIT Imports: 13 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 {
	Database     string         `yaml:"database" json:"database"`
	Tables       ActivityTables `yaml:"tables" json:"tables"`
	Format       ExporterName   `yaml:"format" json:"format"`
	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"`
}

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" json:"delimiter"`
	Transform map[string][]ExportSpecTransform `yaml:"transform" json:"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 CustomExportSpec added in v0.5.0

type CustomExportSpec struct {
	Template string `yaml:"template" json:"template"`
	Output   struct {
		Extension string `yaml:"extension" json:"extension"`
	} `yaml:"output" json:"output"`
}

func (*CustomExportSpec) Validate added in v0.5.0

func (s *CustomExportSpec) Validate() error

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 ExpectingDatabaseDriver added in v0.5.0

type ExpectingDatabaseDriver interface {
	InjectDatabaseDriver(driver DatabaseDriver)
}

type ExportSpecTransform

type ExportSpecTransform struct {
	OnlyColumns   []string          `yaml:"only_columns" json:"only_columns"`
	SkipColumns   []string          `yaml:"skip_columns" json:"skip_columns"`
	RenameColumns map[string]string `yaml:"rename_columns" json:"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"
	ExporterNameDDL                  ExporterName = "ddl"
	ExporterNameLaravelMigrationsRaw ExporterName = "laravel-migrations-raw"
	ExporterNameLaravelModels        ExporterName = "laravel-models"
	ExporterNameGrpcCrud             ExporterName = "grpc-crud"
	ExporterNameCSV                  ExporterName = "csv"
	ExporterNameJSONSchema           ExporterName = "json-schema"
	ExporterNameGraphql              ExporterName = "graphql"
	ExporterNameDBML                 ExporterName = "dbml"
	ExporterNameCustom               ExporterName = "custom"
)

type GRPCCrudExportSpec

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

type GoEntitiesExportSpec

type GoEntitiesExportSpec struct {
	GoModule string `yaml:"go_module" json:"go_module"`
	Package  string `yaml:"package" json:"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 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" json:"namespace"`
	TimeAs    string `yaml:"time_as" json:"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" json:"with_diagram"`
}

type MigrationsSpec

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

func (*MigrationsSpec) InjectDatabaseDriver added in v0.5.0

func (m *MigrationsSpec) InjectDatabaseDriver(driver 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