admissionServer/databaseInfo.go

21 lines
409 B
Go
Raw Normal View History

package main
import (
"context"
_ "github.com/denisenkom/go-mssqldb"
)
func getColumnNames(tableName string) (string, error) {
ctx := context.Background()
checkIsDatabaseAlive()
tsql := "SELECT * FROM " + tableName
rows, _ := db.QueryContext(ctx, tsql)
collection, _ := rows.Columns()
var toReturn string
for _, element := range collection {
toReturn += element + "."
}
return toReturn, nil
}