(key string, count int32, value interface{})
| 281 | } |
| 282 | |
| 283 | func (c *Client) LRem(key string, count int32, value interface{}) error { |
| 284 | client, err := newListGrpcClient(c.Addr) |
| 285 | if err != nil { |
| 286 | return errors.New("new grpc client error: " + err.Error()) |
| 287 | } |
| 288 | |
| 289 | req := &glist.GListLRemRequest{ |
| 290 | Key: key, |
| 291 | Count: count, |
| 292 | } |
| 293 | |
| 294 | switch v := value.(type) { |
| 295 | case string: |
| 296 | req.Value = &glist.GListLRemRequest_StringValue{StringValue: v} |
| 297 | case int32: |
| 298 | req.Value = &glist.GListLRemRequest_Int32Value{Int32Value: v} |
| 299 | case int64: |
| 300 | req.Value = &glist.GListLRemRequest_Int64Value{Int64Value: v} |
| 301 | case float32: |
| 302 | req.Value = &glist.GListLRemRequest_Float32Value{Float32Value: v} |
| 303 | case float64: |
| 304 | req.Value = &glist.GListLRemRequest_Float64Value{Float64Value: v} |
| 305 | case bool: |
| 306 | req.Value = &glist.GListLRemRequest_BoolValue{BoolValue: v} |
| 307 | case []byte: |
| 308 | req.Value = &glist.GListLRemRequest_BytesValue{BytesValue: v} |
| 309 | default: |
| 310 | return errors.New("unknown value type") |
| 311 | } |
| 312 | |
| 313 | _, err = client.LRem(context.Background(), req) |
| 314 | if err != nil { |
| 315 | return errors.New("client LRem failed: " + err.Error()) |
| 316 | } |
| 317 | return nil |
| 318 | } |
| 319 | |
| 320 | func (c *Client) LIndex(key string, index int) (interface{}, error) { |
| 321 | client, err := newListGrpcClient(c.Addr) |
nothing calls this directly
no test coverage detected