validator is now login-validator and is part of the server image
This commit is contained in:
parent
fd58db5eb1
commit
ee6fbe3e74
11 changed files with 23 additions and 5 deletions
|
|
@ -1,43 +0,0 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"encoding/csv"
|
||||
"os"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
type Student struct {
|
||||
Lastname string
|
||||
Firstname string
|
||||
Login string
|
||||
EMail string
|
||||
Phone string
|
||||
}
|
||||
|
||||
func readStudentsList(studentsFile string) (stds []Student, err error) {
|
||||
if studentsFile, err = filepath.Abs(studentsFile); err != nil {
|
||||
return
|
||||
} else if fi, err := os.Open(studentsFile); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
r := csv.NewReader(bufio.NewReader(fi))
|
||||
if list, err := r.ReadAll(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
for _, i := range list {
|
||||
var s Student
|
||||
|
||||
s.Lastname = i[0]
|
||||
s.Firstname = i[1]
|
||||
s.Login = i[2]
|
||||
s.EMail = i[3]
|
||||
s.Phone = i[4]
|
||||
|
||||
stds = append(stds, s)
|
||||
}
|
||||
|
||||
return stds, nil
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in a new issue