From fd4411453fbd592586601b71f05eb06ea1c74906 Mon Sep 17 00:00:00 2001 From: Jack Christensen Date: Sat, 3 Feb 2024 10:29:10 -0600 Subject: [PATCH] Improve Conn.LoadType documentation --- conn.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/conn.go b/conn.go index deb0f48c6..96ed452d9 100644 --- a/conn.go +++ b/conn.go @@ -1203,7 +1203,15 @@ func (c *Conn) sanitizeForSimpleQuery(sql string, args ...any) (string, error) { return sanitize.SanitizeSQL(sql, valueArgs...) } -// LoadType inspects the database for typeName and produces a pgtype.Type suitable for registration. +// LoadType inspects the database for typeName and produces a pgtype.Type suitable for registration. typeName must be +// the name of a type where the underlying type(s) is already understood by pgx. It is for derived types. In particular, +// typeName must be one of the following: +// - An array type name of a type that is already registered. e.g. "_foo" when "foo" is registered. +// - A composite type name where all field types are already registered. +// - A domain type name where the base type is already registered. +// - An enum type name. +// - A range type name where the element type is already registered. +// - A multirange type name where the element type is already registered. func (c *Conn) LoadType(ctx context.Context, typeName string) (*pgtype.Type, error) { var oid uint32