githubstorage

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GitHubStoreQuery = `` /* 216-byte string literal not displayed */

)

queries.

Variables

This section is empty.

Functions

This section is empty.

Types

type GitHub

type GitHub struct {
	Payload        any
	Event          string
	TargetType     string
	UserLogin      string
	DeliveryID     uuid.UUID
	TargetID       uint64
	HookID         uint64
	UserID         int64
	KafkaOffset    int64
	KafkaPartition int32
}

GitHub represents `github` table model fields.

type GitHubStorage

type GitHubStorage struct {
	Logger      *slog.Logger
	Pool        storage.PGPooler
	DatabaseDSN string
}

GitHubStorage implements GitHubPingStorer interface.

func New

func New(ctx context.Context, options ...Option) (*GitHubStorage, error)

New instantiates new github storage.

func (GitHubStorage) MessageStore

func (s GitHubStorage) MessageStore(ctx context.Context, message *sarama.ConsumerMessage) error

MessageStore stores received kafka message to database.

func (GitHubStorage) Ping

func (s GitHubStorage) Ping(ctx context.Context, maxRetries uint8, backoff time.Duration) error

Ping pings database and makes sure db communication is ok.

type Option

type Option func(*GitHubStorage) error

Option represents option function type.

func WithDatabaseDSN

func WithDatabaseDSN(dsn string) Option

WithDatabaseDSN sets database data source.

func WithLogger

func WithLogger(l *slog.Logger) Option

WithLogger sets logger.

Jump to

Keyboard shortcuts

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