Semaphore/models/User.go

24 lines
556 B
Go
Raw Normal View History

2016-01-05 00:32:53 +01:00
package models
import (
"time"
2016-03-18 23:03:28 +01:00
"github.com/ansible-semaphore/semaphore/database"
2016-01-05 00:32:53 +01:00
)
type User struct {
2016-03-19 00:23:03 +01:00
ID int `db:"id" json:"id"`
2016-01-05 00:32:53 +01:00
Created time.Time `db:"created" json:"created"`
Username string `db:"username" json:"username"`
Name string `db:"name" json:"name"`
Email string `db:"email" json:"email"`
Password string `db:"password" json:"password"`
}
2016-03-18 23:03:28 +01:00
func FetchUser(userID int) (*User, error) {
var user User
err := database.Mysql.SelectOne(&user, "select * from user where id=?", userID)
return &user, err
}