Refactored, removed old remnants from v0.1.0, documentation added

This commit is contained in:
Magnus Åhall 2023-08-29 17:30:00 +02:00
parent a38bd4304f
commit d290a67800
2 changed files with 66 additions and 31 deletions

View file

@ -1,3 +1,22 @@
/*
Package dbschema is used to keep the SQL schema up to date.
func sqlProvider(dbName string, version int) (sql []byte, found bool) {
// read an SQL file and return the contents
return
}
upgrader := dbschema.NewUpgrader()
upgrader.SetSqlCallback(sqlProvider)
if err = upgrader.AddDatabase("127.0.0.1", 5432, "foo", "postgres", "password"); err != nil {
panic(err)
}
if err = upgrader.Run(); err != nil {
panic(err)
}
*/
package dbschema
import (
@ -8,6 +27,7 @@ import (
"database/sql"
)
// An upgrader verifies the schema for one or more databases and upgrades them if possible.
type Upgrader struct {
databases map[string]Database
logCallback func(string, string)