You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
go-fly/models/users.go

24 lines
360 B

4 years ago
package models
4 years ago
import (
"github.com/jinzhu/gorm"
_ "github.com/jinzhu/gorm/dialects/mysql"
)
type User struct {
gorm.Model
Id int64
Name string
Password string
}
func CreateUser(name string,password string){
user:=&User{
Name:name,
Password: password,
}
DB.Create(user)
}
func FindUsers()[]User{
var users []User
DB.Find(&users)
return users
}