From b1020aef90782d003b4bcbed8bb856f0f6a37768 Mon Sep 17 00:00:00 2001 From: Elton Minetto Date: Mon, 12 Oct 2020 08:16:08 -0300 Subject: [PATCH] fix: add comments --- entity/entity.go | 3 +++ entity/user.go | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) 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 {