Skip to content

a tool to print ent schemas as Atlas HCL documents

License

Notifications You must be signed in to change notification settings

Fraser-Isbester/entprint

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

entprint

a tool to print ent schemas as Atlas HCL documents

Docs

From within your Ent project:

go run -mod=mod github.com/rotemtam/entprint --help

Output:

Usage: entprint --dir=STRING --dev=STRING

a tool to print ent schemas as Atlas HCL documents

Flags:
  -h, --help                      Show context-sensitive help.
      --dir=STRING                ent schema directory
      --dev=STRING                dev db url
      --with-global-unique-ids    set global unique ids to true

Example usage

Suppose your Ent schema is located in ./ent/schema, and you have an empty MySQL db running at mysql://root:pass@localhost:3306/test:

go run github.com/rotemtam/entprint  --dir ./internal/example/ent/schema --dev mysql://root:pass@localhost:3306/test

Output:

table "users" {
  schema  = schema.test
  collate = "utf8mb4_bin"
  column "id" {
    null           = false
    type           = bigint
    auto_increment = true
  }
  primary_key {
    columns = [column.id]
  }
}
schema "test" {
  charset = "utf8mb4"
  collate = "utf8mb4_0900_ai_ci"
}

Support

Join us on our Discord server.

About

a tool to print ent schemas as Atlas HCL documents

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 94.1%
  • HCL 5.9%