mirror of
https://github.com/redis/go-redis.git
synced 2025-07-19 11:43:14 +03:00
* feat: support vectorset * fix: char encoding error * use `any` instread of `interface{}` * update vectorset API Signed-off-by: fukua95 <fukua95@gmail.com> * refact: MapStringFloat64Cmd -> VectorInfoSliceCmd Signed-off-by: fukua95 <fukua95@gmail.com> * update: * the type of vector attribute: string -> VectorAttributeMarshaller * Add a new API VRemAttr * mark the APIs are experimental Signed-off-by: fukua95 <fukua95@gmail.com> * trigger CI again Signed-off-by: fukua95 <fukua95@gmail.com> * rename a API: VRemAttr -> VClearAttributes Signed-off-by: fukua95 <fukua95@gmail.com> * add test Signed-off-by: fukua95 <fukua95@gmail.com> * feat(vectorset): improve VSetAttr API and add comprehensive test suite - Simplify VSetAttr to accept interface{} with automatic JSON marshalling - Remove VectorAttributeMarshaller interface for simpler API - Add comprehensive unit tests for all vectorset commands --------- Signed-off-by: fukua95 <fukua95@gmail.com> Co-authored-by: Nedyalko Dyakov <nedyalko.dyakov@gmail.com>
27 lines
560 B
Go
27 lines
560 B
Go
package redis
|
|
|
|
import (
|
|
"context"
|
|
)
|
|
|
|
// mockCmdable is a mock implementation of cmdable that records the last command.
|
|
// This is used for unit testing command construction without requiring a Redis server.
|
|
type mockCmdable struct {
|
|
lastCmd Cmder
|
|
returnErr error
|
|
}
|
|
|
|
func (m *mockCmdable) call(ctx context.Context, cmd Cmder) error {
|
|
m.lastCmd = cmd
|
|
if m.returnErr != nil {
|
|
cmd.SetErr(m.returnErr)
|
|
}
|
|
return m.returnErr
|
|
}
|
|
|
|
func (m *mockCmdable) asCmdable() cmdable {
|
|
return func(ctx context.Context, cmd Cmder) error {
|
|
return m.call(ctx, cmd)
|
|
}
|
|
}
|