Automated UDT support
This patch adds the power of GocqlX to UDTs.
Now you can make a struct be UDT compatible by adding a single line.
```
type FullName struct {
gocqlx.UDT
FirstName string
LastName string
}
```
Signed-off-by: Michał Matczuk <michal@scylladb.com>
This commit is contained in:
committed by
Michal Jan Matczuk
parent
2569c3dd8f
commit
ab279e68ed
27
doc_test.go
Normal file
27
doc_test.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package gocqlx_test
|
||||
|
||||
import (
|
||||
"github.com/scylladb/gocqlx"
|
||||
)
|
||||
|
||||
func ExampleUDT() {
|
||||
// Just add gocqlx.UDT to a type, no need to implement marshalling functions
|
||||
type FullName struct {
|
||||
gocqlx.UDT
|
||||
FirstName string
|
||||
LastName string
|
||||
}
|
||||
}
|
||||
|
||||
func ExampleUDT_wraper() {
|
||||
type FullName struct {
|
||||
FirstName string
|
||||
LastName string
|
||||
}
|
||||
|
||||
// Create new UDT wrapper type
|
||||
type FullNameUDT struct {
|
||||
gocqlx.UDT
|
||||
*FullName
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user