Documentation
¶
Overview ¶
Package clicmd exposes a bunmigrate.Runner as a urfave/cli v3 command.
It is a separate package so that the runner itself stays free of the CLI dependencies: importing oaklab.hu/go/bunmigrate pulls in bun alone.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New(migrations *migrate.Migrations, open OpenFunc, opts ...migrate.MigratorOption) *cli.Command
New returns a "migrate" command with subcommands to create, apply, roll back and inspect migrations.
The result is an ordinary cli.Command: rename it, restyle it or graft it into a larger CLI as needed. Migration output goes to the writer of the root command, os.Stdout unless the caller changed it.
The database is opened before every subcommand and closed after it, so a long-lived handle is neither expected nor kept.
Types ¶
type OpenFunc ¶
OpenFunc opens the database the migrations are applied to.
It is called when a subcommand runs rather than when the command is built, so that loading configuration or reaching the database cannot break the rest of the CLI. Its error is returned to the user unchanged.
Source Files
¶
- command.go