db

package
v0.0.0-...-6db50c9 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const DBfile string = "data.db"

DBfile

Variables

View Source
var (
	ErrConflict error = errors.New("already exist")
	ErrInsert   error = errors.New("cannot insert new row")
)

Functions

func InitDB

func InitDB() (err error)

InitDB

Types

type DB

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

DB

func New

func New() (DB, error)

New

func (DB) AuthorizeToken

func (d DB) AuthorizeToken(token string) (bool, error)

AuthorizeToken

func (DB) Close

func (d DB) Close() error

Close

func (DB) GetLastUpdateID

func (d DB) GetLastUpdateID() (int, error)

GetLastUpdateID

func (DB) GetSubscriber

func (d DB) GetSubscriber(token string) (s Subscriber, err error)

GetSubscriber

func (DB) InsertNewMessage

func (d DB) InsertNewMessage(userID, message string) error

InsertNewMessage

func (DB) InsertNewUser

func (d DB) InsertNewUser(userID, username string) (string, error)

InsertNewUser

func (DB) InsertUpdateID

func (d DB) InsertUpdateID(updateID int) error

InsertUpdateID

func (DB) IsSubscriberExist

func (d DB) IsSubscriberExist(userID string) (bool, error)

IsSubscriberExist

type Subscriber

type Subscriber struct {
	ID       int
	Username string
}

Subscriber

Jump to

Keyboard shortcuts

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