Navigation Menu

Skip to content
This repository has been archived by the owner on May 7, 2023. It is now read-only.

foomo/Foomo.Go

Repository files navigation

foomo - golang integration module

This foomo php module is designed to work with the gofoomo Go package .

Generate Go structs for php value objects

This is a snippet for a foomo module class:

// typically the make method of a foomo module class is a good place to generate code
public static function make($target, \Foomo\Modules\MakeResult $result)
{
    switch($target) {
        case 'all':
            // typically point to you go path 
            $goPath = self::getBaseDir('go');
            if(file_exists($goPath) && is_dir($goPath) && is_writable($goPath)) {
                // this call will generate gopath/src/github.com/foomo/gofoomo/services/rpc/value_objects.go
                \Foomo\Go\Utils::writeStructsForValueObjects(
                    [
                        'Foomo\\Services\\RPC\\Protocol\\Call\\MethodCall',
                        'Foomo\\Services\\RPC\\Protocol\\Reply\\MethodReply'
                    ],
                    $package = 'github.com/foomo/gofoomo/services/rpc',
                    $goPath
                );
                $result->addEntry('wrote go value object sources');
            } else {
                $result->addEntry('can not write go value object sources');
            }
            break;
        default:
            parent::make($target, $result);
    }
}

Releases

No releases published

Packages

No packages published