Documentation
¶
Index ¶
- func Encrypt(password string) (string, error)
- type AnswerDB
- type JWTClaimsDB
- type Leadboard
- type MySQLDB
- func (conn *MySQLDB) AddToLobby(userId int, lobbyType int) error
- func (db *MySQLDB) Close() error
- func (db *MySQLDB) GetAllRecords(tableName string, where map[string]string) ([]map[string]interface{}, error)
- func (conn *MySQLDB) InsertUserDB(username string, password string, nickname string) error
- func (conn *MySQLDB) ParseResponseDB(user_id int) (int, error)
- func (conn *MySQLDB) QueryQuestionsDB(limit int) ([]QuestionDB, error)
- func (conn *MySQLDB) QueryUserDB(username string) (*UserDB, error)
- func (conn *MySQLDB) RetrieveLeaderboard() ([]Leadboard, error)
- type QuestionDB
- type UserDB
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type JWTClaimsDB ¶
type MySQLDB ¶
type MySQLDB struct {
// contains filtered or unexported fields
}
Define a struct to hold the MySQL database connection.
func NewMySQLDB ¶
func NewMySQLDB(username string, password string, host string, port int, database string) (*MySQLDB, error)
Create a function to establish a connection to the MySQL database.
func (*MySQLDB) GetAllRecords ¶
func (db *MySQLDB) GetAllRecords(tableName string, where map[string]string) ([]map[string]interface{}, error)
Example: Fetch all records from a table.
func (*MySQLDB) InsertUserDB ¶
func (*MySQLDB) QueryQuestionsDB ¶
func (conn *MySQLDB) QueryQuestionsDB(limit int) ([]QuestionDB, error)
func (*MySQLDB) RetrieveLeaderboard ¶
type QuestionDB ¶
Click to show internal directories.
Click to hide internal directories.