client

package
v0.0.0-...-40ea64e Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2024 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BackupMessageReadWriter

type BackupMessageReadWriter interface {
	BackupMessageSender
	BackupMessageRemover
}

BackupMessageReadWriter reads and writes the backup message.

type BackupMessageRemover

type BackupMessageRemover interface {
	// Remove removes the message
	Remove(req *apiv1.NotificationRequest) error
}

BackupMessageRemover removes the message

type BackupMessageSender

type BackupMessageSender interface {
	// Send sends the message
	Send(req *apiv1.NotificationRequest) error

	// GetIdleKeyVals gets the idle keys
	GetIdleKeys(ctx context.Context, over time.Duration) ([]string, error)

	// GetVal gets the value
	GetVal(key string) (*apiv1.NotificationRequest, error)
}

BackupMessageSender sends the message to a destination

type DBClient

type DBClient struct {
	// contains filtered or unexported fields
}

DBClient is the database client for all databases

func NewDBClient

func NewDBClient(username, password, location string, port int) *DBClient

NewDBClient creates a new client and connects to the database. This connection is reusable but it has to be closed. TODO: use config.DB instead, we can also add a connection pool (SetMaxIdleConns, SetMaxOpenConns, SetConnMaxLifetime)

func (*DBClient) Close

func (dbc *DBClient) Close() error

TODO: code duplication Close closes the database connection.

func (*DBClient) GetNotificationsDB

func (dbc *DBClient) GetNotificationsDB() *gorm.DB

func (*DBClient) GetUsersDB

func (dbc *DBClient) GetUsersDB() *gorm.DB

type RedisBackup

type RedisBackup struct {
	// contains filtered or unexported fields
}

RedisBackup is used to read and write backup messages

func NewRedisBackup

func NewRedisBackup(endpoint, password string, db int) *RedisBackup

NewRedisBackup creates a new RedisBackup

func (*RedisBackup) GetIdleKeys

func (rb *RedisBackup) GetIdleKeys(ctx context.Context, over time.Duration) ([]string, error)

GetIdleKeys gets the idle keys

func (*RedisBackup) GetVal

func (rb *RedisBackup) GetVal(key string) (*apiv1.NotificationRequest, error)

GetVal gets the value given a key

func (*RedisBackup) Remove

func (rb *RedisBackup) Remove(req *apiv1.NotificationRequest) error

Remove removes the message

func (*RedisBackup) Send

func (rb *RedisBackup) Send(req *apiv1.NotificationRequest) error

Send sends the message

type RedisTemplate

type RedisTemplate struct {
	// contains filtered or unexported fields
}

RedisTemplate is used to read and write templates

func NewRedisTemplate

func NewRedisTemplate(endpoint, password string, db int) *RedisTemplate

NewRedisTemplate creates a new RedisTemplate

func (*RedisTemplate) Read

func (rt *RedisTemplate) Read(templateID *string) (*template.Template, error)

Read reads the template

func (*RedisTemplate) Write

func (rt *RedisTemplate) Write(temaplte *api.Template) error

Write writes the template

type TemplateReadWriter

type TemplateReadWriter interface {
	TemplateReader
	TemplateWriter
}

TemplateReadWriter reads and writes the templates

type TemplateReader

type TemplateReader interface {
	// Read reads the template
	Read(templateID *string) (*template.Template, error)
}

TemplateReader reads the templates from a source

type TemplateWriter

type TemplateWriter interface {
	// Write writes the template
	Write(temaplte *api.Template) error
}

TemplateWriter writes the templates to a destination

Jump to

Keyboard shortcuts

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