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

18 lines
422 B
Go
Raw Normal View History

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