Skip to content

Instantly share code, notes, and snippets.

@gotwarlost
Created May 12, 2017 23:13
Show Gist options
  • Save gotwarlost/6cf38fc5f554ff1ec06aa4b045912060 to your computer and use it in GitHub Desktop.
Save gotwarlost/6cf38fc5f554ff1ec06aa4b045912060 to your computer and use it in GitHub Desktop.
rdl -ps generate -o ./ go-model model.rdl
package main
import (
"encoding/json"
"log"
)
type ExtendedPerson struct {
*Person
Title string
}
func main() {
ep := &ExtendedPerson{
Person: &Person{
Id: "me",
Name: "Krishnan",
},
Title: "Mr.",
}
b, err := json.MarshalIndent(ep, "", " ")
if err != nil {
log.Fatalln(err)
}
log.Println(string(b))
var ep2 ExtendedPerson
json.Unmarshal(b, &ep2)
log.Println("OK")
}
namespace test;
name main;
version 1;
type Person Struct {
String id;
String name;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment