From d423c25256b3c5620d28f7723c1cdfdc234f8e6a Mon Sep 17 00:00:00 2001 From: Hoang Date: Wed, 10 Nov 2021 11:52:07 +0700 Subject: [PATCH] fix comment --- database/db.go | 1 + internal/helper.go | 3 +++ 2 files changed, 4 insertions(+) diff --git a/database/db.go b/database/db.go index f5ebbcf..62ba40d 100644 --- a/database/db.go +++ b/database/db.go @@ -17,6 +17,7 @@ var ( prefix string ) +// Set ... func Set(instance *mongo.Database, tablePrefix string) { db = instance prefix = tablePrefix diff --git a/internal/helper.go b/internal/helper.go index e99d3b6..597fef5 100644 --- a/internal/helper.go +++ b/internal/helper.go @@ -7,16 +7,19 @@ import ( "golang.org/x/crypto/bcrypt" ) +// HashPassword ... func HashPassword(password string) string { bytes, _ := bcrypt.GenerateFromPassword([]byte(password), passwordHashingCost) return string(bytes) } +// CheckPasswordHash ... func CheckPasswordHash(password, hash string) bool { err := bcrypt.CompareHashAndPassword([]byte(hash), []byte(password)) return err == nil } +// GetSearchString ... func GetSearchString(fieldList ...string) string { var ( searchList = make([]interface{}, 0)