func Login(username string, password string) (bool, User) {
var user User
db := Database.Where("username = ? and password = ?", username, password).First(&user)
return db.Error == nil, user
}
func Login(username string, password string) (bool, User) {
var user User
db := Database.Where("username = ? and password = ?", username, password).First(&user)
return db.Error == nil, user
}
本文标题:直接将 数据库是否出错 做为返回值
本文链接:https://www.haomeiwen.com/subject/virhlctx.html
网友评论