Skip to content

Commit

Permalink
Improve Conn.LoadType documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
jackc committed Feb 3, 2024
1 parent 34da2fe commit fd44114
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit fd44114

Please sign in to comment.