diff --git a/kiss_orm.go b/kiss_orm.go index 4bb1b46..12e8bf3 100644 --- a/kiss_orm.go +++ b/kiss_orm.go @@ -46,6 +46,7 @@ func (c Client) Find( return it.Error } +// GetByID recovers a single entity from the database by the ID field. func (c Client) GetByID( ctx context.Context, item interface{}, diff --git a/slices/slices.go b/slices/slices.go index 583384e..65399c1 100644 --- a/slices/slices.go +++ b/slices/slices.go @@ -2,10 +2,15 @@ package slices import "reflect" +// ToInterfaceSlicer describes objects that +// can be converted to a list of interfaces type ToInterfaceSlicer interface { ToInterfaceSlice() []interface{} } +// ToInterfaceSlice converts any slice into a slice of empty interfaces. +// +// If the input argument is not a slice it panics. func ToInterfaceSlice(slice interface{}) (resp []interface{}) { if iSlicer, ok := slice.(ToInterfaceSlicer); ok { return iSlicer.ToInterfaceSlice()