Skip to content

Commit

Permalink
Use aliases to make the sql statement shorter
Browse files Browse the repository at this point in the history
To improve readability use aliases to make the sql statement shorter.
  • Loading branch information
SimonRichardson committed Nov 28, 2023
1 parent ec2381f commit 79aca2d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion domain/objectstore/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ import "github.com/juju/errors"
// ErrHashAndSizeAlreadyExists is returned when a hash already exists, but
// the associated size is different. This should never happen, it means that
// there is a collision in the hash function.
const ErrHashAndSizeAlreadyExists = errors.ConstError("hash and size already exists")
const ErrHashAndSizeAlreadyExists = errors.ConstError("hash exists for different file size")
6 changes: 3 additions & 3 deletions domain/objectstore/state/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ func (s *State) GetMetadata(ctx context.Context, path string) (objectstore.Metad
}

query := `
SELECT path, metadata_uuid, object_store_metadata.size, object_store_metadata.hash
FROM object_store_metadata_path
LEFT JOIN object_store_metadata ON object_store_metadata_path.metadata_uuid = object_store_metadata.uuid
SELECT p.path, p.metadata_uuid, m.size, m.hash
FROM object_store_metadata_path p
LEFT JOIN object_store_metadata m ON p.metadata_uuid = m.uuid
WHERE path = ?`

var metadata objectstore.Metadata
Expand Down

0 comments on commit 79aca2d

Please sign in to comment.