You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
stardb/reflect_test.go

36 lines
589 B
Go

package stardb
import (
"fmt"
"testing"
)
type Useless struct {
Leader string `db:"leader"`
Usable bool `db:"use"`
O *Whoami
}
type Whoami struct {
Hehe string `db:"hehe"`
}
func Test_SetRefVal(t *testing.T) {
var hehe = Useless{
Leader: "no",
}
fmt.Printf("%+v\n", hehe)
fmt.Println(setRefValue(&hehe, "db", "leader", "sb"))
fmt.Printf("%+v\n", hehe)
fmt.Printf("%+v\n", hehe)
fmt.Println(getAllRefKey(hehe, "db"))
}
func Test_Ref(t *testing.T) {
oooooo := Useless{
Leader: "Heheeee",
}
oooooo.O = &Whoami{"fuck"}
fmt.Println(getAllRefKey(oooooo,"db"))
}