From dd8e5704c816ceca3bf9b717c0d2bbfca22c46c5 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Tue, 6 Jun 2023 23:27:43 -0400 Subject: [PATCH] refactor: rename checkPubkey to CheckPubkeyValidator --- controller/account.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/controller/account.go b/controller/account.go index bb84c65..1f27162 100644 --- a/controller/account.go +++ b/controller/account.go @@ -27,7 +27,7 @@ type RegisterRequest struct { Pubkey string `json:"pubkey"` } -func checkPubkey(value interface{}) error { +func CheckPubkeyValidator(value interface{}) error { p, _ := value.(string) pubkeyBytes, err := hex.DecodeString(p) if err != nil { @@ -44,7 +44,7 @@ func checkPubkey(value interface{}) error { func (r RegisterRequest) Validate() error { return validation.ValidateStruct(&r, validation.Field(&r.Email, validation.Required, is.EmailFormat), - validation.Field(&r.Pubkey, validation.When(len(r.Password) == 0, validation.Required, validation.By(checkPubkey))), + validation.Field(&r.Pubkey, validation.When(len(r.Password) == 0, validation.Required, validation.By(CheckPubkeyValidator))), validation.Field(&r.Password, validation.When(len(r.Pubkey) == 0, validation.Required)), ) }