Open
Description
How implement struct for put in crud request?
Example with map
insert := crud.MakeInsertObjectRequest("user").
Object(
crud.MapObject(map[string]interface{}{
"id": userUUID,
"created_at": time.Now().Unix(),
"buc1ket_id": nil,
})).
Context(ctx)
But i want implement myself Object.
I should use this interface:
type encoder = msgpack.Encoder
type decoder = msgpack.Decoder
// Object is an interface to describe object for CRUD methods.
type Object interface {
EncodeMsgpack(enc *encoder)
}
with private field encoder
.
My struct
type Customer struct {
ID string `msgpack:"'id'"`
CreatedAt string `msgpack:"'created_at'"`
BucketID *int64 `msgpack:"'bucket_id'"`
}
func (c *Customer) EncodeMsgpack(enc *msgpack.Encoder) {
enc.Encode(&c)
}
What am i doing wrong?