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

Cannot auto-read pointers to basic types #121

Open
nettrino opened this issue Jan 2, 2023 · 1 comment
Open

Cannot auto-read pointers to basic types #121

nettrino opened this issue Jan 2, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@nettrino
Copy link

nettrino commented Jan 2, 2023

Bug Report:

Failure to auto-read tx in case of a pointer to a basic type (failed to convert node to value, recovered converToValue: reflect.Value.Convert: value of type string cannot be converted to type *string)

Issue Description

I am currently auto-generating types form gqlgen and adding gogm directives on top of those. However, Optional values are emitted as pointers, which are nil in case the field is empty. As such, if a node has a field of type *string, this fails to deserialise, however succeeds if the field is declared as string.

Steps to Reproduce

Insert and lookup a node like the one below

type Test struct {
	gogm.BaseUUIDNode
	Name     *string      `json:"name,omitempty" gogm:"name=name"`
	Type     string    `json:"type" gogm:"name=type"`
}

Environment

Value
Go Version 1.19.2
GoGM Version 2.3.6
Neo4J Version 4.4.0
Operating System darwin/arm64

Would you be interested in tackling this issue

Yes

@nettrino nettrino added the bug Something isn't working label Jan 2, 2023
@nettrino
Copy link
Author

nettrino commented Jan 3, 2023

Likewise would like to support timestamps as follows:

	UpdatedAt *time.Time `json:"updatedAt,omitempty" gogm:"name=updatedAt"`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant