db

package
Version: v0.0.0-...-06c608a Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2021 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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

Types

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"`
}

Jump to

Keyboard shortcuts

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