Skip to content

Commit

Permalink
feedback(gen): Responded to PR feedback
Browse files Browse the repository at this point in the history
* renamed files to snake_case
* unexport `Series` interface and rename for clarity
  • Loading branch information
stuartcarnie committed Mar 20, 2019
1 parent 8669e94 commit 5b2e467
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions pkg/data/gen/series.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"bytes"
)

type Series interface {
type seriesKeyField interface {
// Key returns the series key.
// The returned value may be cached.
Key() []byte
Expand All @@ -22,13 +22,13 @@ type constSeries struct {
func (s *constSeries) Key() []byte { return s.key }
func (s *constSeries) Field() []byte { return s.field }

var nilSeries Series = &constSeries{}
var nilSeries seriesKeyField = &constSeries{}

// Compare returns an integer comparing two SeriesGenerator instances
// lexicographically.
// The result will be 0 if a==b, -1 if a < b, and +1 if a > b.
// A nil argument is equivalent to an empty SeriesGenerator.
func CompareSeries(a, b Series) int {
func CompareSeries(a, b seriesKeyField) int {
if a == nil {
a = nilSeries
}
Expand All @@ -44,7 +44,7 @@ func CompareSeries(a, b Series) int {
}
}

func (s *constSeries) CopyFrom(a Series) {
func (s *constSeries) CopyFrom(a seriesKeyField) {
key := a.Key()
if cap(s.key) < len(key) {
s.key = make([]byte, len(key))
Expand Down
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions pkg/data/gen/series_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ import (
)

func TestCompareSeries(t *testing.T) {
mk := func(k, f string) Series {
mk := func(k, f string) seriesKeyField {
return &constSeries{key: []byte(k), field: []byte(f)}
}

tests := []struct {
name string
a Series
b Series
a seriesKeyField
b seriesKeyField
exp int
}{
{
Expand Down

0 comments on commit 5b2e467

Please sign in to comment.