mirror of
https://github.com/gravitl/netmaker.git
synced 2024-11-15 14:20:25 +08:00
22 lines
450 B
Go
22 lines
450 B
Go
package logic
|
|
|
|
import (
|
|
"encoding/json"
|
|
|
|
"github.com/gravitl/netmaker/database"
|
|
"github.com/gravitl/netmaker/models"
|
|
)
|
|
|
|
// GetUser - gets a user
|
|
func GetUser(username string) (models.User, error) {
|
|
|
|
var user models.User
|
|
record, err := database.FetchRecord(database.USERS_TABLE_NAME, username)
|
|
if err != nil {
|
|
return user, err
|
|
}
|
|
if err = json.Unmarshal([]byte(record), &user); err != nil {
|
|
return models.User{}, err
|
|
}
|
|
return user, err
|
|
}
|