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

64 lines
1.8 KiB
Go
Raw Normal View History

package postgres
import (
"github.com/wader/fq/format"
2022-08-26 09:53:56 +03:00
"github.com/wader/fq/format/postgres/flavours/pgpro13"
2022-08-05 09:34:24 +03:00
"github.com/wader/fq/format/postgres/flavours/pgpro14"
2022-08-05 13:37:31 +03:00
"github.com/wader/fq/format/postgres/flavours/pgproee10"
2022-08-02 16:40:12 +03:00
"github.com/wader/fq/format/postgres/flavours/pgproee11"
2022-08-04 10:45:59 +03:00
"github.com/wader/fq/format/postgres/flavours/pgproee12"
"github.com/wader/fq/format/postgres/flavours/pgproee13"
2022-08-02 08:43:24 +03:00
"github.com/wader/fq/format/postgres/flavours/pgproee14"
2022-08-03 15:49:12 +03:00
"github.com/wader/fq/format/postgres/flavours/postgres11"
2022-08-03 13:40:31 +03:00
"github.com/wader/fq/format/postgres/flavours/postgres12"
2022-08-04 16:46:27 +03:00
"github.com/wader/fq/format/postgres/flavours/postgres13"
"github.com/wader/fq/format/postgres/flavours/postgres14"
"github.com/wader/fq/pkg/decode"
"github.com/wader/fq/pkg/interp"
)
func init() {
interp.RegisterFormat(decode.Format{
Name: format.PGHEAP,
Description: "PostgreSQL heap file",
DecodeFn: decodePgheap,
DecodeInArg: format.PostgresIn{
Flavour: "default",
},
})
}
func decodePgheap(d *decode.D, in any) any {
d.Endian = decode.LittleEndian
flavour := in.(format.PostgresIn).Flavour
switch flavour {
2022-08-03 15:49:12 +03:00
case PG_FLAVOUR_POSTGRES11:
return postgres11.DecodeHeap(d)
2022-08-03 13:40:31 +03:00
case PG_FLAVOUR_POSTGRES12:
return postgres12.DecodeHeap(d)
2022-08-04 16:46:27 +03:00
case PG_FLAVOUR_POSTGRES13:
return postgres13.DecodeHeap(d)
case PG_FLAVOUR_POSTGRES14, PG_FLAVOUR_POSTGRES:
return postgres14.DecodeHeap(d)
2022-08-05 13:37:31 +03:00
case PG_FLAVOUR_PGPROEE10:
return pgproee10.DecodeHeap(d)
2022-08-02 16:40:12 +03:00
case PG_FLAVOUR_PGPROEE11:
return pgproee11.DecodeHeap(d)
2022-08-04 10:45:59 +03:00
case PG_FLAVOUR_PGPROEE12:
return pgproee12.DecodeHeap(d)
case PG_FLAVOUR_PGPROEE13:
return pgproee13.DecodeHeap(d)
2022-08-26 09:53:56 +03:00
case PG_FLAVOUR_PGPRO13:
return pgpro13.DecodeHeap(d)
2022-08-05 09:34:24 +03:00
case PG_FLAVOUR_PGPRO14:
return pgpro14.DecodeHeap(d)
2022-08-02 08:43:24 +03:00
case PG_FLAVOUR_PGPROEE14:
return pgproee14.DecodeHeap(d)
default:
break
}
return postgres14.DecodeHeap(d)
}