advsql/create_table_test.go

35 lines
606 B
Go
Raw Normal View History

package advsql
import (
"testing"
)
func TestCreateTable(t *testing.T) {
store, err := NewStoreMySQL("localhost", 3306, "kaikei", "u399D-TFulJykgRF4ijW6G7tK6zdO-jy", "kaikei")
if err != nil {
t.Fatal("could not make store", err)
}
type Person struct {
Surname string
Lastname string
Age int
}
p := &Person{
Surname: "Timon",
Lastname: "Ringwald",
Age: 25,
}
structure, err := objectStructure(p)
if err != nil {
t.Fatal("Could not get structure of value", err)
}
err = store.createTable(structure)
if err != nil {
t.Fatal("Could not create table", err)
}
}