db

package
v0.0.0-...-d79b4f2 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

db/database.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnectToDB

func ConnectToDB() (*pgxpool.Pool, error)

ConnectToDB establishes a connection to the PostgreSQL database.

func CreateScoreTable

func CreateScoreTable(conn *pgxpool.Pool) error

CreateScoreTable creates the score table in the database.

func CreateUserTable

func CreateUserTable(conn *pgxpool.Pool) error

CreateUserTable creates the user table in the database.

func InsertScore

func InsertScore(conn *pgxpool.Pool, userID, score int) error

InsertScore inserts a new score into the database.

func InsertUser

func InsertUser(conn *pgxpool.Pool, username, password string) error

InsertUser inserts a new user into the database.

Types

type Score

type Score struct {
	ID        int
	UserID    int
	Score     int
	Timestamp time.Time
}

Score represents the math score model.

type User

type User struct {
	ID       int
	Username string
	Password string
	Name     string
	Email    string
}

User represents the user model.

Jump to

Keyboard shortcuts

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