Skip to main content

noop.go

000_noop.go - Overview

  1. Overview This file defines a no-op SQL migration for testing purposes. It implements the sqlmigration.SQLMigration interface with empty Up and Down methods, effectively doing nothing during migration.

  2. Detailed Documentation

noopMigration

  • Purpose: Represents a no-op SQL migration.
  • Parameters: None
  • Returns: None

NoopMigrationFactory

  • Purpose: Creates a factory.ProviderFactory for the noopMigration. 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 creating sqlmigration.SQLMigration instances using the provided configuration.

(*noopMigration) Register

  • Purpose: Registers the Up and Down functions of the noopMigration with the migrate.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.
  1. Code Examples None

Include in Getting Started: NO