Documentation ¶
Index ¶
- func GenerateFakeID(size int) string
- func GenerateID(size int) string
- func NewRedis(prefix string, conf *viper.Viper, logger zap.Logger) (*redis.Client, error)
- func NewS3(conf *viper.Viper, logger zap.Logger) (s3iface.S3API, error)
- func S3GetObject(client s3iface.S3API, path string) ([]byte, error)
- func S3PutObject(conf *viper.Viper, client s3iface.S3API, path string, body *[]byte) error
- func S3PutObjectRequest(conf *viper.Viper, client s3iface.S3API, key string) (string, error)
- type KafkaConsumer
- type KafkaProducer
- type PGClient
- type RedisConnectionError
- type SendgridClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateFakeID ¶
GenerateFakeID generates an id with a FAKE- prefix
func S3GetObject ¶
S3GetObject gets an object from s3
func S3PutObject ¶
S3PutObject puts an object into s3
Types ¶
type KafkaConsumer ¶ added in v1.0.0
type KafkaConsumer struct { Brokers string Config *viper.Viper Consumer interfaces.KafkaConsumerClient ConsumerGroup string Logger zap.Logger FetchWaitMaxMs int FetchMinBytes int OffsetResetStrategy string SessionTimeout int Topics []string HandleAllMessagesBeforeExiting bool // contains filtered or unexported fields }
KafkaConsumer for getting push requests
func NewKafkaConsumer ¶ added in v1.0.0
func NewKafkaConsumer( config *viper.Viper, logger zap.Logger, stopChannel *chan struct{}, clientOrNil ...interfaces.KafkaConsumerClient, ) (*KafkaConsumer, error)
NewKafkaConsumer for creating a new KafkaConsumer instance
func (*KafkaConsumer) Cleanup ¶ added in v1.0.0
func (q *KafkaConsumer) Cleanup() error
Cleanup closes kafka consumer connection
func (*KafkaConsumer) ConsumeLoop ¶ added in v1.0.0
func (q *KafkaConsumer) ConsumeLoop() error
ConsumeLoop consume messages from the queue and put in messages to send channel
func (*KafkaConsumer) MessagesChannel ¶ added in v1.0.0
func (q *KafkaConsumer) MessagesChannel() *chan []byte
MessagesChannel returns the channel that will receive all messages got from kafka
func (*KafkaConsumer) PendingMessagesWaitGroup ¶ added in v1.0.0
func (q *KafkaConsumer) PendingMessagesWaitGroup() *sync.WaitGroup
PendingMessagesWaitGroup returns the waitGroup that is incremented every time a push is consumed
func (*KafkaConsumer) StopConsuming ¶ added in v1.0.0
func (q *KafkaConsumer) StopConsuming()
StopConsuming stops consuming messages from the queue
type KafkaProducer ¶ added in v1.0.0
type KafkaProducer struct { Config *viper.Viper ConfigPath string Logger zap.Logger BootstrapBrokers string BatchSize int LingerMS int Producer *kafka.Producer }
KafkaProducer is the struct that connects to Kafka
func NewKafkaProducer ¶ added in v1.0.0
NewKafkaProducer creates a new kafka producer
func (*KafkaProducer) Close ¶ added in v1.0.0
func (c *KafkaProducer) Close()
Close the connections to kafka
func (*KafkaProducer) SendAPNSPush ¶ added in v1.0.0
func (c *KafkaProducer) SendAPNSPush(topic, deviceToken string, payload, messageMetadata map[string]interface{}, pushMetadata map[string]interface{}, pushExpiry int64, templateName string) error
SendAPNSPush notification to Kafka
func (*KafkaProducer) SendGCMPush ¶ added in v1.0.0
func (c *KafkaProducer) SendGCMPush(topic, deviceToken string, payload, messageMetadata map[string]interface{}, pushMetadata map[string]interface{}, pushExpiry int64, templateName string) error
SendGCMPush notification to Kafka
type PGClient ¶
PGClient is the struct that connects to PostgreSQL
func NewPGClient ¶
func NewPGClient(prefix string, config *viper.Viper, logger zap.Logger, PGOrNil ...interfaces.DB) (*PGClient, error)
NewPGClient creates a new client
func (*PGClient) Connect ¶
func (c *PGClient) Connect(prefix string, PGOrNil ...interfaces.DB) error
Connect to PG
func (*PGClient) IsConnected ¶
IsConnected determines if the client is connected to PG
func (*PGClient) WaitForConnection ¶
WaitForConnection loops until postgres is connected
type RedisConnectionError ¶
type RedisConnectionError struct {
SourceError error
}
RedisConnectionError with SourceError that originated the connection failure
func (*RedisConnectionError) Error ¶
func (e *RedisConnectionError) Error() string
type SendgridClient ¶
SendgridClient is the struct that keeps sendgrid info
func NewSendgridClient ¶
NewSendgridClient creates a new client
func (*SendgridClient) LoadDefaults ¶
func (c *SendgridClient) LoadDefaults()
LoadDefaults sets default values for keys needed by this module
func (*SendgridClient) SendgridSendEmail ¶
func (c *SendgridClient) SendgridSendEmail(addressee, subject, message string, skipBlacklist bool) error
SendgridSendEmail sends an email with the given message and addressee