Skip to content

Commit 7fbc42a

Browse files
added godocs for bitop commands
1 parent 89b6476 commit 7fbc42a

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

bitmap_commands.go

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,38 +82,50 @@ func (c cmdable) bitOp(ctx context.Context, op, destKey string, keys ...string)
8282
return cmd
8383
}
8484

85+
// BitOpAnd creates a new bitmap in which users are members of all given bitmaps
8586
func (c cmdable) BitOpAnd(ctx context.Context, destKey string, keys ...string) *IntCmd {
8687
return c.bitOp(ctx, "and", destKey, keys...)
8788
}
8889

90+
// BitOpOr creates a new bitmap in which users are member of at least one given bitmap
8991
func (c cmdable) BitOpOr(ctx context.Context, destKey string, keys ...string) *IntCmd {
9092
return c.bitOp(ctx, "or", destKey, keys...)
9193
}
9294

95+
// BitOpXor creates a new bitmap in which users are the result of XORing all given bitmaps
9396
func (c cmdable) BitOpXor(ctx context.Context, destKey string, keys ...string) *IntCmd {
9497
return c.bitOp(ctx, "xor", destKey, keys...)
9598
}
9699

100+
// BitOpNot creates a new bitmap in which users are not members of a given bitmap
101+
func (c cmdable) BitOpNot(ctx context.Context, destKey string, key string) *IntCmd {
102+
return c.bitOp(ctx, "not", destKey, key)
103+
}
104+
105+
// BitOpDiff creates a new bitmap in which users are members of bitmap X but not of any of bitmaps Y1, Y2, …
106+
// Introduced with Redis 8.2
97107
func (c cmdable) BitOpDiff(ctx context.Context, destKey string, keys ...string) *IntCmd {
98108
return c.bitOp(ctx, "diff", destKey, keys...)
99109
}
100110

111+
// BitOpDiff1 creates a new bitmap in which users are members of one or more of bitmaps Y1, Y2, … but not members of bitmap X
112+
// Introduced with Redis 8.2
101113
func (c cmdable) BitOpDiff1(ctx context.Context, destKey string, keys ...string) *IntCmd {
102114
return c.bitOp(ctx, "diff1", destKey, keys...)
103115
}
104116

117+
// BitOpAndOr creates a new bitmap in which users are members of bitmap X and also members of one or more of bitmaps Y1, Y2, …
118+
// Introduced with Redis 8.2
105119
func (c cmdable) BitOpAndOr(ctx context.Context, destKey string, keys ...string) *IntCmd {
106120
return c.bitOp(ctx, "andor", destKey, keys...)
107121
}
108122

123+
// BitOpOne creates a new bitmap in which users are members of exactly one of the given bitmaps
124+
// Introduced with Redis 8.2
109125
func (c cmdable) BitOpOne(ctx context.Context, destKey string, keys ...string) *IntCmd {
110126
return c.bitOp(ctx, "one", destKey, keys...)
111127
}
112128

113-
func (c cmdable) BitOpNot(ctx context.Context, destKey string, key string) *IntCmd {
114-
return c.bitOp(ctx, "not", destKey, key)
115-
}
116-
117129
// BitPos is an API before Redis version 7.0, cmd: bitpos key bit start end
118130
// if you need the `byte | bit` parameter, please use `BitPosSpan`.
119131
func (c cmdable) BitPos(ctx context.Context, key string, bit int64, pos ...int64) *IntCmd {

0 commit comments

Comments
 (0)