77
88type VectorSetCmdable interface {
99 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
1111 VCard (ctx context.Context , key string ) * IntCmd
1212 VDim (ctx context.Context , key string ) * IntCmd
1313 VEmb (ctx context.Context , key , element string , raw bool ) * SliceCmd
@@ -21,8 +21,8 @@ type VectorSetCmdable interface {
2121 VSetAttr (ctx context.Context , key , element , attr string ) * BoolCmd
2222 VSim (ctx context.Context , key string , val Vector ) * StringSliceCmd
2323 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
2626}
2727
2828type Vector interface {
@@ -72,7 +72,7 @@ var _ Vector = &VectorRef{}
7272
7373// `VADD key (FP32 | VALUES num) vector element`
7474func (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 {})
7676}
7777
7878type VAddArgs struct {
@@ -120,7 +120,10 @@ func (v VAddArgs) appendArgs(args []any) []any {
120120}
121121
122122// `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+ }
124127 args := []any {"vadd" , key }
125128 if addArgs .reduce () > 0 {
126129 args = append (args , "reduce" , addArgs .reduce ())
@@ -216,12 +219,12 @@ func (c cmdable) VSetAttr(ctx context.Context, key, element, attr string) *BoolC
216219
217220// `VSIM key (ELE | FP32 | VALUES num) (vector | element)`
218221func (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 {})
220223}
221224
222225// `VSIM key (ELE | FP32 | VALUES num) (vector | element) WITHSCORES`
223226func (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 {})
225228}
226229
227230type VSimArgs struct {
@@ -262,7 +265,10 @@ func (v VSimArgs) appendArgs(args []any) []any {
262265
263266// `VSIM key (ELE | FP32 | VALUES num) (vector | element) [COUNT num]
264267// [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+ }
266272 args := []any {"vsim" , key }
267273 args = append (args , val .Value ()... )
268274 args = simArgs .appendArgs (args )
@@ -273,7 +279,10 @@ func (c cmdable) VSimArgs(ctx context.Context, key string, val Vector, simArgs V
273279
274280// `VSIM key (ELE | FP32 | VALUES num) (vector | element) [WITHSCORES] [COUNT num]
275281// [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+ }
277286 args := []any {"vsim" , key }
278287 args = append (args , val .Value ()... )
279288 args = append (args , "withscores" )
0 commit comments