| 131 | } |
| 132 | |
| 133 | func parseGlobalOpts(req *plugin.GenerateRequest) (*GlobalOptions, error) { |
| 134 | var options GlobalOptions |
| 135 | if len(req.GlobalOptions) == 0 { |
| 136 | return &options, nil |
| 137 | } |
| 138 | if err := json.Unmarshal(req.GlobalOptions, &options); err != nil { |
| 139 | return nil, fmt.Errorf("unmarshalling global options: %w", err) |
| 140 | } |
| 141 | for i := range options.Overrides { |
| 142 | if err := options.Overrides[i].parse(req); err != nil { |
| 143 | return nil, err |
| 144 | } |
| 145 | } |
| 146 | return &options, nil |
| 147 | } |
| 148 | |
| 149 | func ValidateOpts(opts *Options) error { |
| 150 | if opts.EmitMethodsWithDbArgument && opts.EmitPreparedQueries { |