Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add *[TYPE] to [TYPE]Ptr methods #11539

Merged
merged 1 commit into from Dec 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -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.