7
7
8
8
type VectorSetCmdable interface {
9
9
VAdd (ctx context.Context , key , element string , val Vector ) * BoolCmd
10
- VAddArgs (ctx context.Context , key , element string , val Vector , addArgs VAddArgs ) * BoolCmd
10
+ VAddWithArgs (ctx context.Context , key , element string , val Vector , addArgs * VAddArgs ) * BoolCmd
11
11
VCard (ctx context.Context , key string ) * IntCmd
12
12
VDim (ctx context.Context , key string ) * IntCmd
13
13
VEmb (ctx context.Context , key , element string , raw bool ) * SliceCmd
@@ -21,8 +21,8 @@ type VectorSetCmdable interface {
21
21
VSetAttr (ctx context.Context , key , element , attr string ) * BoolCmd
22
22
VSim (ctx context.Context , key string , val Vector ) * StringSliceCmd
23
23
VSimWithScores (ctx context.Context , key string , val Vector ) * MapStringFloatCmd
24
- VSimArgs (ctx context.Context , key string , val Vector , args VSimArgs ) * StringSliceCmd
25
- VSimArgsWithScores (ctx context.Context , key string , val Vector , args VSimArgs ) * MapStringFloatCmd
24
+ VSimWithArgs (ctx context.Context , key string , val Vector , args * VSimArgs ) * StringSliceCmd
25
+ VSimWithArgsWithScores (ctx context.Context , key string , val Vector , args * VSimArgs ) * MapStringFloatCmd
26
26
}
27
27
28
28
type Vector interface {
@@ -72,7 +72,7 @@ var _ Vector = &VectorRef{}
72
72
73
73
// `VADD key (FP32 | VALUES num) vector element`
74
74
func (c cmdable ) VAdd (ctx context.Context , key , element string , val Vector ) * BoolCmd {
75
- return c .VAddArgs (ctx , key , element , val , VAddArgs {})
75
+ return c .VAddWithArgs (ctx , key , element , val , & VAddArgs {})
76
76
}
77
77
78
78
type VAddArgs struct {
@@ -120,7 +120,10 @@ func (v VAddArgs) appendArgs(args []any) []any {
120
120
}
121
121
122
122
// `VADD key [REDUCE dim] (FP32 | VALUES num) vector element [CAS] [NOQUANT | Q8 | BIN] [EF build-exploration-factor] [SETATTR attributes] [M numlinks]`
123
- func (c cmdable ) VAddArgs (ctx context.Context , key , element string , val Vector , addArgs VAddArgs ) * BoolCmd {
123
+ func (c cmdable ) VAddWithArgs (ctx context.Context , key , element string , val Vector , addArgs * VAddArgs ) * BoolCmd {
124
+ if addArgs == nil {
125
+ addArgs = & VAddArgs {}
126
+ }
124
127
args := []any {"vadd" , key }
125
128
if addArgs .reduce () > 0 {
126
129
args = append (args , "reduce" , addArgs .reduce ())
@@ -216,12 +219,12 @@ func (c cmdable) VSetAttr(ctx context.Context, key, element, attr string) *BoolC
216
219
217
220
// `VSIM key (ELE | FP32 | VALUES num) (vector | element)`
218
221
func (c cmdable ) VSim (ctx context.Context , key string , val Vector ) * StringSliceCmd {
219
- return c .VSimArgs (ctx , key , val , VSimArgs {})
222
+ return c .VSimWithArgs (ctx , key , val , & VSimArgs {})
220
223
}
221
224
222
225
// `VSIM key (ELE | FP32 | VALUES num) (vector | element) WITHSCORES`
223
226
func (c cmdable ) VSimWithScores (ctx context.Context , key string , val Vector ) * MapStringFloatCmd {
224
- return c .VSimArgsWithScores (ctx , key , val , VSimArgs {})
227
+ return c .VSimWithArgsWithScores (ctx , key , val , & VSimArgs {})
225
228
}
226
229
227
230
type VSimArgs struct {
@@ -262,7 +265,10 @@ func (v VSimArgs) appendArgs(args []any) []any {
262
265
263
266
// `VSIM key (ELE | FP32 | VALUES num) (vector | element) [COUNT num]
264
267
// [EF search-exploration-factor] [FILTER expression] [FILTER-EF max-filtering-effort] [TRUTH] [NOTHREAD]`
265
- func (c cmdable ) VSimArgs (ctx context.Context , key string , val Vector , simArgs VSimArgs ) * StringSliceCmd {
268
+ func (c cmdable ) VSimWithArgs (ctx context.Context , key string , val Vector , simArgs * VSimArgs ) * StringSliceCmd {
269
+ if simArgs == nil {
270
+ simArgs = & VSimArgs {}
271
+ }
266
272
args := []any {"vsim" , key }
267
273
args = append (args , val .Value ()... )
268
274
args = simArgs .appendArgs (args )
@@ -273,7 +279,10 @@ func (c cmdable) VSimArgs(ctx context.Context, key string, val Vector, simArgs V
273
279
274
280
// `VSIM key (ELE | FP32 | VALUES num) (vector | element) [WITHSCORES] [COUNT num]
275
281
// [EF search-exploration-factor] [FILTER expression] [FILTER-EF max-filtering-effort] [TRUTH] [NOTHREAD]`
276
- func (c cmdable ) VSimArgsWithScores (ctx context.Context , key string , val Vector , simArgs VSimArgs ) * MapStringFloatCmd {
282
+ func (c cmdable ) VSimWithArgsWithScores (ctx context.Context , key string , val Vector , simArgs * VSimArgs ) * MapStringFloatCmd {
283
+ if simArgs == nil {
284
+ simArgs = & VSimArgs {}
285
+ }
277
286
args := []any {"vsim" , key }
278
287
args = append (args , val .Value ()... )
279
288
args = append (args , "withscores" )
0 commit comments