Skip to content

Support nested UDTs#259

Open
thxph wants to merge 1 commit into
scylladb:masterfrom
thxph:fix-nested-udt
Open

Support nested UDTs#259
thxph wants to merge 1 commit into
scylladb:masterfrom
thxph:fix-nested-udt

Conversation

@thxph
Copy link
Copy Markdown

@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.

@thxph thxph force-pushed the fix-nested-udt branch 4 times, most recently from 548ba18 to f23a5f5 Compare February 19, 2025 08:41
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.

1 participant