Czyszczenie kodu, dodanie odczytu emaila z bazy danych.

This commit is contained in:
Marcel Grześ 2019-01-12 11:27:42 +01:00
parent 647211f92f
commit b78d3480fb
4 changed files with 3 additions and 6 deletions

View File

@ -12,7 +12,7 @@ type patient struct {
BirthDate time.Time
PatientState nullString
PatientSex sex
PatientEmail string
PatientEmail nullString
}
type diagnosis struct {

View File

@ -10,7 +10,7 @@ import (
_ "github.com/denisenkom/go-mssqldb"
)
var connectionString = "server=192.168.1.2;Port=1433;database=DB_s439397;trusted_connection=yes;encrypt=disable"
var connectionString = "server=127.0.0.1;Port=1433;database=DB_s439397;trusted_connection=yes;encrypt=disable"
var db *sql.DB
var err error

View File

@ -25,7 +25,7 @@ func (pat patients) readModels(rows *sql.Rows) iDatabaseModels {
for rows.Next() {
pati = patient{}
rows.Scan(&pati.Pesel, &pati.Name, &pati.Surname, &pati.BirthDate, &pati.PatientState,
&pati.PatientSex)
&pati.PatientSex, &pati.PatientEmail)
models = append(models, pati)
}
return models

View File

@ -21,7 +21,6 @@ func getAll(w http.ResponseWriter, r *http.Request) {
x, _ := json.Marshal(patientsList)
fmt.Fprintf(w, string(x), html.EscapeString(r.URL.Path))
//json.NewEncoder(w).Encode(x)
fmt.Println("POBRANO DANE" + table)
}
func sort(w http.ResponseWriter, r *http.Request) {
@ -96,7 +95,6 @@ func columnNames(w http.ResponseWriter, r *http.Request) {
args := mux.Vars(r)
table := args["tableName"]
colNames, _ := getColumnNames(table)
//fmt.Fprint(w, colNames)
json.NewEncoder(w).Encode(colNames)
fmt.Println("POBRANO COLUMN NAMES " + table)
}
@ -104,7 +102,6 @@ func columnTypes(w http.ResponseWriter, r *http.Request) {
args := mux.Vars(r)
table := args["tableName"]
colNames, _ := getColumnTypes(table)
//fmt.Fprint(w, colNames)
json.NewEncoder(w).Encode(colNames)
fmt.Println("POBRANO COLUMN TYPES " + table)
}