proto.ColArr[proto.ColFixedStr]
jootd opened this issue · 4 comments
jootd commented
Hi, Why ColFixedStr struct does not implements Arrayable interface ?
ernado commented
Hi, you can still use NewArray
:
v := proto.NewArray[[]byte](&proto.ColFixedStr{Size: 10})
v.Append([][]byte{
bytes.Repeat([]byte("a"), 10),
bytes.Repeat([]byte("b"), 10),
bytes.Repeat([]byte("c"), 10),
})
v.Append([][]byte{
bytes.Repeat([]byte("d"), 10),
bytes.Repeat([]byte("e"), 10),
bytes.Repeat([]byte("f"), 10),
})
ernado commented
Your type will be
proto.ColArr[[]byte]
Not
proto.ColArr[proto.ColFixedStr]
Like this:
// Array returns new Array(FixedString).
func (c *ColFixedStr) Array() *ColArr[[]byte] {
return &ColArr[[]byte]{
Data: c,
}
}
jootd commented
Yes, I see . And it will work , If DB column type is Array(FixedString(64)) , am I right ?