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

Support nested UDTs #259

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Support nested UDTs #259

wants to merge 1 commit into from

Conversation

thxph
Copy link

@thxph thxph commented Jul 13, 2023

create type type1 (
    f1 text,
    f2 int,
    );

create type type2 (
    f1 frozen<type1>,
    );

create type type3 (
    f1 frozen<type2>,
    );

---
type Typ1 struct {
	gocqlx.UDT
	F1 string
	F2 int
}
type Typ2 struct {
	gocqlx.UDT
	F1 Typ1
}
type Typ3 struct {
	gocqlx.UDT
	F1 Typ2
}

Says we have the above type definitions, currently the serialization for Typ2 and Typ3 doesn't work because MarshalUDT/UnmarshalUDT doesn't wrap the UDT field with makeUDT before calling gocql's marshaling functions.

This PR updates the MarshalUDT/UnmarshalUDT functions to check if the current field is an UDT and call makeUDT if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant