I try to create a generic function that accepts any struct value and create a array of that struct type. Here is the code I tried. But I get the error "t is not a type". How can I implement this.

    type RegAppDB struct {
    nm   string
    data []interface{}
}

func CreateRegTable(tbl string, rec interface{}) RegAppDB {
    t := reflect.TypeOf(rec)
    fmt.Println(t)
    return RegAppDB{"log", []t}
}