Semaphore/db/User.go
Matej Kramny db4948cb89 Merge branch 'master' into develop
# Conflicts:
#	Dockerfile
#	api/login.go
#	api/projects/environment.go
#	api/projects/project.go
#	api/projects/templates.go
#	api/tasks/runner.go
#	api/users.go
#	db/versionHistory.go
#	util/bindata.go
2017-04-18 14:48:31 +01:00

24 lines
639 B
Go

package db
import (
"time"
)
type User struct {
ID int `db:"id" json:"id"`
Created time.Time `db:"created" json:"created"`
Username string `db:"username" json:"username" binding:"required"`
Name string `db:"name" json:"name" binding:"required"`
Email string `db:"email" json:"email" binding:"required"`
Password string `db:"password" json:"-"`
External bool `db:"external" json:"external"`
Alert bool `db:"alert" json:"alert"`
}
func FetchUser(userID int) (*User, error) {
var user User
err := Mysql.SelectOne(&user, "select * from user where id=?", userID)
return &user, err
}