model

package
v0.0.0-...-1309449 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAlertAlreadyExist = errors.New("alert already exist")
)
View Source
var (
	TheUsersMaster = &UsersMaster{
		lock:    &sync.RWMutex{},
		dataMap: make(map[string]*User),
	}
)

Functions

This section is empty.

Types

type AlertBody

type AlertBody struct {
	Title   string `json:"title"`
	Content string `json:"content"`
}

type BarkAlert

type BarkAlert struct {
	ID   string
	Name string
}

func NewBarkAlert

func NewBarkAlert(id, name string) *BarkAlert

func (*BarkAlert) GetID

func (b *BarkAlert) GetID() string

func (*BarkAlert) Send

func (b *BarkAlert) Send(body *AlertBody) error

type PostMan

type PostMan interface {
	GetID() string
	Send(body *AlertBody) error
}

type User

type User struct {
	ID string `json:"id"`
	UserInput

	BarkAlerts []*BarkAlert `json:"bark_alerts"`
	// contains filtered or unexported fields
}

func NewUserFromBytes

func NewUserFromBytes(userByte []byte) (*User, error)

func (*User) NewAlertService

func (u *User) NewAlertService(barkAlert *BarkAlert) error

func (*User) Save

func (u *User) Save() error

func (*User) Send

func (u *User) Send(body *AlertBody)

func (*User) SendByID

func (u *User) SendByID(id string, body *AlertBody)

type UserInput

type UserInput struct {
	Name string `json:"name"`
}

func (*UserInput) ToUser

func (u *UserInput) ToUser() *User

func (*UserInput) Validate

func (u *UserInput) Validate() error

type UsersMaster

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

func (*UsersMaster) AddUser

func (m *UsersMaster) AddUser(u *User)

func (*UsersMaster) GetUser

func (m *UsersMaster) GetUser(ID string) (user *User)

func (*UsersMaster) GetUsers

func (m *UsersMaster) GetUsers() (users []*User)

func (*UsersMaster) Init

func (m *UsersMaster) Init() error

Jump to

Keyboard shortcuts

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