Module epgsql_oid_db

Holds Oid to Type mappings (forward and reverse).

Authors: Sergey Prokhorov (me@seriyps.ru).

Description

Holds Oid to Type mappings (forward and reverse). See https://www.postgresql.org/docs/current/static/catalog-pg-type.html.

Data Types

db()

abstract datatype: db()

oid()

oid() = non_neg_integer()

Row of typname, oid, typarray from pg_type table.

oid_entry()

oid_entry() = {epgsql:type_name(), Oid::oid(), ArrayOid::oid()}

oid_info()

oid_info() = {Oid::oid(), epgsql:type_name(), IsArray::boolean()}

type_info()

abstract datatype: type_info()

Function Index

build_query/1build query to fetch OID to type_name information from PG server.
find_by_name/3find type by type name.
find_by_oid/2find type by OID.
from_list/1
join_codecs_oids/2Build list of #type{}'s by merging oid and codec lists by type name.
oid_by_name/3lookup OID by type name.
parse_rows/1Parse result of squery(build_query(...))
to_list/1
type_to_codec_entry/1convert type to codec_entry().
type_to_element_oid/1For array types return its element's OID.
type_to_oid_info/1Convert type tp oid_info().
update/2update DB adding new type definitions.

Function Details

build_query/1

build_query(TypeNames::[epgsql:type_name() | binary()]) -> iolist()

build query to fetch OID to type_name information from PG server

find_by_name/3

find_by_name(Name::epgsql:type_name(), IsArray::boolean(), Oid_db::db()) -> type_info()

find type by type name

find_by_oid/2

find_by_oid(Oid::oid(), Oid_db::db()) -> type_info() | undefined

find type by OID

from_list/1

from_list(Types::[type_info()]) -> db()

join_codecs_oids/2

join_codecs_oids(Oids::ordsets:ordset(oid_entry()), Codecs::ordsets:ordset(epgsql_codec:codec_entry())) -> [type_info()]

Build list of #type{}'s by merging oid and codec lists by type name.

oid_by_name/3

oid_by_name(Name::epgsql:type_name(), IsArray::boolean(), Oid_db::db()) -> oid()

lookup OID by type name. May fall

parse_rows/1

parse_rows(Rows::ordsets:ordset({binary(), binary(), binary()})) -> ordsets:ordset(oid_entry())

Parse result of squery(build_query(...))

to_list/1

to_list(Oid_db) -> any()

type_to_codec_entry/1

type_to_codec_entry(Type::type_info()) -> epgsql_codec:codec_entry()

convert type to codec_entry()

type_to_element_oid/1

type_to_element_oid(Type::type_info()) -> oid() | undefined

For array types return its element's OID

type_to_oid_info/1

type_to_oid_info(Type::type_info()) -> oid_info()

Convert type tp oid_info()

update/2

update(Types::[type_info()], Oid_db::db()) -> db()

update DB adding new type definitions. If some of type definitions already exist, old ones will be overwritten by new ones


Generated by EDoc