fix: add comments
This commit is contained in:
@@ -2,12 +2,15 @@ package entity
|
|||||||
|
|
||||||
import "github.com/google/uuid"
|
import "github.com/google/uuid"
|
||||||
|
|
||||||
|
//ID entity ID
|
||||||
type ID = uuid.UUID
|
type ID = uuid.UUID
|
||||||
|
|
||||||
|
//NewID create a new entity ID
|
||||||
func NewID() ID {
|
func NewID() ID {
|
||||||
return ID(uuid.New())
|
return ID(uuid.New())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//StringToID convert a string to an entity ID
|
||||||
func StringToID(s string) (ID, error) {
|
func StringToID(s string) (ID, error) {
|
||||||
id, err := uuid.Parse(s)
|
id, err := uuid.Parse(s)
|
||||||
return ID(id), err
|
return ID(id), err
|
||||||
|
|||||||
+1
-1
@@ -79,7 +79,7 @@ func (u *User) Validate() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
//ValidatePassword
|
//ValidatePassword validate user password
|
||||||
func (u *User) ValidatePassword(p string) error {
|
func (u *User) ValidatePassword(p string) error {
|
||||||
err := bcrypt.CompareHashAndPassword([]byte(u.Password), []byte(p))
|
err := bcrypt.CompareHashAndPassword([]byte(u.Password), []byte(p))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user