apply some ai reviews

This commit is contained in:
Muhammed Efe Cetin
2025-07-04 14:42:34 +03:00
parent 8139126338
commit 0feb2ba53d
6 changed files with 5 additions and 7 deletions

View File

@@ -3,7 +3,6 @@ package cloudflarekv
import (
"bytes"
"context"
"fmt"
"os"
"testing"
@@ -67,7 +66,6 @@ func Test_CloudflareKV_GetWithContext(t *testing.T) {
cancel()
val, err = testStore.GetWithContext(ctx, key)
fmt.Println(err)
require.ErrorContains(t, err, context.Canceled.Error())
require.Nil(t, val)

View File

@@ -76,7 +76,7 @@ func New(config Config) *Storage {
return store
}
// GetWithContext value by key with context
// GetWithContext retrieves the value associated with the given key using the provided context.
func (s *Storage) GetWithContext(ctx context.Context, key string) ([]byte, error) {
k := make(map[string]types.AttributeValue)
k[keyAttrName] = &types.AttributeValueMemberS{

View File

@@ -62,7 +62,7 @@ func New(config ...Config) *Storage {
return storage
}
// GetWithContext value by key with context
// GetWithContext retrieves the value associated with the given key using the provided context.
func (s *Storage) GetWithContext(ctx context.Context, key string) ([]byte, error) {
if len(key) <= 0 {
return nil, errors.New("the key value is required")

View File

@@ -165,7 +165,7 @@ func New(config ...Config) *Storage {
return storage
}
// GetWithContext value by key with context
// GetWithContext retrieves the value associated with the given key using the provided context.
func (s *Storage) GetWithContext(ctx context.Context, key string) ([]byte, error) {
if len(key) <= 0 {
return nil, nil

View File

@@ -32,7 +32,7 @@ func (s *Storage) DeleteWithContext(ctx context.Context, key string) error
func (s *Storage) Reset() error
func (s *Storage) ResetWithContext(ctx context.Context) error
func (s *Storage) Close() error
func (s *Storage) Conn() *badger.DB
func (s *Storage) Conn() *pebble.DB
```
**Note:** The context methods are dummy methods and don't have any functionality, as Pebble does not support context cancellation in its client library. They are provided for compliance with the Fiber storage interface.

View File

@@ -82,7 +82,7 @@ func New(config ...Config) *Storage {
}
}
// GetWithContext value by key with context
// GetWithContext retrieves the value associated with the given key using the provided context.
func (s *Storage) GetWithContext(ctx context.Context, key string) ([]byte, error) {
if len(key) <= 0 {
return nil, nil