File tree 3 files changed +27
-12
lines changed
3 files changed +27
-12
lines changed Original file line number Diff line number Diff line change @@ -8,10 +8,6 @@ enum Kind: uint32
8
8
- USER
9
9
- ADMIN
10
10
11
-
12
- message Empty
13
-
14
-
15
11
message User
16
12
- id: uint64
17
13
+ json = id
@@ -26,12 +22,26 @@ message User
26
22
- role: string
27
23
+ go.tag.db = -
28
24
25
+ - nicknames: []Nickname
26
+ + go.tag.db = "-"
27
+ + go.field.type = []Nickname
28
+
29
29
- createdAt: timestamp
30
30
+ go.tag.db = created_at
31
31
32
32
- updatedAt?: timestamp
33
33
+ go.tag.db = updated_at
34
34
35
+ message Nickname
36
+ - id: uint64
37
+ + go.tag.db = id
38
+ - nickname: string
39
+ + go.tag.db = nickname
40
+ - createdAt: timestamp
41
+ + go.tag.db = created_at
42
+ - updatedAt?: timestamp
43
+ + go.tag.db = updated_at
44
+
35
45
message SearchFilter
36
46
- q: string
37
47
Original file line number Diff line number Diff line change 5
5
type {{$struct.Name}} struct {
6
6
{{- range $_, $field := $struct.Fields -}}
7
7
{{- $fieldName := $field.Name | firstLetterToUpper -}}
8
- {{- $fieldType := $field.Type -}}
8
+ {{- $customType := "" -}}
9
9
{{- $jsonTags := printf "json:%q" ($field.Name | firstLetterToLower) }}
10
10
{{- $dbTags := "" }}
11
11
{{- range $meta := $field.Meta -}}
12
12
{{- if exists $meta "go.field.name" -}}
13
13
{{- $fieldName = get $meta "go.field.name" -}}
14
14
{{- end -}}
15
15
{{- if exists $meta "go.field.type" -}}
16
- {{- $fieldType = get $meta "go.field.type" -}}
16
+ {{- $customType = get $meta "go.field.type" -}}
17
17
{{- end -}}
18
18
{{- if exists $meta "json" -}}
19
19
{{- $jsonTags = printf "json:%q" (get $meta "json") -}}
@@ -25,7 +25,7 @@ type {{$struct.Name}} struct {
25
25
{{- $dbTags = printf " db:%q" (get $meta "go.tag.db") -}}
26
26
{{- end -}}
27
27
{{- end }}
28
- {{$fieldName}} {{if and $field.Optional (not (isStructType $field.Type))}}*{{end}}{{template "type" dict "Type" $fieldType "TypeMap" $typeMap}} `{{$jsonTags}}{{$dbTags}}`
28
+ {{$fieldName}} {{if ne $customType ""}}{{$customType}}{{else}}{{if and $field.Optional (not (isStructType $field.Type))}}*{{end}}{{template "type" dict "Type" $field.Type "TypeMap" $typeMap}}{{end }} `{{$jsonTags}}{{$dbTags}}`
29
29
{{- end}}
30
30
}
31
31
{{- end }}
You can’t perform that action at this time.
0 commit comments