extensions

package
v3.0.3+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2018 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRedis

func NewRedis(prefix string, conf *viper.Viper, logger zap.Logger) (*redis.Client, error)

NewRedis connection with the specified configuration

func NewS3

func NewS3(conf *viper.Viper, logger zap.Logger) (s3iface.S3API, error)

NewS3 client with the specified configuration

func S3GetObject

func S3GetObject(client s3iface.S3API, path string) ([]byte, error)

S3GetObject gets an object from s3

func S3PutObject

func S3PutObject(conf *viper.Viper, client s3iface.S3API, path string, body *[]byte) error

S3PutObject puts an object into s3

func S3PutObjectRequest

func S3PutObjectRequest(conf *viper.Viper, client s3iface.S3API, key string) (string, error)

S3PutObjectRequest return a presigned url for uploading a file to 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

func NewKafkaProducer(config *viper.Viper, logger zap.Logger) (*KafkaProducer, error)

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

type PGClient struct {
	Config *viper.Viper
	DB     interfaces.DB
	Logger zap.Logger
}

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) Close

func (c *PGClient) Close() error

Close the connections to PG

func (*PGClient) Connect

func (c *PGClient) Connect(prefix string, PGOrNil ...interfaces.DB) error

Connect to PG

func (*PGClient) IsConnected

func (c *PGClient) IsConnected() bool

IsConnected determines if the client is connected to PG

func (*PGClient) WaitForConnection

func (c *PGClient) WaitForConnection(timeout int) error

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

type SendgridClient struct {
	Config *viper.Viper
	Logger zap.Logger
	APIKey string
}

SendgridClient is the struct that keeps sendgrid info

func NewSendgridClient

func NewSendgridClient(config *viper.Viper, logger zap.Logger, apiKey string) *SendgridClient

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

Jump to

Keyboard shortcuts

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