Documentation
¶
Index ¶
- func AnalyticsStorePackage(i *do.Injector)
- func ConsumerGroupPackage(i *do.Injector)
- func HTTPPackage(i *do.Injector)
- func LoggerPackage(i *do.Injector)
- func PostgresPackage(i *do.Injector)
- func PublisherGroupPackage(i *do.Injector)
- func RateLimitPackage(i *do.Injector)
- func RedisPackage(i *do.Injector)
- func RepositoryPackage(i *do.Injector)
- type Options
- type PostgresPool
- type RedisClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AnalyticsStorePackage ¶
AnalyticsStorePackage provides the analytics store for persisting events.
func ConsumerGroupPackage ¶
ConsumerGroupPackage provides the consumer group with all registered consumers.
func HTTPPackage ¶
HTTPPackage provides the router, API, and registers routes.
func PostgresPackage ¶
PostgresPackage provides the PostgreSQL connection pool.
func PublisherGroupPackage ¶
PublisherGroupPackage provides the publisher group for event publishing.
func RateLimitPackage ¶
RateLimitPackage provides the rate limit store.
func RepositoryPackage ¶
RepositoryPackage provides the URL repository with Redis caching over PostgreSQL.
Types ¶
type Options ¶
type Options struct {
Port int `default:"8888" help:"Port to listen on" short:"p"`
CodeLength int `default:"8" help:"Short code length" short:"c"`
RedisAddr string `default:"localhost:6379" help:"Redis address" short:"r"`
DatabaseURL string `env:"DATABASE_URL" help:"PostgreSQL URL" required:""`
RateLimitStore string `default:"memory" env:"RATE_LIMIT_STORE" help:"memory or redis"`
CacheSize int `default:"1000" env:"CACHE_SIZE" help:"LRU cache size (0=off)"`
CacheTTL time.Duration `default:"1h" env:"CACHE_TTL" help:"Redis cache TTL"`
LogFormat string `default:"console" env:"LOG_FORMAT" help:"console or json"`
TopicURLCreated string `default:"url.created" env:"TOPIC_URL_CREATED" help:"URL created topic"`
TopicURLAccessed string `default:"url.accessed" env:"TOPIC_URL_ACCESSED" help:"URL accessed topic"`
ConsumerGroup string `default:"analytics" env:"CONSUMER_GROUP" help:"Consumer group name"`
// Rate limit configuration per scope
RateLimitGlobalPerDay int64 `default:"1000000" env:"RATE_LIMIT_GLOBAL_DAY" help:"Global requests per day"`
RateLimitReadPerMinute int64 `default:"100000" env:"RATE_LIMIT_READ_MINUTE" help:"Read requests per minute"`
RateLimitWritePerMinute int64 `default:"10" env:"RATE_LIMIT_WRITE_MINUTE" help:"Write requests per minute"`
RateLimitWritePerHour int64 `default:"100" env:"RATE_LIMIT_WRITE_HOUR" help:"Write requests per hour"`
RateLimitWritePerDay int64 `default:"500" env:"RATE_LIMIT_WRITE_DAY" help:"Write requests per day"`
}
type PostgresPool ¶
PostgresPool wraps pgxpool.Pool to implement Shutdownable for do.Injector.
func (*PostgresPool) Shutdown ¶
func (p *PostgresPool) Shutdown() error
Shutdown implements do.Shutdownable.
type RedisClient ¶
RedisClient wraps redis.Client to implement Shutdownable for do.Injector.
func (*RedisClient) Shutdown ¶
func (r *RedisClient) Shutdown() error
Shutdown implements do.Shutdownable.