deprecated funcs fix

This commit is contained in:
ycc
2023-08-22 21:35:14 +02:00
parent c362b6bc33
commit fb6955465a
4 changed files with 16 additions and 43 deletions

View File

@@ -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)
}