style: fix code alignment and indentation consistency
- Correct indentation in goroutine leak test setup block - Align struct field tags in BookMatch and all matching methods for consistent column-style formatting (media_item_id, bookhoard_uuid, confidence, match_method) - Improves code readability and adheres to project indentation guidelines
This commit is contained in:
@@ -18,7 +18,7 @@ func TestGoroutineCleanup(t *testing.T) {
|
|||||||
t.Logf("Initial goroutine count: %d", initialGoroutines)
|
t.Logf("Initial goroutine count: %d", initialGoroutines)
|
||||||
|
|
||||||
// Start server
|
// Start server
|
||||||
setup := setupTestServer(t)
|
setup := setupTestServer(t)
|
||||||
defer setup.Close()
|
defer setup.Close()
|
||||||
|
|
||||||
// Wait for startup
|
// Wait for startup
|
||||||
|
|||||||
@@ -12,10 +12,10 @@ import (
|
|||||||
|
|
||||||
// BookMatch represents a potential match with confidence score
|
// BookMatch represents a potential match with confidence score
|
||||||
type BookMatch struct {
|
type BookMatch struct {
|
||||||
MediaItemID uuid.UUID `json:"media_item_id"`
|
MediaItemID uuid.UUID `json:"media_item_id"`
|
||||||
BookhoardUUID uuid.UUID `json:"bookhoard_uuid"`
|
BookhoardUUID uuid.UUID `json:"bookhoard_uuid"`
|
||||||
Confidence float64 `json:"confidence"`
|
Confidence float64 `json:"confidence"`
|
||||||
MatchMethod string `json:"match_method"`
|
MatchMethod string `json:"match_method"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// BookQueryRequest represents a book query from a device
|
// BookQueryRequest represents a book query from a device
|
||||||
@@ -128,10 +128,10 @@ func (s *BookMatchingService) matchByBookhoardUUID(ctx context.Context, identifi
|
|||||||
if err == nil {
|
if err == nil {
|
||||||
mediaUUID := item.ID.Bytes
|
mediaUUID := item.ID.Bytes
|
||||||
return &BookMatch{
|
return &BookMatch{
|
||||||
MediaItemID: mediaUUID,
|
MediaItemID: mediaUUID,
|
||||||
BookhoardUUID: mediaUUID,
|
BookhoardUUID: mediaUUID,
|
||||||
Confidence: 1.0,
|
Confidence: 1.0,
|
||||||
MatchMethod: "uuid_match",
|
MatchMethod: "uuid_match",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -155,10 +155,10 @@ func (s *BookMatchingService) matchByOPFUUID(ctx context.Context, identifiers []
|
|||||||
for _, item := range items {
|
for _, item := range items {
|
||||||
if item.OpfUuid.Valid && item.OpfUuid.String == uuidStr {
|
if item.OpfUuid.Valid && item.OpfUuid.String == uuidStr {
|
||||||
return &BookMatch{
|
return &BookMatch{
|
||||||
MediaItemID: item.ID.Bytes,
|
MediaItemID: item.ID.Bytes,
|
||||||
BookhoardUUID: item.ID.Bytes,
|
BookhoardUUID: item.ID.Bytes,
|
||||||
Confidence: 0.95,
|
Confidence: 0.95,
|
||||||
MatchMethod: "opf_uuid_match",
|
MatchMethod: "opf_uuid_match",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -180,10 +180,10 @@ func (s *BookMatchingService) matchBySHA256(ctx context.Context, sha256 string)
|
|||||||
for _, item := range items {
|
for _, item := range items {
|
||||||
if item.FileSha256.Valid && item.FileSha256.String == sha256 {
|
if item.FileSha256.Valid && item.FileSha256.String == sha256 {
|
||||||
return &BookMatch{
|
return &BookMatch{
|
||||||
MediaItemID: item.ID.Bytes,
|
MediaItemID: item.ID.Bytes,
|
||||||
BookhoardUUID: item.ID.Bytes,
|
BookhoardUUID: item.ID.Bytes,
|
||||||
Confidence: 0.9,
|
Confidence: 0.9,
|
||||||
MatchMethod: "sha256_match",
|
MatchMethod: "sha256_match",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -206,10 +206,10 @@ func (s *BookMatchingService) matchByOPFIdentifier(ctx context.Context, identifi
|
|||||||
for _, item := range items {
|
for _, item := range items {
|
||||||
if item.OpfIdentifier.Valid && item.OpfIdentifier.String == identifier {
|
if item.OpfIdentifier.Valid && item.OpfIdentifier.String == identifier {
|
||||||
return &BookMatch{
|
return &BookMatch{
|
||||||
MediaItemID: item.ID.Bytes,
|
MediaItemID: item.ID.Bytes,
|
||||||
BookhoardUUID: item.ID.Bytes,
|
BookhoardUUID: item.ID.Bytes,
|
||||||
Confidence: 0.85,
|
Confidence: 0.85,
|
||||||
MatchMethod: "opf_identifier_match",
|
MatchMethod: "opf_identifier_match",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -234,10 +234,10 @@ func (s *BookMatchingService) matchByISBNASIN(ctx context.Context, identifiers [
|
|||||||
for _, item := range items {
|
for _, item := range items {
|
||||||
if item.Isbn.Valid && item.Isbn.String == isbn {
|
if item.Isbn.Valid && item.Isbn.String == isbn {
|
||||||
return &BookMatch{
|
return &BookMatch{
|
||||||
MediaItemID: item.ID.Bytes,
|
MediaItemID: item.ID.Bytes,
|
||||||
BookhoardUUID: item.ID.Bytes,
|
BookhoardUUID: item.ID.Bytes,
|
||||||
Confidence: 0.8,
|
Confidence: 0.8,
|
||||||
MatchMethod: "isbn_match",
|
MatchMethod: "isbn_match",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -256,10 +256,10 @@ func (s *BookMatchingService) matchByISBNASIN(ctx context.Context, identifiers [
|
|||||||
for _, item := range items {
|
for _, item := range items {
|
||||||
if item.Asin.Valid && item.Asin.String == asin {
|
if item.Asin.Valid && item.Asin.String == asin {
|
||||||
return &BookMatch{
|
return &BookMatch{
|
||||||
MediaItemID: item.ID.Bytes,
|
MediaItemID: item.ID.Bytes,
|
||||||
BookhoardUUID: item.ID.Bytes,
|
BookhoardUUID: item.ID.Bytes,
|
||||||
Confidence: 0.8,
|
Confidence: 0.8,
|
||||||
MatchMethod: "asin_match",
|
MatchMethod: "asin_match",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -292,10 +292,10 @@ func (s *BookMatchingService) matchByTitleAuthorSize(ctx context.Context, title,
|
|||||||
|
|
||||||
if titleMatch && authorMatch && sizeMatch {
|
if titleMatch && authorMatch && sizeMatch {
|
||||||
matches = append(matches, BookMatch{
|
matches = append(matches, BookMatch{
|
||||||
MediaItemID: item.ID.Bytes,
|
MediaItemID: item.ID.Bytes,
|
||||||
BookhoardUUID: item.ID.Bytes,
|
BookhoardUUID: item.ID.Bytes,
|
||||||
Confidence: 0.5,
|
Confidence: 0.5,
|
||||||
MatchMethod: "title_author_size_match",
|
MatchMethod: "title_author_size_match",
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -318,10 +318,10 @@ func (s *BookMatchingService) matchByTitleOnly(ctx context.Context, title string
|
|||||||
for _, item := range items {
|
for _, item := range items {
|
||||||
if item.Title == title {
|
if item.Title == title {
|
||||||
matches = append(matches, BookMatch{
|
matches = append(matches, BookMatch{
|
||||||
MediaItemID: item.ID.Bytes,
|
MediaItemID: item.ID.Bytes,
|
||||||
BookhoardUUID: item.ID.Bytes,
|
BookhoardUUID: item.ID.Bytes,
|
||||||
Confidence: 0.3,
|
Confidence: 0.3,
|
||||||
MatchMethod: "title_match",
|
MatchMethod: "title_match",
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user