services

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2023 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package services implements the services.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Email added in v1.3.0

type Email struct{}

Email is the entity that manages the email client.

func NewEmailService added in v1.3.0

func NewEmailService() *Email

NewEmailService creates a new Email service.

func (*Email) RateLimits added in v1.3.0

func (e *Email) RateLimits() (remaining int, resetUnix int64, err error)

func (*Email) Send added in v1.3.0

func (e *Email) Send(to string, template templates.EmailTemplate, data any)

Send sends an email of the given template to a recipient.

type EmailService added in v1.3.0

type EmailService interface {
	// RateLimits gets the SendGrid API's remaining and reset rate limits.
	RateLimits() (remaining int, resetUnix int64, err error)

	// Send sends an email using the SendGrid API.
	Send(to string, template templates.EmailTemplate, data any)
}

EmailService is the interface that describes the methods required for the email client.

type RepositoryService added in v1.3.0

type RepositoryService interface {
	// CleanDatabase cleans the database. Unconfirmed users are wiped.
	CleanDatabase() error

	// Confirm confirms the account.
	Confirm(userEmail string) error

	// Register registers a new user to the service.
	Register(userEmail string) error

	// Unregister removes the user's access to the service.
	Unregister(userEmail string) error

	// Users fetches all users in the database.
	Users() ([]models.User, error)
}

RepositoryService is the interface that describes the methods required for managing the main data store.

type SQLiteService

type SQLiteService struct {
	DB    *sql.DB
	Mutex *sync.Mutex
}

SQLiteService represents the Service implemented with SQLite.

func NewSQLiteService

func NewSQLiteService() *SQLiteService

NewSQLiteService creates an SQLite service.

func (*SQLiteService) CleanDatabase added in v1.1.0

func (s *SQLiteService) CleanDatabase() error

func (*SQLiteService) Confirm added in v1.1.0

func (s *SQLiteService) Confirm(userEmail string) error

func (*SQLiteService) Register

func (s *SQLiteService) Register(userEmail string) error

func (*SQLiteService) Unregister

func (s *SQLiteService) Unregister(userEmail string) error

func (*SQLiteService) Users

func (s *SQLiteService) Users() ([]models.User, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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