Documentation ¶
Overview ¶
Package builder provides functionality to build the representative flows. Imagine this package as an implementation of builder design pattern. Read more: https://sourcemaking.com/design_patterns/builder.
Index ¶
- func BuildGRPCHealthChecker(pool *pgxpool.Pool, rds redis.Cmdable) *handler.HealthChecker
- func BuildGRPCServer(port string, shortener *handler.URLShortener, health *handler.HealthChecker, ...) (*server.GRPC, error)
- func BuildGRPCURLShortener(pool *pgxpool.Pool, rds redis.Cmdable, domain string) *handler.URLShortener
- func BuildPostgresConnPool(cfg config.Postgres) (*pgxpool.Pool, error)
- func BuildRedisClient(cfg config.Redis) (*redis.Client, error)
- func BuildRestServer(restPort, grpcPort string, options ...grpc.DialOption) (*server.Rest, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildGRPCHealthChecker ¶
func BuildGRPCHealthChecker(pool *pgxpool.Pool, rds redis.Cmdable) *handler.HealthChecker
BuildGRPCHealthChecker builds HealthChecker handler together with all of its dependencies.
func BuildGRPCServer ¶
func BuildGRPCServer(port string, shortener *handler.URLShortener, health *handler.HealthChecker, options ...grpc.ServerOption) (*server.GRPC, error)
BuildGRPCServer builds gRPC server along with all services that needs it. For this project, the services are URL Shortener and Health Checker. It also sets the Prometheus and Zap Logger.
func BuildGRPCURLShortener ¶
func BuildGRPCURLShortener(pool *pgxpool.Pool, rds redis.Cmdable, domain string) *handler.URLShortener
BuildGRPCURLShortener builds URLShortener handler together with all of its dependencies.
func BuildPostgresConnPool ¶
BuildPostgresConnPool builds a SQL client.
func BuildRedisClient ¶
BuildRedisClient builds a redis client.
func BuildRestServer ¶
BuildRestServer builds REST server along with all services that needs it. For this project, there is only one service: URL Shortener. Health Checker service is not included because it will only run on gRPC port. It also sets the Prometheus endpoint in /metrics.
Types ¶
This section is empty.