database

package
v0.0.0-...-e8a86a0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Client *mongo.Client = Init()
View Source
var PassageCollection *mongo.Collection = PassageData(Client, "passages")
View Source
var UserCollection *mongo.Collection = UserData(Client, "users")

Functions

func AddPassage

func AddPassage(passage models.Passage) error

Добавление passage

func AddSubscription

func AddSubscription(sb *models.Subscription) error

func AddUser

func AddUser(user *models.User) error

Создание пользователя в бд

func AddUserTelegram

func AddUserTelegram(tg_id int64) (*models.Id_telegram, error)

Регистрация при /start, отправление ID_telegram в массив

func AuthenticateUser

func AuthenticateUser(tg_id int64, login string, password string) (*models.User, error)

авторизация через бд - лк САМГК (с добавлением ID_telegram)

func BuySubscription

func BuySubscription(tg_id int64, subscriptionID primitive.ObjectID) error

func CheckSubscription

func CheckSubscription(tg_id int64) (bool, error)

func GetAllPassages

func GetAllPassages() ([]models.Passage, error)

Просмотр всех passages

func GetUser

func GetUser(tg_id int64) (*models.User, error)

Доступ к пользователя по ID_telegram

func GetUserByFIO

func GetUserByFIO(fio string) (*models.User, error)

Доступ к пользователя по fio

func GetUsers

func GetUsers() (*[]models.User, error)

просмотр всех пользователй в бд

func HashPassword

func HashPassword(password string) string

func Init

func Init() *mongo.Client

func PassageData

func PassageData(client *mongo.Client, collectionName string) *mongo.Collection

func SearchForSenior

func SearchForSenior(chatID int64, groupNumber models.Group) ([]models.Passage, error)

func SearchItemInDB

func SearchItemInDB() (*models.User, *models.Passage, error)

func UserData

func UserData(client *mongo.Client, collectionName string) *mongo.Collection

Types

This section is empty.

Jump to

Keyboard shortcuts

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