udpate type mapping for go, fix indention in go model

This commit is contained in:
wing328 2016-04-11 23:44:06 +08:00
parent 87af119d9a
commit d8963d0a85
11 changed files with 28 additions and 26 deletions

View File

@ -79,11 +79,12 @@ public class GoClientCodegen extends DefaultCodegen implements CodegenConfig {
typeMapping.clear();
typeMapping.put("integer", "int32");
typeMapping.put("long", "int64");
typeMapping.put("number", "float32");
typeMapping.put("float", "float32");
typeMapping.put("double", "float64");
typeMapping.put("boolean", "bool");
typeMapping.put("string", "string");
typeMapping.put("Date", "time.Time");
typeMapping.put("date", "time.Time");
typeMapping.put("DateTime", "time.Time");
typeMapping.put("password", "string");
typeMapping.put("File", "*os.File");
@ -91,6 +92,7 @@ public class GoClientCodegen extends DefaultCodegen implements CodegenConfig {
// map binary to string as a workaround
// the correct solution is to use []byte
typeMapping.put("binary", "string");
typeMapping.put("ByteArray", "string");
importMapping = new HashMap<String, String>();
importMapping.put("time.Time", "time");

View File

@ -8,7 +8,8 @@ import (
{{#model}}
type {{classname}} struct {
{{#vars}}{{name}} {{{datatype}}} `json:"{{baseName}},omitempty"`
{{#vars}}
{{name}} {{{datatype}}} `json:"{{baseName}},omitempty"`
{{/vars}}
}
{{/model}}

View File

@ -1427,7 +1427,7 @@
"type": "string",
"format": "date-time"
},
"dateTime" : {
"password" : {
"type": "string",
"format": "password"
}

View File

@ -5,5 +5,4 @@ import (
type ModelReturn struct {
Return_ int32 `json:"return,omitempty"`
}

View File

@ -5,5 +5,5 @@ import (
type Name struct {
Name int32 `json:"name,omitempty"`
SnakeCase int32 `json:"snake_case,omitempty"`
}