Documentation
¶
Overview ¶
Package sql contains types and providers for connecting to and migrating SQL databases.
Index ¶
- func CheckMigrations(ctx context.Context, dsn *url.URL, db *sql.DB, migrations Migrations) error
- func Migrate(ctx context.Context, logger *slog.Logger, dsn *url.URL, db *sql.DB, ...) error
- func New(ctx context.Context, config Config, logger *slog.Logger, migrations Migrations) (db *sql.DB, err error)
- type Config
- type Migrations
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckMigrations ¶ added in v0.7.0
CheckMigrations returns an error if there are missing migrations.
Types ¶
type Migrations ¶ added in v0.7.0
Migrations represents a set of SQL migrations.
Create a provider that returns an fs.FS with your .sql migrations at the root of the FS. eg.
//go:embed migrations/*.sql
var migrations embed.FS
//zero:provider multi
func Migrations() Migrations {
sub, _ := fs.Sub(migrations, "migrations")
return []fs.FS{sub}
}
Click to show internal directories.
Click to hide internal directories.