Skip to content

Latest commit

 

History

History
35 lines (25 loc) · 1.69 KB

README.md

File metadata and controls

35 lines (25 loc) · 1.69 KB

License Go Report Card Build Status GoDoc

Core SQL

This package is used to wrap the SQL standard library to satisfy the health checking server in the LUSH core service library. We use golang-migrate/migrate version 4 for migrations and treats it as a direct dependency.

Examples

Use in conjunction with readysrv

database := coresql.MustOpen("mysql", "tcp(localhost:3306)/mydb")
readysrv.New(readysrv.Checks{
    "mysql": database,
})

Ensure database is migrated up

_, migrations := coresql.MustOpenWithMigrations("mysql", "tcp(localhost:3306)/mydb", "file://path/to/migrations")
coresql.MustMigrateUp(migrations)

Handle migration arguments

You can force your application to respect migration command line arguments:

  • migrate up: attempt to migrate up
  • migrate down: attempt to migrate down
_, migrations := coresql.MustOpenWithMigrations("mysql", "tcp(localhost:3306)/mydb", "file://path/to/migrations")
coresql.HandleMigrationArgs(migrations)