Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: correct flag value type in delete, import, and write #389

Merged
merged 2 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cmd/store/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,8 @@ var importCmd = &cobra.Command{
func init() {
importCmd.Flags().String("file", "", "File Name. The file should have the store")
importCmd.Flags().String("store-id", "", "Store ID")
importCmd.Flags().Int("max-tuples-per-write", tuple.MaxTuplesPerWrite, "Max tuples per write chunk.")
importCmd.Flags().Int("max-parallel-requests", tuple.MaxParallelRequests, "Max number of requests to issue to the server in parallel.") //nolint:lll
importCmd.Flags().Int32("max-tuples-per-write", tuple.MaxTuplesPerWrite, "Max tuples per write chunk.")
importCmd.Flags().Int32("max-parallel-requests", tuple.MaxParallelRequests, "Max number of requests to issue to the server in parallel.") //nolint:lll

if err := importCmd.MarkFlagRequired("file"); err != nil {
fmt.Printf("error setting flag as required - %v: %v\n", "cmd/models/write", err)
Expand Down
4 changes: 2 additions & 2 deletions cmd/tuple/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ var deleteCmd = &cobra.Command{
func init() {
deleteCmd.Flags().String("file", "", "Tuples file")
deleteCmd.Flags().String("model-id", "", "Model ID")
deleteCmd.Flags().Int("max-tuples-per-write", MaxTuplesPerWrite, "Max tuples per write chunk.")
deleteCmd.Flags().Int("max-parallel-requests", MaxParallelRequests, "Max number of requests to issue to the server in parallel.") //nolint:lll
deleteCmd.Flags().Int32("max-tuples-per-write", MaxTuplesPerWrite, "Max tuples per write chunk.")
deleteCmd.Flags().Int32("max-parallel-requests", MaxParallelRequests, "Max number of requests to issue to the server in parallel.") //nolint:lll
}

func ExactArgsOrFlag(n int, flag string) cobra.PositionalArgs {
Expand Down
14 changes: 8 additions & 6 deletions cmd/tuple/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@ import (
"github.com/openfga/cli/internal/output"
)

// MaxTuplesPerWrite Limit the tuples in a single batch.
var MaxTuplesPerWrite = 1
const (
// MaxTuplesPerWrite Limit the tuples in a single batch.
MaxTuplesPerWrite = 1

// MaxParallelRequests Limit the parallel writes to the API.
var MaxParallelRequests = 10
// MaxParallelRequests Limit the parallel writes to the API.
MaxParallelRequests = 10
)

type failedWriteResponse struct {
TupleKey client.ClientTupleKey `json:"tuple_key"`
Expand Down Expand Up @@ -206,6 +208,6 @@ var importCmd = &cobra.Command{
func init() {
importCmd.Flags().String("model-id", "", "Model ID")
importCmd.Flags().String("file", "", "Tuples file")
importCmd.Flags().Int("max-tuples-per-write", MaxTuplesPerWrite, "Max tuples per write chunk.")
importCmd.Flags().Int("max-parallel-requests", MaxParallelRequests, "Max number of requests to issue to the server in parallel.") //nolint:lll
importCmd.Flags().Int32("max-tuples-per-write", MaxTuplesPerWrite, "Max tuples per write chunk.")
importCmd.Flags().Int32("max-parallel-requests", MaxParallelRequests, "Max number of requests to issue to the server in parallel.") //nolint:lll
}
4 changes: 2 additions & 2 deletions cmd/tuple/write.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,6 @@ func init() {
writeCmd.Flags().String("file", "", "Tuples file")
writeCmd.Flags().String("condition-name", "", "Condition Name")
writeCmd.Flags().String("condition-context", "", "Condition Context (as a JSON string)")
writeCmd.Flags().Int("max-tuples-per-write", MaxTuplesPerWrite, "Max tuples per write chunk.")
writeCmd.Flags().Int("max-parallel-requests", MaxParallelRequests, "Max number of requests to issue to the server in parallel.")
writeCmd.Flags().Int32("max-tuples-per-write", MaxTuplesPerWrite, "Max tuples per write chunk.")
writeCmd.Flags().Int32("max-parallel-requests", MaxParallelRequests, "Max number of requests to issue to the server in parallel.")
}
Loading