diff options
| author | Paul Buetow <paul@buetow.org> | 2026-03-06 17:32:24 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-03-06 17:32:24 +0200 |
| commit | 1561987330cb898f5ff64383a9c78e7e6559f118 (patch) | |
| tree | 69a823e8f98dce572566c97e6879c11c9d591bda /internal/collapse | |
| parent | 96225fb6159212a8851043a08d781aba721b4e78 (diff) | |
| parent | 110a193e04b81abb8d8e159abd73f9f6ed1acd7e (diff) | |
Merge branch 'feat/bubbletea-v2-migration'
Diffstat (limited to 'internal/collapse')
| -rw-r--r-- | internal/collapse/fields.go | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/internal/collapse/fields.go b/internal/collapse/fields.go new file mode 100644 index 0000000..b87fe11 --- /dev/null +++ b/internal/collapse/fields.go @@ -0,0 +1,39 @@ +package collapse + +import "slices" + +var validFields = []string{ + "path", + "comm", + "tracepoint", + "pid", + "tid", + "flags", +} + +var validCountFields = []string{ + "count", + "duration", + "durationToPrev", + "bytes", +} + +// ValidFields returns a copy of supported collapse fields. +func ValidFields() []string { + return slices.Clone(validFields) +} + +// ValidCountFields returns a copy of supported collapse count fields. +func ValidCountFields() []string { + return slices.Clone(validCountFields) +} + +// IsValidField reports whether a collapse field is supported. +func IsValidField(field string) bool { + return slices.Contains(validFields, field) +} + +// IsValidCountField reports whether a collapse count field is supported. +func IsValidCountField(field string) bool { + return slices.Contains(validCountFields, field) +} |
