mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-07 09:05:55 +00:00
change translateFieldKeys to variadic function
This commit is contained in:
parent
d06ffd207f
commit
3e4f7dd3f3
2 changed files with 4 additions and 4 deletions
4
api.go
4
api.go
|
|
@ -966,7 +966,7 @@ func (api *API) Import(ctx context.Context, req *ImportRequest, opts ...ImportOp
|
|||
if len(req.RowIDs) != 0 {
|
||||
return errors.New("row ids cannot be used because field uses string keys")
|
||||
}
|
||||
if req.RowIDs, err = api.cluster.translateFieldKeys(ctx, field, req.RowKeys); err != nil {
|
||||
if req.RowIDs, err = api.cluster.translateFieldKeys(ctx, field, req.RowKeys...); err != nil {
|
||||
return errors.Wrapf(err, "translating field keys")
|
||||
}
|
||||
}
|
||||
|
|
@ -1479,7 +1479,7 @@ func (api *API) TranslateKeys(ctx context.Context, r io.Reader) (_ []byte, err e
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
} else if ids, err = api.cluster.translateFieldKeys(ctx, field, req.Keys); err != nil {
|
||||
} else if ids, err = api.cluster.translateFieldKeys(ctx, field, req.Keys...); err != nil {
|
||||
return nil, errors.Wrapf(err, "translating field keys")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2087,7 +2087,7 @@ func (c *cluster) setStatic(hosts []string) error {
|
|||
|
||||
// translateFieldKey gets a single key from translateFieldKeys.
|
||||
func (c *cluster) translateFieldKey(ctx context.Context, field *Field, key string) (uint64, error) {
|
||||
ids, err := c.translateFieldKeys(ctx, field, []string{key})
|
||||
ids, err := c.translateFieldKeys(ctx, field, key)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
} else if len(ids) == 0 {
|
||||
|
|
@ -2102,7 +2102,7 @@ func (c *cluster) translateFieldKey(ctx context.Context, field *Field, key strin
|
|||
// is read-only (i.e. it's not the primary translate
|
||||
// store), then this method will forward the translation
|
||||
// request to the coordinator.
|
||||
func (c *cluster) translateFieldKeys(ctx context.Context, field *Field, keys []string) ([]uint64, error) {
|
||||
func (c *cluster) translateFieldKeys(ctx context.Context, field *Field, keys ...string) ([]uint64, error) {
|
||||
ids, err := field.TranslateStore().TranslateKeys(keys)
|
||||
// If we get a "read only" error, then forward the request
|
||||
// to the coordinator.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue