diff --git a/entity/entity.go b/entity/entity.go index f1f0396..9c99501 100644 --- a/entity/entity.go +++ b/entity/entity.go @@ -2,12 +2,15 @@ package entity import "github.com/google/uuid" +//ID entity ID type ID = uuid.UUID +//NewID create a new entity ID func NewID() ID { return ID(uuid.New()) } +//StringToID convert a string to an entity ID func StringToID(s string) (ID, error) { id, err := uuid.Parse(s) return ID(id), err diff --git a/entity/user.go b/entity/user.go index 963da6a..fbb8a9e 100644 --- a/entity/user.go +++ b/entity/user.go @@ -79,7 +79,7 @@ func (u *User) Validate() error { return nil } -//ValidatePassword +//ValidatePassword validate user password func (u *User) ValidatePassword(p string) error { err := bcrypt.CompareHashAndPassword([]byte(u.Password), []byte(p)) if err != nil {