Skip to content
Snippets Groups Projects
Commit 107a6fef authored by Xavier Perret's avatar Xavier Perret
Browse files

added method to print the database

parent e4a86d6e
Branches
No related tags found
1 merge request!2added file to separate client function from the server
...@@ -41,3 +41,15 @@ func PrintConfig(config Config) { ...@@ -41,3 +41,15 @@ func PrintConfig(config Config) {
fmt.Println("The port is ", config.Port) fmt.Println("The port is ", config.Port)
PrintNeighbors(config.Neighbours) PrintNeighbors(config.Neighbours)
} }
func PrintingDatabaseToConsole(database Database) {
for i, trans := range database {
fmt.Println("--------------------")
fmt.Printf("\nListing transactions number %d in database\n", i)
fmt.Printf("Transaction id: %s\n", trans.Id)
fmt.Printf("Transaction sender: %s\n", trans.Sender)
fmt.Printf("Transaction receiver: %s\n", trans.Receiver)
fmt.Printf("Transaction amount: %s\n", trans.Amount)
fmt.Println("--------------------")
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment