wtf so mutch pain cus i named a package wrong lol

This commit is contained in:
pigwin
2025-01-07 19:51:14 +00:00
parent a2c1766dd1
commit df0b5135bd
3 changed files with 27 additions and 33 deletions

24
valki/commands.go Normal file
View File

@@ -0,0 +1,24 @@
package valki
import (
"context"
"fmt"
"github.com/valkey-io/valkey-go"
)
func SetValkeyValue(ctx context.Context, client valkey.Client, key, value string) error {
err := client.Do(ctx, client.B().Set().Key(key).Value(value).Build()).Error()
if err != nil {
return fmt.Errorf("failed to set value in Valkey: %v", err)
}
return nil
}
func GetValkeyValue(ctx context.Context, client valkey.Client, key string) (string, error) {
value, err := client.Do(ctx, client.B().Get().Key(key).Build()).ToString()
if err != nil {
return "", fmt.Errorf("failed to get value from Valkey: %v", err)
}
return value, nil
}