1
1
mirror of https://github.com/wader/fq.git synced 2024-12-29 16:42:06 +03:00
fq/format/postgres/pg_btree.go

37 lines
739 B
Go
Raw Normal View History

2022-09-19 15:45:54 +03:00
package postgres
import (
2022-09-23 13:50:54 +03:00
"embed"
2022-10-31 14:02:08 +03:00
"github.com/wader/fq/format/postgres/common/pg_btree/postgres"
2022-10-05 19:37:42 +03:00
2022-09-19 15:45:54 +03:00
"github.com/wader/fq/format"
"github.com/wader/fq/pkg/decode"
"github.com/wader/fq/pkg/interp"
)
2022-09-23 13:50:54 +03:00
//go:embed pg_btree.md
var pgBTreeFS embed.FS
2022-09-19 15:45:54 +03:00
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",
2022-09-19 15:45:54 +03:00
})
2022-09-23 13:50:54 +03:00
interp.RegisterFS(pgBTreeFS)
2022-09-19 15:45:54 +03:00
}
func decodePgBTree(d *decode.D, in any) any {
pgIn, ok := in.(format.PostgresBTreeIn)
if !ok {
d.Fatalf("DecodeInArg must be PostgresBTreeIn!\n")
}
return postgres.DecodePgBTree(d, pgIn)
2022-09-19 15:45:54 +03:00
}