📋
Eather
  • Eather
  • Module Development
    • Create new Module
    • Empty Module
    • Installable
    • Upgradable
    • Routable
    • Eventable
    • Cronable
    • Callable
Powered by GitBook
On this page

Was this helpful?

  1. Module Development

Callable

Add function GetPublicFuncs() to make module Callable. This will allow to call you any function of your module in other parts of application or in another module.

.
.
.

func (m module) GetPublicFuncs() eather.PublicFuncList {
	list := make(eather.PublicFuncList)

	list["test"] = test

	return list
}

func test(data ...interface{}) (interface{}, error) {
	return []string{"testing public function of module"}, nil
}

.
.
.

Now it is possible to call this function from any part of application. It will print the return of test function to terminal.

if callable := eather.GetRegistry().Get("Empty").GetCallable(); callable != nil {
    data, _ := callable.GetPublicFuncs().Call("test")
    
    fmt.Println(data)
}
PreviousCronable

Last updated 5 years ago

Was this helpful?