MCPcopy
hub / github.com/sqlc-dev/sqlc / parseGlobalOpts

Function parseGlobalOpts

internal/codegen/golang/opts/options.go:133–147  ·  view source on GitHub ↗
(req *plugin.GenerateRequest)

Source from the content-addressed store, hash-verified

131}
132
133func 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
149func ValidateOpts(opts *Options) error {
150 if opts.EmitMethodsWithDbArgument && opts.EmitPreparedQueries {

Callers 1

ParseFunction · 0.85

Calls 1

parseMethod · 0.45

Tested by

no test coverage detected