Command Data Model is for command of metadata. It will get you a easy expression of your data to send to micro service. And Also, It's good at expressing all data. because edgeAttributes can contain another edgeAttribute object.
-
Go compiler
- Version : 1.9.2
- How to install
-
Set
GOPATH
toProject Path
to use datamodel-command-go library
Enter as follows in linux command line
$ go get github.com/mgjeong/datamodel-command-go
$ cd $GOPATH/src/github.com/mgjeong/datamodel-command-go/formatter
$ go install
As a result, github.com/mgjeong/datamodel-command-go/formatter.a
is generated in $GOPATH/pkg/[$GOOS_$GOARCH]
To use the datamodel-command-go libraries you first need to import the libraries into your project :
import "github.com/mgjeong/datamodel-command-go/formatter"
You can Use data models(EdgeAttribute, EdgeElement, EdgeData) as below :
attr := formatter.EdgeAttribute{"[name]", "[dataType]", [value]}
attr.ConvertToEdgeAttribute()
You can Use encoder and decoder as below :
jsonString, err := formatter.EncodeEdgeAttributeToJsonString(&EdgeAttribute)
EdgeAttribute, err := formatter.EncodeEdgeAttributeToJsonString(&jsonString)
- GOTO :
~/datamodel-command-go
- Run the script
$ ./unittest.sh
- Open
coverall.html
in web browser