grnc-bind

command
v2.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 11, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

The grnc-bind tool - used to convert Granitic's JSON component definition files into Go source.

Go does not support a 'type-from-name' mechanism for instantiating objects, so the container cannot create arbitrarily typed objects at runtime. Instead, Granitic component definition files are used to generate Go source files that will be compiled along with your application. The grnc-bind tool performs this code generation.

In most cases, the grnc-bind command will be run, without arguments, in your application's root directory (the same folder that contains your resources directory. The tool will merge together any .json files found in resources/components and create a file bindings/bindings.go. This file includes a single function:

Components() *ioc.ProtoComponents

The results of that function are then included in your application's call to start Granticic. E.g.

func main() {
	granitic.StartGranitic(bindings.Components())
}

grnc-bind will need to be re-run whenever a component definition file is modified.

Usage of grnc-bind:

grnc-bind [-c component-files] [-m merged-file-out] [-o generated-file] [-l log-level]

-c string
	A comma separated list of component definition files or directories containing component definition files (default "resource/components")
-m string
	The path of a file where the merged component definition file should be written to. Execution will halt after writing.
-o string
	Path to the Go source file that will be generated (default "bindings/bindings.go")
-l string
	The level at which the tool will output messages: TRACE, DEBUG, INFO, ERROR, FATAL (default ERROR)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL