Skip to content
This repository was archived by the owner on Sep 7, 2021. It is now read-only.
This repository is currently being migrated. It's locked while the migration is in progress.
This repository was archived by the owner on Sep 7, 2021. It is now read-only.

Is it possible to Find with reflected slice? #1362

@TheCGDF

Description

@TheCGDF
func FindT(typ interface{}) {
	items := reflect.Zero(reflect.SliceOf(reflect.TypeOf(typ))).Interface()
	db.Find(&items)    //panic: needs a pointer to a slice or a map
}

Is it possible to Find with reflected slice?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions