easyalert

package module
v0.0.0-...-f40e6d9 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2019 License: MIT Imports: 3 Imported by: 0

README

Easyalert

Build Status

Easyalert is a small application which enables you to send alerts in a simple and straightforward way. It is suitable especially for scripts where you want to notify yourself in case a certain event or failure occurs.

Development

The easiest way to work on easyalert is by using docker.

First run make docker_build to build and pull all the images you need and then run make init to initialize you local docker environment. Afterwards you can run docker-compose up to start the application.

In case you make library changes or somehow need to rebuild your environment you can just execute make reset and again make docker_build and make init and you are back up.

It also makes sense to run make docker_clean occasionally which will delete all containers that were exited.

When having the application running using docker-compose up air will automatically restart the application after every change.

Running tests

You can run tests by executing make test. You should have the database set up as instructed previously.

Applying migrations

Easyalert is using gom for migrations. To apply the latest migrations locally you can run make migrate.

Documentation

Index

Constants

View Source
const (
	AlertStatusPending = iota
	AlertStatusSent
	AlertStatusFailed
)
View Source
const UserTokenLength = 32

Variables

View Source
var ErrRecordDoesNotExist = errors.New("record does not exist")

ErrRecordDoesNotExist is a generic error in case a record which is searched does not exist

Functions

This section is empty.

Types

type Alert

type Alert struct {
	ID        uint
	Subject   string
	Status    uint
	SentAt    *time.Time
	UserID    uint
	CreatedAt time.Time
	UpdatedAt time.Time
}

func (*Alert) HumanStatus

func (a *Alert) HumanStatus() string

type AlertRepository

type AlertRepository interface {
	FindAlert(query string, params ...interface{}) (Alert, error)
	FindAlerts(query string, params ...interface{}) ([]Alert, error)
	CreateAlert(alert Alert) (Alert, error)
	UpdateAlert(alert Alert) (Alert, error)
	DeleteAlert(alert Alert) error
}

type User

type User struct {
	ID             uint
	Email          string
	PasswordDigest string
	Token          string
	CreatedAt      time.Time
	UpdatedAt      time.Time
}

User defines all fields of the user model

func (*User) HashPassword

func (u *User) HashPassword(pass string) error

func (*User) ValidPassword

func (u *User) ValidPassword(pass string) bool

type UserRepository

type UserRepository interface {
	FindUser(query string, params ...interface{}) (User, error)
	FindUsers() ([]User, error)
	CreateUser(user User) (User, error)
	UpdateUser(user User) (User, error)
	DeleteUser(user User) error
}

UserRepository wraps all CRUD operations for users

Directories

Path Synopsis
cmd
Package mock_easyalert is a generated GoMock package.
Package mock_easyalert is a generated GoMock package.
web
api

Jump to

Keyboard shortcuts

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