splitter

package module
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

README

splt

Note: This experimental tool is not officially supported by Ariga or Atlas and is provided as-is.

A small command tool to split an Atlas HCL schema file into multiple files.

Accepts input schema via a file or stdin and writes the split files to a directory.

Supported strategies:

  • schema: split by schema: each schema is written to a separate file.
  • block: split by block: each block type is written to a separate file.
  • resource: split to file per resource. each schema is written to a separate dir, with resources organized by types into separate directories.

Quickstart

Install:

go install github.com/rotemtam/splt/cmd/splt

Split a file:

# split by schema
atlas schema inspect --url '<db url>' | splt --output=./out --strategy=schema 

Verify output is correct:

atlas schema diff --dev-url docker://postgres/16/dev --from <db url> --to file://out/

Output:

Schemas are synced, no changes to be made.

Help

Usage: splt --output=./path/to/dir [flags]

Flags:
  -h, --help                    Show context-sensitive help.
  -i, --input=STRING            Input HCL file to split.
  -o, --output=./path/to/dir    Destination directory to write the split files.
      --strategy="schema"       Splitting strategy options:schema,block,resource

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run() int

Run split and return the exit code.

Types

This section is empty.

Directories

Path Synopsis
cmd
splt command

Jump to

Keyboard shortcuts

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