-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
35 lines (29 loc) · 841 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package main
import (
"context"
"github.com/redis/go-redis/v9"
"log"
"redisjson4gophers/logic"
)
func main() {
ctx := context.Background()
redisClient, err := logic.ConnectWithRedis(ctx)
if err != nil {
log.Fatalf("Error connecting with Redis: %v", err)
}
defer func(redisClient *redis.Client) {
err := redisClient.Close()
if err != nil {
log.Fatalf("Error closing the Redis connection: %v", err)
}
}(redisClient)
logic.CreateMoviesIndexOnRedis(ctx, redisClient)
movies, err := logic.LoadMoviesFromFile("movies.json")
if err != nil {
log.Fatalf("Error loading movies from file: %v", err)
}
logic.IndexMoviesAsDocuments(ctx, redisClient, movies)
logic.LookupMovieTitleByMovieKey(ctx, redisClient, len(movies))
logic.MovieCountPerGenreAgg(ctx, redisClient)
logic.SearchBestMatrixMovies(ctx, redisClient)
}