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

22 lines
470 B
Go
Raw Permalink Normal View History

2024-01-14 16:50:09 +00:00
package redisotp
import (
"context"
2024-01-14 16:50:09 +00:00
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
}
2024-01-14 16:50:09 +00:00
return true, nil
}