23 lines
591 B
Go
23 lines
591 B
Go
package repository
|
|
|
|
import (
|
|
"electricity_bill_calc/global"
|
|
"electricity_bill_calc/model"
|
|
)
|
|
|
|
type _UserRepository struct{}
|
|
|
|
var UserRepo _UserRepository
|
|
|
|
func (_UserRepository) FindUserByUsername(username string) (*model.User, error) {
|
|
user := new(model.User)
|
|
has, err := global.DBConn.Where("username=?", username).Get(user)
|
|
return _postProcessSingle(user, has, err)
|
|
}
|
|
|
|
func (_UserRepository) RetreiveUserDetail(uid string) (*model.UserDetail, error) {
|
|
user := new(model.UserDetail)
|
|
has, err := global.DBConn.Where("id=?", uid).Get(user)
|
|
return _postProcessSingle(user, has, err)
|
|
}
|