28 lines
473 B
Go
28 lines
473 B
Go
|
package advsql
|
||
|
|
||
|
import "testing"
|
||
|
|
||
|
func TestInsert(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,
|
||
|
}
|
||
|
|
||
|
err = store.Insert(p)
|
||
|
if err != nil {
|
||
|
t.Fatal("Could not create table", err)
|
||
|
}
|
||
|
}
|