service

package
v0.0.0-...-52bb2e6 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var IsRecordNotFoundError = gorm.IsRecordNotFoundError

IsRecordNotFoundError returns true if the given error is caused by a missing record.

Functions

This section is empty.

Types

type Bird

type Bird struct {
	BirdApp BirdApp
}

Bird provide core functionalities of memobird.

func (*Bird) BindBirdWithMessage

func (b *Bird) BindBirdWithMessage(birdID, msg string) (*memobird.PrintResult, error)

BindBirdWithMessage binds birdID and sends given message to bird.

func (*Bird) PrintTextToBird

func (b *Bird) PrintTextToBird(birdID, text string) (*memobird.PrintResult, error)

PrintTextToBird sends given text to memobird of birdID for printing.

type BirdApp

type BirdApp interface {
	PrintText(text string, birdID string) (*memobird.PrintResult, error)
	BindDevice(deviceID string) (*memobird.BindResult, error)
}

BirdApp represents the ability to interact with a memobird.

type Device

type Device struct {
	DB *gorm.DB
}

Device provides core functionalities of device.

func (*Device) GetByUserID

func (d *Device) GetByUserID(userID uint) (*model.Device, error)

GetByUserID returns Device with given userID.

func (*Device) IsFree

func (d *Device) IsFree(memobirdID string) (bool, error)

IsFree returns true if given deviceID doesn't exist or not owned by other users.

func (*Device) New

func (d *Device) New(device *model.Device) (*model.Device, error)

New creates a device with verification code generated.

func (*Device) VerifyCodeByUserID

func (d *Device) VerifyCodeByUserID(code string, userID uint) (bool, error)

VerifyCodeByUserID checks if given verification code matches to the user.

type User

type User struct {
	DB *gorm.DB
}

User provides core functionalities of user.

func (*User) GetByTelegramID

func (u *User) GetByTelegramID(telegramID int) (*model.User, error)

GetByTelegramID returns user of given telegram ID.

func (*User) IsExistsByTelegramID

func (u *User) IsExistsByTelegramID(telegramID int) (bool, error)

IsExistsByTelegramID returns true if given telegramID already exists.

func (*User) New

func (u *User) New(user *model.User) error

New creates a user.

Jump to

Keyboard shortcuts

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