Returns a list of output-field ColumnMetadata namedtuples
(self)
| 147 | return [arg(name, typ, num) for num, (name, typ) in enumerate(args)] |
| 148 | |
| 149 | def fields(self): |
| 150 | """Returns a list of output-field ColumnMetadata namedtuples""" |
| 151 | |
| 152 | if self.return_type.lower() == "void": |
| 153 | return [] |
| 154 | elif not self.arg_modes: |
| 155 | # For functions without output parameters, the function name |
| 156 | # is used as the name of the output column. |
| 157 | # E.g. 'SELECT unnest FROM unnest(...);' |
| 158 | return [ColumnMetadata(self.func_name, self.return_type, [])] |
| 159 | |
| 160 | return [ |
| 161 | ColumnMetadata(name, typ, []) |
| 162 | for name, typ, mode in zip(self.arg_names, self.arg_types, self.arg_modes) |
| 163 | if mode in ("o", "b", "t") |
| 164 | ] # OUT, INOUT, TABLE |
no test coverage detected