notification

package
v0.0.0-...-bd5e2c9 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrorResponse

type ErrorResponse struct {
	Err string
}

type Notification

type Notification struct {
	ID      *int64 `json:"id,omitempty"`
	UserID  string `json:"user_id"`
	Message string `json:"message"`
}

User defines the structure for the user

type NotificationManager

type NotificationManager interface {
	AddNotification(ctx context.Context, notification Notification) error
	FindNotificationByID(ctx context.Context, notificationID int64) (*Notification, error)
}

type Notifications

type Notifications []Notification

type Repository

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

func NewRepository

func NewRepository(client *storage.MySQLStorage) (*Repository, error)

func (*Repository) AddNotification

func (r *Repository) AddNotification(notification *Notification) error

func (*Repository) GetNotificationsByUserID

func (r *Repository) GetNotificationsByUserID(userID int64) (*Notifications, error)

type Service

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

func NewNotificationService

func NewNotificationService(repository *Repository) *Service

func (*Service) CreateNotificationHandler

func (s *Service) CreateNotificationHandler(w http.ResponseWriter, r *http.Request)

func (*Service) GetNotificationsByUserID

func (s *Service) GetNotificationsByUserID(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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