Czyszczenie kodu, dodanie odczytu emaila z bazy danych.
This commit is contained in:
parent
647211f92f
commit
b78d3480fb
@ -12,7 +12,7 @@ type patient struct {
|
||||
BirthDate time.Time
|
||||
PatientState nullString
|
||||
PatientSex sex
|
||||
PatientEmail string
|
||||
PatientEmail nullString
|
||||
}
|
||||
|
||||
type diagnosis struct {
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user