An open API service indexing awesome lists of open source software.

https://github.com/gcclinux/gotestdb

Simple go program using postgreSQL
https://github.com/gcclinux/gotestdb

Last synced: 12 months ago
JSON representation

Simple go program using postgreSQL

Awesome Lists containing this project

README

          

# gotestdb
Simple go program using postgreSQL

1) Prerequisite installed or access to PostgreSQL

2) Prerequisite GO fully installed and working

3) notes/postgresql.txt show how to create test database

4) program structure

   gotestdb --> main.go

   gotestdb --> go.mod

   gotestdb --> go.sum

   gotestdb --> conf --> conf.json

   gotestdb --> conn --> getconf.go

   gotestdb --> conn --> db.go

   gotestdb --> proc --> checkerror.go
   gotestdb --> proc --> insertdata.go
   gotestdb --> proc --> listdata.go
   gotestdb --> proc --> readtest.go
5) donwload mods --> go mod tidy

6) run gotestdb --> go run main.go


```
package main

import "testdb/proc"

func main() {

// List available data
proc.ListData()

// Read data from database
proc.ReadTest()

// Upload data into database
upload()

}

func upload() {
proc.Insert("Cyndi", "Lauper", "69")
proc.Insert("Elvis", "Presley", "87")
proc.Insert("Bruce", "Springsteen", "73")
proc.Insert("Billy", "Idol", "67")
proc.Insert("Ozzy", "Osbourne", "74")
proc.Insert("Brandon", "Flowers", "41")
}
```

Output Example

![alt text](notes/output.png)