MCPcopy Create free account
hub / github.com/imgproxy/imgproxy / parseInt

Method parseInt

options/parser/parse.go:118–136  ·  view source on GitHub ↗

parseInt parses a positive integer option value

(
	ctx context.Context,
	o *options.Options,
	key string,
	args ...string,
)

Source from the content-addressed store, hash-verified

116
117// parseInt parses a positive integer option value
118func (p *Parser) parseInt(
119 ctx context.Context,
120 o *options.Options,
121 key string,
122 args ...string,
123) error {
124 if err := p.ensureMaxArgs(ctx, key, args, 1); err != nil {
125 return err
126 }
127
128 i, err := strconv.Atoi(args[0])
129 if err != nil {
130 return newInvalidArgumentError(ctx, key, args[0], "integer number")
131 }
132
133 o.Set(key, i)
134
135 return nil
136}
137
138// parsePositiveNonZeroInt parses a positive non-zero integer option value
139func (p *Parser) parsePositiveNonZeroInt(

Callers 3

applyRotateOptionMethod · 0.95

Calls 3

ensureMaxArgsMethod · 0.95
newInvalidArgumentErrorFunction · 0.85
SetMethod · 0.45

Tested by

no test coverage detected