You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+18Lines changed: 18 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -333,6 +333,7 @@ GLOBAL OPTIONS:
333
333
--sqlnullstr Adds a Null{{ENUM}} type for marshalling a nullable string value to sql. If sqlnullint is specified too, it will be Null{{ENUM}}Str (default: false)
334
334
--template value, -t value [ --template value, -t value ] Additional template file(s) to generate enums. Use more than one flag for more files. Templates will be executed in alphabetical order.
335
335
--alias value, -a value [ --alias value, -a value ] Adds or replaces aliases for a non alphanumeric value that needs to be accounted for. [Format should be "key:value,key2:value2", or specify multiple entries, or both!]
336
+
--initialism value [ --initialism value ] Initialism(s) to keep fully uppercased in generated const names (e.g., HTTP,URL,ID). Repeatable.
336
337
--mustparse Adds a Must version of the Parse that will panic on failure. (default: false)
337
338
--forcelower Forces a camel cased comment to generate lowercased names. (default: false)
338
339
--forceupper Forces a camel cased comment to generate uppercased names. (default: false)
@@ -344,6 +345,23 @@ GLOBAL OPTIONS:
344
345
--version, -v print the version
345
346
```
346
347
348
+
### Initialism notes
349
+
350
+
- `--initialism` affects generated const identifiers only. It does not modify enum string values.
351
+
- `--forcelower` and `--forceupper` control enum string values; they are separate from `--initialism`.
352
+
- Initialism rewriting runs after `--alias` replacements and after snake_case to CamelCase conversion.
353
+
- With `--nocamel`, initialisms in underscore-separated segments may not be rewritten because CamelCase conversion is skipped.
354
+
- Rewriting currently runs on the full identifier (including prefix/type-derived segments), not only on the enum value segment.
355
+
356
+
Example:
357
+
358
+
```go
359
+
// ENUM(created)
360
+
type UserId int
361
+
```
362
+
363
+
With `--initialism ID`, the const becomes `UserIDCreated` (the `Id` in the type-derived prefix is rewritten too).
364
+
347
365
### Syntax
348
366
349
367
The parser looks for comments on your type defs and parse the enum declarations from it.
0 commit comments