Merge pull request #2558 from wing328/master

[Go] update type mapping, fix indention in go model
This commit is contained in:
wing328 2016-04-12 00:01:54 +08:00
commit 3e13f69b53
11 changed files with 27 additions and 26 deletions

View File

@ -79,11 +79,12 @@ public class GoClientCodegen extends DefaultCodegen implements CodegenConfig {
typeMapping.clear(); typeMapping.clear();
typeMapping.put("integer", "int32"); typeMapping.put("integer", "int32");
typeMapping.put("long", "int64"); typeMapping.put("long", "int64");
typeMapping.put("number", "float32");
typeMapping.put("float", "float32"); typeMapping.put("float", "float32");
typeMapping.put("double", "float64"); typeMapping.put("double", "float64");
typeMapping.put("boolean", "bool"); typeMapping.put("boolean", "bool");
typeMapping.put("string", "string"); typeMapping.put("string", "string");
typeMapping.put("Date", "time.Time"); typeMapping.put("date", "time.Time");
typeMapping.put("DateTime", "time.Time"); typeMapping.put("DateTime", "time.Time");
typeMapping.put("password", "string"); typeMapping.put("password", "string");
typeMapping.put("File", "*os.File"); typeMapping.put("File", "*os.File");

View File

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

View File

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

View File

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

View File

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