builder

package
v0.0.0-...-c2aaf4c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 11, 2021 License: BSD-3-Clause Imports: 20 Imported by: 0

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

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

func BuildPostgresConnPool(cfg config.Postgres) (*pgxpool.Pool, error)

BuildPostgresConnPool builds a SQL client.

func BuildRedisClient

func BuildRedisClient(cfg config.Redis) (*redis.Client, error)

BuildRedisClient builds a redis client.

func BuildRestServer

func BuildRestServer(restPort, grpcPort string, options ...grpc.DialOption) (*server.Rest, error)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL