Skip to content

Commit

Permalink
Merge pull request #10 from RTradeLtd/simplify
Browse files Browse the repository at this point in the history
Simplify Has, GetSize
  • Loading branch information
postables committed Jun 30, 2019
2 parents f14b92b + 8b4abd9 commit 5fd8d96
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions datastore.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,7 @@ func (d *Datastore) Has(key datastore.Key) (bool, error) {

// GetSize returns the size of the value referenced by key
func (d *Datastore) GetSize(key datastore.Key) (int, error) {
data, err := d.Get(key)
if err != nil {
return 0, err
}
return len(data), nil
return datastore.GetBackedSize(d, key)
}

// Query performs a complex search query on the underlying datastore
Expand Down

0 comments on commit 5fd8d96

Please sign in to comment.