Skip to content
Merged
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
12 changes: 12 additions & 0 deletions repository/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,18 @@ func (r *Repository) ReadLast(ctx context.Context, key string) (*data.Set, error
return r.read(ctx, key, bigtable.RowFilter(bigtable.LatestNFilter(1)))
}

// ReadRow reads a row from the repository while returning the cell values after
// mapping it to a data.Set. This method takes a row key as an argument, uses its internal adapter
// to read the row from Big Table, parses only the cells contained in the row to turn it into
// a map of data.Event and finally returns the data.Set that contains all the events.
func (r *Repository) ReadRow(ctx context.Context, key string, opts ...bigtable.ReadOption) (*data.Set, error) {
row, err := r.adapter.ReadRow(ctx, key, opts...)
if err != nil {
return nil, err
}
return buildEventSet([]bigtable.Row{row}, r.mapper), nil
}

func (r *Repository) read(ctx context.Context, key string, opts ...bigtable.ReadOption) (*data.Set, error) {
row, err := r.adapter.ReadRow(ctx, key, opts...)
if err != nil {
Expand Down