func TestHasPointers(t *testing.T) { assert.True(t, meta.HasPointers([]*Foo{})) assert.True(t, meta.HasPointers(&[]*Foo{})) assert.False(t, meta.HasPointers([]Foo{})) assert.False(t, meta.HasPointers(&[]Foo{})) assert.True(t, meta.HasPointers(&Foo{})) assert.False(t, meta.HasPointers(Foo{})) }
func NewScan(to interface{}) (*Scan, error) { scan := &Scan{ To: to, ToPointers: meta.HasPointers(to), ToStructs: meta.HasAnyStruct(to), } if scan.ToStructs { table, err := NewTable(to) if err != nil { return nil, err } scan.Table = table scan.SQLColumnDict = table.SQLColumnDict() } return scan, nil }