Files
2026-09-15 21:27:46 +05:00

24 lines
416 B
Go

package cqrs
import (
"reflect"
)
func isPointer(v interface{}) error {
rv := reflect.ValueOf(v)
if rv.Kind() != reflect.Pointer || rv.IsNil() {
return NonPointerError{rv.Type()}
}
return nil
}
type NonPointerError struct {
Type reflect.Type
}
func (e NonPointerError) Error() string {
return "non-pointer command: " + e.Type.String() + ", handler.NewCommand() should return pointer to the command"
}