Documentation ¶
Index ¶
- func SqliteToMongoDB(sqliteDBFile string, mongoURI string, mongoDBName string, ...) error
- type Keywords
- type MongoStoreDB
- func (mdb *MongoStoreDB) AddUser(user *models.UserData) error
- func (mdb *MongoStoreDB) Close() error
- func (mdb *MongoStoreDB) DeleteUser(user *models.UserData) error
- func (mdb *MongoStoreDB) GetUser(chatID int64) (*models.UserData, error)
- func (mdb *MongoStoreDB) ReadUserStore() (*models.UserStore, error)
- func (mdb *MongoStoreDB) UpdateUser(user *models.UserData) error
- func (mdb *MongoStoreDB) WriteUserStore(userStore *models.UserStore) error
- type UserData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Keywords ¶
type Keywords []string
Keywords is a custom type that represents a slice of strings
type MongoStoreDB ¶
func New ¶
func New(mongoUri string, dbName string, collName string, logger *zap.Logger) (*MongoStoreDB, error)
Connect to the mongo database
func (*MongoStoreDB) AddUser ¶
func (mdb *MongoStoreDB) AddUser(user *models.UserData) error
Add user to the database
func (*MongoStoreDB) DeleteUser ¶
func (mdb *MongoStoreDB) DeleteUser(user *models.UserData) error
Delete user from the database
func (*MongoStoreDB) GetUser ¶
func (mdb *MongoStoreDB) GetUser(chatID int64) (*models.UserData, error)
Get user from the database by chat_id
func (*MongoStoreDB) ReadUserStore ¶
func (mdb *MongoStoreDB) ReadUserStore() (*models.UserStore, error)
Read all users from the database
func (*MongoStoreDB) UpdateUser ¶
func (mdb *MongoStoreDB) UpdateUser(user *models.UserData) error
Update user in the database
func (*MongoStoreDB) WriteUserStore ¶
func (mdb *MongoStoreDB) WriteUserStore(userStore *models.UserStore) error
Write *models.UserStore to the database
type UserData ¶
type UserData struct { ChatID int64 `gorm:"column:chat_id"` // Telegram chat ID Username string `gorm:"column:username"` // Telegram username OzbGood bool `gorm:"column:ozb_good"` // watch deals with 25+ upvotes in the last 24 hours OzbSuper bool `gorm:"column:ozb_super"` // watch deals with 50+ upvotes in the last 24 hours Keywords Keywords `gorm:"column:keywords"` // list of keywords / deals to watch for OzbSent Keywords `gorm:"column:ozb_sent"` // comma separated list of ozb deals sent to user AmzDaily bool `gorm:"column:amz_daily"` // watch top daily deals on amazon AmzWeekly bool `gorm:"column:amz_weekly"` // watch top weekly deals on amazon AmzSent Keywords `gorm:"column:amz_sent"` // comma separated list of amz deals sent to user UsernameChosen string `gorm:"column:username_chosen"` // username chosen by user Password string `gorm:"column:password"` // password chosen by user }
UserData represents the structure of the data in the SQLite database
Click to show internal directories.
Click to hide internal directories.