getUserName path implemented
This commit is contained in:
parent
db6fdf3c29
commit
abfb79b991
4 changed files with 67 additions and 0 deletions
|
@ -44,6 +44,7 @@ type Database interface {
|
|||
GetProjectTimes(projectName string) (map[string]int, error)
|
||||
UpdateWeeklyReport(projectName string, userName string, week int, developmentTime int, meetingTime int, adminTime int, ownWorkTime int, studyTime int, testingTime int) error
|
||||
RemoveProject(projectname string) error
|
||||
GetUserName(id int) (string, error)
|
||||
}
|
||||
|
||||
// This struct is a wrapper type that holds the database connection
|
||||
|
@ -611,3 +612,9 @@ func (d *Db) RemoveProject(projectname string) error {
|
|||
_, err := d.Exec("DELETE FROM projects WHERE name = ?", projectname)
|
||||
return err
|
||||
}
|
||||
|
||||
func (d *Db) GetUserName(id int) (string, error) {
|
||||
var username string
|
||||
err := d.Get(&username, "SELECT username FROM users WHERE id = ?", id)
|
||||
return username, err
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue