niki/repository/redis/redis_otp/save_code.go

20 lines
456 B
Go
Raw Normal View History

package redisotp
import (
"context"
"time"
richerror "git.gocasts.ir/ebhomengo/niki/pkg/rich_error"
)
func (d DB) SaveCodeWithPhoneNumber(ctx context.Context, phoneNumber, code string, expireTime time.Duration) error {
const op = "redisotp.SaveCodeWithPhoneNumber"
err := d.adapter.Client().Set(ctx, phoneNumber, code, expireTime).Err()
if err != nil {
return richerror.New(op).WithErr(err).WithKind(richerror.KindUnexpected)
}
return nil
}