database

package
v0.0.0-...-8789a18 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UpdateVersion

func UpdateVersion(db *SpyBotDb)

Types

type SessionUserInfo

type SessionUserInfo struct {
	UserId                  int64
	ChatId                  int64
	Name                    string
	Gender                  int
	CurrentSessionIdleCount int
}

type SpyBotDb

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

func ConnectDb

func ConnectDb(path string) (database *SpyBotDb, err error)

func (*SpyBotDb) AddSessionSuggestedCommand

func (database *SpyBotDb) AddSessionSuggestedCommand(sessionId int64, command string)

func (*SpyBotDb) ConnectToSession

func (database *SpyBotDb) ConnectToSession(userId int64, sessionId int64) (isSucceeded bool, previousSessionId int64, wasInSession bool)

func (*SpyBotDb) CreateSession

func (database *SpyBotDb) CreateSession(userId int64) (sessionId int64, previousSessionId int64, wasInSession bool)

func (*SpyBotDb) Disconnect

func (database *SpyBotDb) Disconnect()

func (*SpyBotDb) DoesSessionExist

func (database *SpyBotDb) DoesSessionExist(sessionId int64) (isExists bool)

func (*SpyBotDb) GetChatId

func (database *SpyBotDb) GetChatId(userId int64) (chatId int64)

func (*SpyBotDb) GetDatabaseVersion

func (database *SpyBotDb) GetDatabaseVersion() (version string)

func (*SpyBotDb) GetSessionIdFromToken

func (database *SpyBotDb) GetSessionIdFromToken(token string) (sessionId int64, isFound bool)

func (*SpyBotDb) GetSessionMessageId

func (database *SpyBotDb) GetSessionMessageId(userId int64) (messageId int64, isFound bool)

func (*SpyBotDb) GetSessionSuggestedCommandCount

func (database *SpyBotDb) GetSessionSuggestedCommandCount(sessionId int64) (commandsCount int64)

func (*SpyBotDb) GetTokenFromSessionId

func (database *SpyBotDb) GetTokenFromSessionId(sessionId int64) (token string, isFound bool)

func (*SpyBotDb) GetUserChatId

func (database *SpyBotDb) GetUserChatId(userId int64) (chatId int64)

func (*SpyBotDb) GetUserGender

func (database *SpyBotDb) GetUserGender(userId int64) (gender int)

func (*SpyBotDb) GetUserId

func (database *SpyBotDb) GetUserId(chatId int64, userLangCode string, userName string) (userId int64)

func (*SpyBotDb) GetUserLanguage

func (database *SpyBotDb) GetUserLanguage(userId int64) (language string)

func (*SpyBotDb) GetUserName

func (database *SpyBotDb) GetUserName(userId int64) (name string)

func (*SpyBotDb) GetUserSession

func (database *SpyBotDb) GetUserSession(userId int64) (sessionId int64, isInSession bool)

func (*SpyBotDb) GetUsersCountInSession

func (database *SpyBotDb) GetUsersCountInSession(sessionId int64) (usersCount int64)

func (*SpyBotDb) GetUsersInSession

func (database *SpyBotDb) GetUsersInSession(sessionId int64) (users []int64)

func (*SpyBotDb) GetUsersInSessionInfo

func (database *SpyBotDb) GetUsersInSessionInfo(sessionId int64) (users []SessionUserInfo)

func (*SpyBotDb) IsConnectionOpened

func (database *SpyBotDb) IsConnectionOpened() bool

func (*SpyBotDb) IsUserCompletedFTUE

func (database *SpyBotDb) IsUserCompletedFTUE(userId int64) (isCompleted bool)

func (*SpyBotDb) LeaveSession

func (database *SpyBotDb) LeaveSession(userId int64) (sessionId int64, wasInSession bool)

func (*SpyBotDb) PopRandomSessionSuggestedCommand

func (database *SpyBotDb) PopRandomSessionSuggestedCommand(sessionId int64) (command string, isSucceeded bool)

func (*SpyBotDb) SetDatabaseVersion

func (database *SpyBotDb) SetDatabaseVersion(version string)

func (*SpyBotDb) SetSessionMessageId

func (database *SpyBotDb) SetSessionMessageId(userId int64, messageId int64)

func (*SpyBotDb) SetUserCompletedFTUE

func (database *SpyBotDb) SetUserCompletedFTUE(userId int64, isCompleted bool)

func (*SpyBotDb) SetUserGender

func (database *SpyBotDb) SetUserGender(userId int64, gender int)

func (*SpyBotDb) SetUserLanguage

func (database *SpyBotDb) SetUserLanguage(userId int64, language string)

func (*SpyBotDb) SetUserName

func (database *SpyBotDb) SetUserName(userId int64, name string)

func (*SpyBotDb) UpdateUsersIdleCount

func (database *SpyBotDb) UpdateUsersIdleCount(usersToIncrease []int64, countIncrease int, usersToReset []int64)

Jump to

Keyboard shortcuts

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