Unexporting some functions that aren't needed outside the module
2 files changed, 8 insertions(+), 11 deletions(-)

M migrate.go
M sql.go
M migrate.go +4 -4
@@ 70,7 70,7 @@ func (me *MigrationEngine) Migrate(ctx c
 		}
 	}
 
-	ctx = Context(ctx, me.db)
+	ctx = dbContext(ctx, me.db)
 	err = me.createMigrationTable(ctx)
 	if err != nil {
 		return err

          
@@ 128,7 128,7 @@ func (me *MigrationEngine) Rollback(ctx 
 		}
 	}
 
-	ctx = Context(ctx, me.db)
+	ctx = dbContext(ctx, me.db)
 	err = me.createMigrationTable(ctx)
 	if err != nil {
 		return err

          
@@ 212,7 212,7 @@ func (me *MigrationEngine) runMigration(
 
 	var cancel context.CancelFunc
 	if m.Timeout > 0 {
-		ctx, cancel = ContextAddTimeout(ctx, m.Timeout)
+		ctx, cancel = contextAddTimeout(ctx, m.Timeout)
 		defer cancel()
 	}
 

          
@@ 240,7 240,7 @@ func (me *MigrationEngine) runRollback(c
 
 	var cancel context.CancelFunc
 	if m.Timeout > 0 {
-		ctx, cancel = ContextAddTimeout(ctx, m.Timeout)
+		ctx, cancel = contextAddTimeout(ctx, m.Timeout)
 		defer cancel()
 	}
 

          
M sql.go +4 -7
@@ 64,18 64,15 @@ type contextKey struct {
 
 var txOptionsRO *sql.TxOptions = &sql.TxOptions{Isolation: 0, ReadOnly: true}
 
-// ContextAddTimeout returns a context with query timeout
-func ContextAddTimeout(ctx context.Context, timeout int) (context.Context, context.CancelFunc) {
+func contextAddTimeout(ctx context.Context, timeout int) (context.Context, context.CancelFunc) {
 	return context.WithTimeout(ctx, time.Duration(timeout)*time.Second)
 }
 
-// Context adds db connection to context for immediate use
-func Context(ctx context.Context, db *sql.DB) context.Context {
+func dbContext(ctx context.Context, db *sql.DB) context.Context {
 	return context.WithValue(ctx, dbCtxKey, db)
 }
 
-// DBFromContext pulls db pool from context
-func DBFromContext(ctx context.Context) *sql.DB {
+func dbFromContext(ctx context.Context) *sql.DB {
 	db, ok := ctx.Value(dbCtxKey).(*sql.DB)
 	if !ok {
 		panic(errors.New("Invalid database context"))

          
@@ 85,7 82,7 @@ func DBFromContext(ctx context.Context) 
 
 // WithTx calls a function wrapped in a database transaction
 func WithTx(ctx context.Context, opts *sql.TxOptions, fn func(tx *sql.Tx) error) error {
-	db := DBFromContext(ctx)
+	db := dbFromContext(ctx)
 	tx, err := db.BeginTx(ctx, opts)
 	if err != nil {
 		return err