refactor: rewrite project from Rust to Go

- Replace Axum with Chi router
- Replace sqlx with pgx for PostgreSQL
- Replace tonic/prost with grpc-go
- Replace tracing with zerolog
- Update flake.nix for Go build with protoc generation
- Preserve all existing endpoints and functionality

Stack: Chi, pgx, grpc-go, zerolog, yaml.v3
This commit is contained in:
Alexander
2026-04-29 10:45:05 +02:00
parent f24543f401
commit 41fb033d30
48 changed files with 2306 additions and 6652 deletions
+56
View File
@@ -0,0 +1,56 @@
package metadata
import (
"context"
"strings"
pb "github.com/fujin/music-agregator/pkg/metadatapb/metadata/v1"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
)
type Client struct {
conn *grpc.ClientConn
client pb.MetadataServiceClient
}
func NewClient(endpoint string) (*Client, error) {
endpoint = strings.TrimPrefix(endpoint, "http://")
endpoint = strings.TrimPrefix(endpoint, "https://")
conn, err := grpc.NewClient(endpoint, grpc.WithTransportCredentials(insecure.NewCredentials()))
if err != nil {
return nil, err
}
return &Client{
conn: conn,
client: pb.NewMetadataServiceClient(conn),
}, nil
}
func (c *Client) Close() error {
return c.conn.Close()
}
func (c *Client) SearchArtists(ctx context.Context, query string, limit, offset int32) (*pb.SearchArtistsResponse, error) {
return c.client.SearchArtists(ctx, &pb.SearchArtistsRequest{
Query: query,
Limit: limit,
Offset: offset,
})
}
func (c *Client) GetArtist(ctx context.Context, id string) (*pb.Artist, error) {
return c.client.GetArtist(ctx, &pb.GetArtistRequest{
Identifier: &pb.GetArtistRequest_Id{Id: id},
})
}
func (c *Client) GetArtistAlbums(ctx context.Context, artistID string, limit, offset int32) (*pb.GetArtistAlbumsResponse, error) {
return c.client.GetArtistAlbums(ctx, &pb.GetArtistAlbumsRequest{
ArtistId: artistID,
Limit: limit,
Offset: offset,
})
}