A VSCode extension to automatically generate getters (standard + nilsafe methods) and setters for struct fields.
GetName() string
GetNameOrNil() *string
=> allows (panic free) optional chainingSetName(name string) *Struct
=> allows method chaining
A fork of ggsg
- Added support for nilsafe getters
GetNameOrNil() *string
=> additional feature that allows (panic free) optional chaining - Added support for imported packages
[]*time.Time
(bug fix) - Added support for
[]*Struct
and[]Struct
fields (bug fix)
This extension generates pointer receivers. Setters always return the struct pointer to allow method chaining.
- Select a struct and some or all of its fields
Shift+CMD+P
Select command & return
Note: The first line in your selection should always be a struct declaration. The extension will only generate getters and setters for selected fields.
None at the moment
None
- Added support for
map[string]interface{}
types
- Insert code below the struct declaration instead of EOF
// ## GENERATED - Getters & Setters for 'Invoice' ##
comment added above generated code// ## END GENERATED - Getters & Setters for 'Invoice' ##
comment added below generated code
- Added support for nilsafe getters
GetNameOrNil() *string
- Added support for imported packages
[]*time.Time
- Added support for
[]*Struct
and[]Struct
fields
Initial release of ggsgornil
Hope you enjoy this extension!