From b83c7b1e175a493a3bb1bec9aca4e40ba1512b67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20=C3=85hall?= Date: Fri, 10 May 2024 08:11:47 +0200 Subject: [PATCH] Made Version function public --- upgrader.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/upgrader.go b/upgrader.go index d2ad6fd..8b20287 100644 --- a/upgrader.go +++ b/upgrader.go @@ -43,7 +43,7 @@ func (upgrader *Upgrader) Version(dbName string) (version int, err error) {// {{ return } - version, err = dbase.version() + version, err = dbase.Version() return }// }}} @@ -111,7 +111,7 @@ func (dbase Database) verifySchemaEntry() (err error) {// {{{ return }// }}} -func (dbase Database) version() (version int, err error) {// {{{ +func (dbase Database) Version() (version int, err error) {// {{{ var rows *sql.Rows rows, err = dbase.db.Query( `SELECT version FROM `+dbase.upgrader.schema+`.schema ORDER BY version DESC LIMIT 1`, @@ -130,8 +130,7 @@ func (dbase Database) version() (version int, err error) {// {{{ }// }}} // AddDatabase sets a database up for the Run() function with verifying/creating the _db.schema table. -func (upgrader Upgrader) AddDatabase(host string, port int, dbName, user, pass string) (err error) {// {{{ - var db Database +func (upgrader Upgrader) AddDatabase(host string, port int, dbName, user, pass string) (db Database, err error) {// {{{ if db, err = newDatabase(host, port, dbName, user, pass); err != nil { return } @@ -151,7 +150,7 @@ func (upgrader Upgrader) Run() (err error) {// {{{ var version int for dbName, dbase := range upgrader.databases { - version, err = dbase.version() + version, err = dbase.Version() if err != nil { return }