gitlab.com/evatix-go/core@v1.3.55/corefuncs/IsSuccessFuncWrapper.go (about) 1 package corefuncs 2 3 import "gitlab.com/evatix-go/core/errcore" 4 5 type IsSuccessFuncWrapper struct { 6 Name string 7 Action IsSuccessFunc 8 } 9 10 func (it IsSuccessFuncWrapper) Exec() (isSuccess bool) { 11 return it.Action() 12 } 13 14 func (it IsSuccessFuncWrapper) AsActionFunc() ActionFunc { 15 return func() { 16 it.Action() 17 } 18 } 19 20 func (it IsSuccessFuncWrapper) AsActionReturnsErrorFunc() ActionReturnsErrorFunc { 21 return func() error { 22 isSuccess := it.Action() 23 24 if !isSuccess { 25 return errcore. 26 FailedToExecuteType. 27 ErrorNoRefs("Function Failed to execute :" + it.Name) 28 } 29 30 return nil 31 } 32 }