Skip to content

Commit

Permalink
Add *[TYPE] to [TYPE]ptr methods
Browse files Browse the repository at this point in the history
  • Loading branch information
aq17 committed Dec 5, 2022
1 parent 20e5b33 commit 42cb12d
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
@@ -0,0 +1,4 @@
changes:
- type: feat
scope: sdk
description: Add methods to cast pointer types to corresponding Pulumi Ptr types
6 changes: 6 additions & 0 deletions sdk/go/pulumi/generate/templates/types_builtins.go.template
Expand Up @@ -47,6 +47,12 @@ type {{.PtrType}} {{.ElemElementType}}
func {{.Name}}(v {{.ElemElementType}}) {{.Name}}Input {
return ({{.InputType}})(&v)
}
func {{.Name}}FromPtr(v *{{.ElemElementType}}) {{.Name}}Input {
if v == nil {
return nil
}
return ({{.InputType}})(v)
}
{{end}}
{{if .DefineInputMethods}}
// ElementType returns the element type of this Input ({{.ElementType}}).
Expand Down
36 changes: 36 additions & 0 deletions sdk/go/pulumi/types_builtins.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 42cb12d

Please sign in to comment.