Documentation ¶
Index ¶
- func FromTelegramMessage(tgbotMsg tgbotapi.Message) (Message, User)
- type DataGroup
- type Database
- func (db *Database) Add(value interface{})
- func (db *Database) CheckSubscribed(id int, tag string) bool
- func (db *Database) CheckTagExists(id int, tag string) bool
- func (db *Database) CountUsersAndMessages(period string) (int, int)
- func (db *Database) GetMostUsedCommand(period string) string
- func (db *Database) UpdateTag(id int, tag string, flag string) error
- func (db *Database) UserGroup(tags []string) []User
- type Feedback
- type Message
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FromTelegramMessage ¶
FromTelegramMessage creates an ORM compatible struct of a telegram message.
Types ¶
type DataGroup ¶
type DataGroup interface { Add(value interface{}) UserGroup(tags []string) []User CheckTagExists(id int, tag string) bool CheckSubscribed(id int, tag string) bool UpdateTag(id int, tag string, flag string) error CountUsersAndMessages(period string) (int, int) GetMostUsedCommand(period string) string }
For dependency injection
type Database ¶
func (*Database) CheckSubscribed ¶
CheckSubscribed takes in an id and a tag and returns true if user is subscribed, false otherwise
func (*Database) CheckTagExists ¶
CheckTagExists takes in an id and a tag and returns whether the tag exists
func (*Database) CountUsersAndMessages ¶
Get number of users from database
func (*Database) GetMostUsedCommand ¶
function to get most used command
type Feedback ¶
type Feedback struct { gorm.Model UserID int MealType string Stall string Rating string Additional string Date int }
structure to store feedback
func CreateFeedbackEntry ¶
type Message ¶
type Message struct { gorm.Model MessageID int //User User `gorm:"ForeignKey: UserID;AssociationForeignKey:UserID"` UserID int Text string Date int }
Message is a struct that serializes the telegram message into a single row.
type User ¶
type User struct { UserID int `gorm:"primary_key"` CreatedAt time.Time UpdatedAt time.Time FirstName string LastName string UserName string Everything string //`sql:"default:'false'"` Events string //`sql:"default:'false'"` Food string Warm string Weather string }
User is an ORM compatible struct that serializes a telegram user's information.
Click to show internal directories.
Click to hide internal directories.