Back to godoc.org

Package db

v0.0.0-...-382ded3
Latest Go to latest

The highest tagged major version is .

Published: Sep 19, 2020 | License: GPL3 | Module: bitbucket.org/pav5000/socketbot

Index

func AddSocket

func AddSocket(socket model.Socket) (err error)

func ClearSessionValues

func ClearSessionValues(user uint64)

func Close

func Close()

func GetAllSockets

func GetAllSockets() ([]model.Socket, error)

func GetSessionValue

func GetSessionValue(user uint64, key string) string

func GetSessionValueFloat64

func GetSessionValueFloat64(user uint64, key string) float64

func GetSessionValueInt64

func GetSessionValueInt64(user uint64, key string) int64

func GetSessionValueJson

func GetSessionValueJson(user uint64, key string, v interface{}) bool

func GetSessionValueUint64

func GetSessionValueUint64(user uint64, key string) uint64

func GetSocketPhotoStrings

func GetSocketPhotoStrings(socketId uint64) ([]string, error)

func GetSocketPhotoUrls

func GetSocketPhotoUrls(socketId uint64) ([]string, error)

func GetUserState

func GetUserState(id uint64) (string, error)

func SetPhotoUrl

func SetPhotoUrl(photoId uint64, photoUrl string) error

func SetSessionValue

func SetSessionValue(user uint64, key string, value interface{})

func SetUserState

func SetUserState(id uint64, state string)

func UpdateUserInfo

func UpdateUserInfo(user tg.User) error

Update user info Is called every message to check if user updated it's name and other fields

type PhotosRow

type PhotosRow struct {
	Id         uint64 `db:"id"`
	Socket     uint64 `db:"socket"`
	User       uint64 `db:"user"`
	Added      int64  `db:"added"`
	Url        string `db:"url"`
	MediaId    string `db:"media_id"`
	Downloaded int    `db:"downloaded"`
}

func GetAllPhotoRows

func GetAllPhotoRows() ([]PhotosRow, error)

type SessionDataRow

type SessionDataRow struct {
	User  uint64 `db:"user"`
	Key   string `db:"key"`
	Value string `db:"value"`
}

type SocketsRow

type SocketsRow struct {
	Id               uint64  `db:"id"`
	Lat              float64 `db:"lat"`
	Lng              float64 `db:"lng"`
	Name             string  `db:"name"`
	Description      string  `db:"description"`
	AddedBy          uint64  `db:"added_by"`
	LastConfirmation int64   `db:"last_confirmation"`
	Layer            string  `db:"layer"`
}

type UsersRow

type UsersRow struct {
	Id           int64  `db:"id"`
	FirstName    string `db:"first_name"`
	LastName     string `db:"last_name"`
	Username     string `db:"username"`
	LanguageCode string `db:"language_code"`
	ChatState    string `db:"chat_state"`
	FirstMessage int64  `db:"first_message"`
	LastMessage  int64  `db:"last_message"`
}

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier