Skip to content

v0.1.1

Choose a tag to compare

@yuku yuku released this 29 Jul 06:52
· 7 commits to main since this release
8dad2eb

Features

Pool Management

  • ListPools(): Discover existing pools by prefix for cleanup scripts
  • CleanupPool(): Remove pools and all associated resources
  • Built on numpool v0.4.4 with enhanced pool management capabilities

Git-based Schema Versioning (gitutil package)

  • GetFilesRevision(): Get Git commit hash for schema files
  • HasUnstagedChanges(): Detect unstaged changes in schema files
  • GetSchemaVersion(): Smart versioning with random fallback for development safety
  • Automatic pool isolation when schema files change
  • Development-friendly workflow with unstaged change detection

Documentation & Examples

  • Complete usage guide with gitutil integration examples
  • Standalone cleanup script templates
  • Schema versioning patterns and best practices
  • Comprehensive API documentation

What's Changed

  • Add pool discovery and cleanup functions for managing test database pools
  • Add gitutil subpackage for Git-based schema version tracking
  • Update documentation with real-world usage examples and cleanup patterns
  • Improve schema versioning workflow for development and CI environments

Installation

go get github.com/yuku/testdbpool@v0.1.1

Usage

import (
    "github.com/yuku/testdbpool"
    "github.com/yuku/testdbpool/gitutil"
)

// Schema versioning with Git
schemaFiles := []string{"db/schema.sql", "db/migrations.sql"}
version := gitutil.GetSchemaVersion(schemaFiles)
poolID := fmt.Sprintf("myapp-test-%s", version)

// Pool cleanup
pools, _ := testdbpool.ListPools(ctx, connPool, "myapp-test-")
for _, poolID := range pools {
    testdbpool.CleanupPool(ctx, connPool, poolID)
}

Full Changelog: v0.1.0...v0.1.1