Skip to content

Commit

Permalink
Fix cli handling of CreateMany
Browse files Browse the repository at this point in the history
  • Loading branch information
islamaliev committed Jul 2, 2024
1 parent 225eedf commit 592dfdb
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions tests/clients/cli/wrapper_collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,21 +96,22 @@ func (c *Collection) CreateMany(
args := []string{"client", "collection", "create"}
args = append(args, "--name", c.Description().Name.Value())

docMapList := make([]map[string]any, len(docs))
encConf := encryption.GetContextConfig(ctx)
if encConf.HasValue() && encConf.Value().IsEncrypted {
args = append(args, "--encrypt")
}

docStrings := make([]string, len(docs))
for i, doc := range docs {
docMap, err := doc.ToMap()
docStr, err := doc.String()
if err != nil {
return err
}
docMapList[i] = docMap
docStrings[i] = docStr
}
documents, err := json.Marshal(docMapList)
if err != nil {
return err
}
args = append(args, string(documents))
args = append(args, "["+strings.Join(docStrings, ",")+"]")

_, err = c.cmd.execute(ctx, args)
_, err := c.cmd.execute(ctx, args)
if err != nil {
return err
}
Expand Down

0 comments on commit 592dfdb

Please sign in to comment.