26 lines
541 B
Cheetah
26 lines
541 B
Cheetah
package gen
|
|
|
|
import (
|
|
"github.com/influxdata/platform/tsdb/tsm1"
|
|
"github.com/influxdata/platform/tsdb/cursors"
|
|
)
|
|
|
|
{{range .}}
|
|
{{ $typename := print .Name "Array" }}
|
|
type {{$typename}} struct {
|
|
cursors.{{$typename}}
|
|
}
|
|
|
|
func New{{$typename}}Len(sz int) *{{$typename}} {
|
|
return &{{$typename}}{
|
|
{{$typename}}: cursors.{{$typename}}{
|
|
Timestamps: make([]int64, sz),
|
|
Values: make([]{{.Type}}, sz),
|
|
},
|
|
}
|
|
}
|
|
|
|
func (a *{{$typename}}) Encode(b []byte) ([]byte, error) {
|
|
return tsm1.Encode{{$typename}}Block(&a.{{$typename}}, b)
|
|
}
|
|
{{end}} |