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

feat: read cells-per-row option. #94

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from 2 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
10 changes: 9 additions & 1 deletion cbt.go
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,7 @@ var commands = []struct {
" columns=<family>:<qualifier>,... Read only these columns, comma-separated\n" +
" count=<n> Read only this many rows\n" +
" cells-per-column=<n> Read only this many cells per column\n" +
" cells-per-row=<n> Read only this many cells per row\n" +
" app-profile=<app-profile-id> The app profile ID to use for the request\n" +
" format-file=<path-to-format-file> The path to a format-configuration file to use for the request\n" +
"\n" +
Expand Down Expand Up @@ -1328,7 +1329,7 @@ func doRead(ctx context.Context, args ...string) {

parsed, err := parseArgs(args[1:], []string{
"start", "end", "prefix", "columns", "count",
"cells-per-column", "regex", "app-profile", "limit",
"cells-per-column", "cells-per-row", "regex", "app-profile", "limit",
"format-file",
"keys-only",
})
Expand Down Expand Up @@ -1370,6 +1371,13 @@ func doRead(ctx context.Context, args ...string) {
}
filters = append(filters, bigtable.LatestNFilter(n))
}
if cellsPerRow := parsed["cells-per-row"]; cellsPerRow != "" {
n, err := strconv.Atoi(cellsPerRow)
if err != nil {
log.Fatalf("Bad number of cells per row %q: %v", cellsPerRow, err)
}
filters = append(filters, bigtable.CellsPerRowLimitFilter(n))
}
if regex := parsed["regex"]; regex != "" {
filters = append(filters, bigtable.RowKeyFilter(regex))
}
Expand Down