mirror of
https://github.com/semaphoreui/semaphore.git
synced 2024-11-25 06:15:56 +01:00
22 lines
541 B
Go
22 lines
541 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:"-"`
|
|
}
|
|
|
|
func FetchUser(userID int) (*User, error) {
|
|
var user User
|
|
|
|
err := Mysql.SelectOne(&user, "select * from user where id=?", userID)
|
|
return &user, err
|
|
}
|