forked from ebhomengo/niki
1
0
Fork 0
niki/repository/redis/redis_otp/delete_code.go

20 lines
468 B
Go

package redisotp
import (
"context"
richerror "git.gocasts.ir/ebhomengo/niki/pkg/rich_error"
)
func (d DB) DeleteCodeByPhoneNumber(ctx context.Context, phoneNumber string) (bool, error) {
const op = "redisotp.GetCodeByPhoneNumber"
success, err := d.adapter.Client().Del(ctx, phoneNumber).Result()
if err != nil {
return false, richerror.New(op).WithErr(err).WithKind(richerror.KindUnexpected)
}
if success != 1 {
return false, nil
}
return true, nil
}