fix comment
This commit is contained in:
parent
4f4ea8550e
commit
d423c25256
|
@ -17,6 +17,7 @@ var (
|
||||||
prefix string
|
prefix string
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Set ...
|
||||||
func Set(instance *mongo.Database, tablePrefix string) {
|
func Set(instance *mongo.Database, tablePrefix string) {
|
||||||
db = instance
|
db = instance
|
||||||
prefix = tablePrefix
|
prefix = tablePrefix
|
||||||
|
|
|
@ -7,16 +7,19 @@ import (
|
||||||
"golang.org/x/crypto/bcrypt"
|
"golang.org/x/crypto/bcrypt"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// HashPassword ...
|
||||||
func HashPassword(password string) string {
|
func HashPassword(password string) string {
|
||||||
bytes, _ := bcrypt.GenerateFromPassword([]byte(password), passwordHashingCost)
|
bytes, _ := bcrypt.GenerateFromPassword([]byte(password), passwordHashingCost)
|
||||||
return string(bytes)
|
return string(bytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CheckPasswordHash ...
|
||||||
func CheckPasswordHash(password, hash string) bool {
|
func CheckPasswordHash(password, hash string) bool {
|
||||||
err := bcrypt.CompareHashAndPassword([]byte(hash), []byte(password))
|
err := bcrypt.CompareHashAndPassword([]byte(hash), []byte(password))
|
||||||
return err == nil
|
return err == nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetSearchString ...
|
||||||
func GetSearchString(fieldList ...string) string {
|
func GetSearchString(fieldList ...string) string {
|
||||||
var (
|
var (
|
||||||
searchList = make([]interface{}, 0)
|
searchList = make([]interface{}, 0)
|
||||||
|
|
Loading…
Reference in New Issue