Function
toJsonCamelCase
(name string, idUppercase bool)
Source from the content-addressed store, hash-verified
| 113 | } |
| 114 | |
| 115 | func toJsonCamelCase(name string, idUppercase bool) string { |
| 116 | out := "" |
| 117 | idStr := "Id" |
| 118 | |
| 119 | if idUppercase { |
| 120 | idStr = "ID" |
| 121 | } |
| 122 | |
| 123 | for i, p := range strings.Split(name, "_") { |
| 124 | if i == 0 { |
| 125 | out += p |
| 126 | continue |
| 127 | } |
| 128 | if p == "id" { |
| 129 | out += idStr |
| 130 | } else { |
| 131 | out += strings.Title(p) |
| 132 | } |
| 133 | } |
| 134 | return out |
| 135 | } |
| 136 | |
| 137 | func toLowerCase(str string) string { |
| 138 | if str == "" { |
Tested by
no test coverage detected