NewInvalidFunctionUsageError creates a rejection for a special function.
(class FunctionClass, context string)
| 720 | |
| 721 | // NewInvalidFunctionUsageError creates a rejection for a special function. |
| 722 | func NewInvalidFunctionUsageError(class FunctionClass, context string) error { |
| 723 | var cat string |
| 724 | var code pgcode.Code |
| 725 | switch class { |
| 726 | case AggregateClass: |
| 727 | cat = "aggregate" |
| 728 | code = pgcode.Grouping |
| 729 | case WindowClass: |
| 730 | cat = "window" |
| 731 | code = pgcode.Windowing |
| 732 | case GeneratorClass: |
| 733 | cat = "generator" |
| 734 | code = pgcode.FeatureNotSupported |
| 735 | } |
| 736 | return pgerror.Newf(code, "%s functions are not allowed in %s", cat, context) |
| 737 | } |
| 738 | |
| 739 | // checkFunctionUsage checks whether a given built-in function is |
| 740 | // allowed in the current context. |
no test coverage detected