1
1
mirror of https://github.com/wader/fq.git synced 2024-11-29 23:27:12 +03:00
fq/format/postgres/pg_btree.go
2022-12-26 14:47:23 +03:00

38 lines
771 B
Go

package postgres
import (
"embed"
"github.com/wader/fq/format/postgres/common/pg_btree/postgres"
"github.com/wader/fq/format"
"github.com/wader/fq/pkg/decode"
"github.com/wader/fq/pkg/interp"
)
//go:embed pg_btree.md
var pgBTreeFS embed.FS
func init() {
interp.RegisterFormat(decode.Format{
Name: format.PG_BTREE,
Description: "PostgreSQL btree index file",
DecodeFn: decodePgBTree,
DecodeInArg: format.PostgresBTreeIn{
Page: 0,
},
RootArray: true,
RootName: "pages",
})
interp.RegisterFS(pgBTreeFS)
}
func decodePgBTree(d *decode.D, in any) any {
d.Endian = decode.LittleEndian
pgIn, ok := in.(format.PostgresBTreeIn)
if !ok {
d.Fatalf("DecodeInArg must be PostgresBTreeIn!\n")
}
return postgres.DecodePgBTree(d, pgIn)
}