Skip to content

mhoarb/FlashCardProject

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FlashCardProject

FlashCardProject is a simple Go application designed to manage flashcards. It provides functionalities to set up a database and display flashcards in a tabular format.

Installation

  1. Clone the repository:

    git clone https://github.com/mhoarb/FlashCardProject.git
    cd FlashCardProject
  2. Install dependencies:

    go mod tidy

Usage

go buld
go install

Setting Up the Database

The SetUpDatabase function in the db package sets up a MySQL database connection.

package main

import (
    "fmt"
    "FlashCardProject/db"
)

func main() {
    db, err := db.SetUpDatabase()
    if err != nil {
        fmt.Println("Error setting up database:", err)
        return
    }
    fmt.Println("Database setup successfully:", db)
}

Displaying Flashcards

The DisplayTable function in the db package displays flashcards in a tabular format using the tablewriter package.

package main

import (
    "FlashCardProject/db"
)

func main() {
    flashCards := []db.FlashCard{
        {Question: "What is Go?", Answer: "A programming language"},
        {Question: "Who created Go?", Answer: "Google"},
    }
    db.DisplayTable(flashCards)
}

Project Structure

FlashCardProject/
├── cmd/
├── db/
│   ├── db.go
│   ├── db_test.go
│   ├── flashcard.go
│   └── flashcard_test.go
├── internal/
├── go.mod
├── go.sum
└── main.go

cmd/: Contains command-line interface related files.

db/: Contains database-related code and tests.

internal/: Contains internal application logic.

main.go: Entry point of the application.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors