deprecated funcs fix
This commit is contained in:
15
pg_test.go
15
pg_test.go
@@ -3,7 +3,6 @@ package sqldb
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"testing"
|
||||
)
|
||||
@@ -12,18 +11,12 @@ func TestPgCreateTable(t *testing.T) {
|
||||
db := Open("postgres", "host=127.0.0.1 port=5432 user=test password=test dbname=test sslmode=disable")
|
||||
defer db.Close()
|
||||
|
||||
jsonFile, err := os.Open("test_table.json")
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
defer jsonFile.Close()
|
||||
|
||||
byteValue, _ := ioutil.ReadAll(jsonFile)
|
||||
byteValue, _ := os.ReadFile("test_table.json")
|
||||
|
||||
var jsonSource TableInfo
|
||||
json.Unmarshal([]byte(byteValue), &jsonSource)
|
||||
|
||||
err = db.CreateTable(jsonSource)
|
||||
err := db.CreateTable(jsonSource)
|
||||
if err != nil {
|
||||
fmt.Println(err.Error())
|
||||
}
|
||||
@@ -88,10 +81,8 @@ func TestPgInsert(t *testing.T) {
|
||||
if len(jsonStringOld) == len(jsonStringNew) {
|
||||
t.Errorf("Error row not created")
|
||||
}
|
||||
jsonFile, err := os.Open("insert.json")
|
||||
defer jsonFile.Close()
|
||||
var result map[string]interface{}
|
||||
byteValue, _ := ioutil.ReadAll(jsonFile)
|
||||
byteValue, _ := os.ReadFile("insert.json")
|
||||
json.Unmarshal(byteValue, &result)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user