clicmd

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2026 License: MIT Imports: 12 Imported by: 0

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

type OpenFunc func(ctx context.Context) (*bun.DB, error)

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

Jump to

Keyboard shortcuts

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