Skip to content

Allow registration of marshalers #1373

@JonasDoe

Description

@JonasDoe

I tried to match my case into the questionaire. I hope it suffices!

What version of Gocql are you using?

commit ae2f7fc

What did you do?

I have a struct like User { Id: uuid.UUID, Name: string} and I wanted to write it into the database without converting it to a new struct like User { Id: gocql.UUID, Name: string} (or implementing the Marshaler interface to other types, the UUID is just an easy example) by copying every value. This would require me to know any incoming struct which hinders abstraction.

What did you expect to see?

I hoped for a method like qb.Update().WithMarshaler(...). where I could pass the marshalling logic (for example by a marshaling and an unmarshaling function) by type.

What did you see instead?

Well, I've got to define a new type implementing Marshaler so it will be used in marshal.go. Which forces me not only to reconstruct all incoming structs and replace critical fields with marshallers, but also to know every incoming strcuts and prepare a conversion method for each of them.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions