package models // User represents the full DB user field, for inserts and compares. // No reason to return the hashed pw on the route though. type User struct { UserID int64 Username string DisplayName string Password []byte } type UserNoPassword struct { UserID int64 `json:"user_id"` Username string `json:"username"` DisplayName string `json:"display_name"` } // User returns a single plan from the store by plan_id. func (m *Model) User(id int) (*UserNoPassword, error) { user, err := m.SelectUserByID(id) if user == nil { return nil, wrapNotFound(err) } return user.NoPassword(), wrapNotFound(err) } func (u *User) NoPassword() *UserNoPassword { return &UserNoPassword{ UserID: u.UserID, Username: u.Username, DisplayName: u.DisplayName, } }