noop.go
000_noop.go - Overview
-
Overview This file defines a no-op SQL migration for testing purposes. It implements the
sqlmigration.SQLMigration
interface with emptyUp
andDown
methods, effectively doing nothing during migration. -
Detailed Documentation
noopMigration
- Purpose: Represents a no-op SQL migration.
- Parameters: None
- Returns: None
NoopMigrationFactory
- Purpose: Creates a
factory.ProviderFactory
for thenoopMigration
. This allows the no-op migration to be used within a larger factory/provider system. - Parameters: None
- Returns:
factory.ProviderFactory[sqlmigration.SQLMigration, sqlmigration.Config]
- A factory for creatingsqlmigration.SQLMigration
instances using the provided configuration.
(*noopMigration) Register
- Purpose: Registers the
Up
andDown
functions of thenoopMigration
with themigrate.Migrations
object. - Parameters:
migrations
(*migrate.Migrations): The migrations object to register with.
- Returns: error: An error if registration fails, nil otherwise.
(*noopMigration) Up
- Purpose: Implements the "up" migration logic, which in this case does nothing.
- Parameters:
ctx
(context.Context): The context for the operation.db
(*bun.DB): The database connection.
- Returns: error: Always nil.
(*noopMigration) Down
- Purpose: Implements the "down" migration logic, which in this case does nothing.
- Parameters:
ctx
(context.Context): The context for the operation.db
(*bun.DB): The database connection.
- Returns: error: Always nil.
- Code Examples None
Include in Getting Started: NO