rest
rest copied to clipboard
Add example of slice types documentation
Lines Of Code
Language | Files | Lines | Code | Comments | Blanks | Complexity | Bytes |
---|---|---|---|---|---|---|---|
Go | 98 | 6666 (+40) | 4839 (+30) | 444 (+2) | 1383 (+8) | 763 | 161.2K (+1.2K) |
Unit Test Coverage
total: (statements) 82.9%
Coverage diff with base branch
Go API Changes
# summary Inferred base version: v0.2.27 Suggested version: v0.2.28
Codecov Report
Merging #75 (4facbfc) into master (35eaff5) will not change coverage. The diff coverage is
n/a
.
@@ Coverage Diff @@
## master #75 +/- ##
=======================================
Coverage 76.98% 76.98%
=======================================
Files 27 27
Lines 1373 1373
=======================================
Hits 1057 1057
Misses 204 204
Partials 112 112
Flag | Coverage Δ | |
---|---|---|
unittests | 76.98% <ø> (ø) |
Flags with carried forward coverage won't be shown. Click here to find out more.
:mega: Codecov can now indicate which changes are the most critical in Pull Requests. Learn more
Benchmark Result
Benchmark diff with base branch
name old time/op new time/op delta
pkg:github.com/swaggest/rest/jsonschema goos:linux goarch:amd64
RequestValidator_ValidateRequestData-2 1.36µs ± 2% 1.38µs ± 4% ~ (p=0.246 n=5+5)
pkg:github.com/swaggest/rest/request goos:linux goarch:amd64
Decoder_Decode-2 725ns ± 4% 724ns ± 5% ~ (p=1.000 n=5+5)
DecoderFunc_Decode-2 2.10µs ± 3% 2.09µs ± 2% ~ (p=0.937 n=5+5)
Decoder_Decode_json-2 23.8µs ± 1% 24.0µs ± 4% ~ (p=0.690 n=5+5)
Decoder_Decode_queryObject-2 5.30µs ± 1% 5.50µs ± 4% ~ (p=0.151 n=5+5)
Decoder_Decode_jsonParam-2 2.00µs ± 1% 2.02µs ± 1% ~ (p=0.056 n=5+5)
DecoderFactory_SetDecoderFunc-2 1.74µs ± 1% 1.73µs ± 0% -0.75% (p=0.032 n=5+4)
pkg:github.com/swaggest/rest/response/gzip goos:linux goarch:amd64
Middleware-2 12.0µs ± 2% 11.9µs ± 1% ~ (p=0.548 n=5+5)
Middleware_control-2 3.32µs ± 1% 3.17µs ± 5% -4.65% (p=0.032 n=4+5)
name old alloc/op new alloc/op delta
pkg:github.com/swaggest/rest/jsonschema goos:linux goarch:amd64
RequestValidator_ValidateRequestData-2 2.46kB ± 0% 2.46kB ± 0% ~ (all equal)
pkg:github.com/swaggest/rest/request goos:linux goarch:amd64
Decoder_Decode-2 440B ± 0% 440B ± 0% ~ (all equal)
DecoderFunc_Decode-2 1.51kB ± 0% 1.51kB ± 0% ~ (all equal)
Decoder_Decode_json-2 12.2kB ± 0% 12.2kB ± 0% ~ (all equal)
Decoder_Decode_queryObject-2 2.00kB ± 0% 2.00kB ± 0% ~ (all equal)
Decoder_Decode_jsonParam-2 736B ± 0% 736B ± 0% ~ (all equal)
DecoderFactory_SetDecoderFunc-2 1.02kB ± 0% 1.02kB ± 0% ~ (all equal)
pkg:github.com/swaggest/rest/response/gzip goos:linux goarch:amd64
Middleware-2 1.17kB ± 2% 1.17kB ± 3% ~ (p=0.786 n=5+5)
Middleware_control-2 11.2kB ± 0% 11.2kB ± 0% ~ (all equal)
name old allocs/op new allocs/op delta
pkg:github.com/swaggest/rest/jsonschema goos:linux goarch:amd64
RequestValidator_ValidateRequestData-2 8.00 ± 0% 8.00 ± 0% ~ (all equal)
pkg:github.com/swaggest/rest/request goos:linux goarch:amd64
Decoder_Decode-2 4.00 ± 0% 4.00 ± 0% ~ (all equal)
DecoderFunc_Decode-2 12.0 ± 0% 12.0 ± 0% ~ (all equal)
Decoder_Decode_json-2 177 ± 0% 177 ± 0% ~ (all equal)
Decoder_Decode_queryObject-2 36.0 ± 0% 36.0 ± 0% ~ (all equal)
Decoder_Decode_jsonParam-2 13.0 ± 0% 13.0 ± 0% ~ (all equal)
DecoderFactory_SetDecoderFunc-2 16.0 ± 0% 16.0 ± 0% ~ (all equal)
pkg:github.com/swaggest/rest/response/gzip goos:linux goarch:amd64
Middleware-2 11.0 ± 0% 11.0 ± 0% ~ (all equal)
Middleware_control-2 9.00 ± 0% 9.00 ± 0% ~ (all equal)
Benchmark result
name time/op
pkg:github.com/swaggest/rest/jsonschema goos:linux goarch:amd64
RequestValidator_ValidateRequestData-2 1.38µs ± 4%
pkg:github.com/swaggest/rest/request goos:linux goarch:amd64
Decoder_Decode-2 724ns ± 5%
DecoderFunc_Decode-2 2.09µs ± 2%
Decoder_Decode_json-2 24.0µs ± 4%
Decoder_Decode_queryObject-2 5.50µs ± 4%
Decoder_Decode_jsonParam-2 2.02µs ± 1%
DecoderFactory_SetDecoderFunc-2 1.73µs ± 0%
pkg:github.com/swaggest/rest/response/gzip goos:linux goarch:amd64
Middleware-2 11.9µs ± 1%
Middleware_control-2 3.17µs ± 5%
name alloc/op
pkg:github.com/swaggest/rest/jsonschema goos:linux goarch:amd64
RequestValidator_ValidateRequestData-2 2.46kB ± 0%
pkg:github.com/swaggest/rest/request goos:linux goarch:amd64
Decoder_Decode-2 440B ± 0%
DecoderFunc_Decode-2 1.51kB ± 0%
Decoder_Decode_json-2 12.2kB ± 0%
Decoder_Decode_queryObject-2 2.00kB ± 0%
Decoder_Decode_jsonParam-2 736B ± 0%
DecoderFactory_SetDecoderFunc-2 1.02kB ± 0%
pkg:github.com/swaggest/rest/response/gzip goos:linux goarch:amd64
Middleware-2 1.17kB ± 3%
Middleware_control-2 11.2kB ± 0%
name allocs/op
pkg:github.com/swaggest/rest/jsonschema goos:linux goarch:amd64
RequestValidator_ValidateRequestData-2 8.00 ± 0%
pkg:github.com/swaggest/rest/request goos:linux goarch:amd64
Decoder_Decode-2 4.00 ± 0%
DecoderFunc_Decode-2 12.0 ± 0%
Decoder_Decode_json-2 177 ± 0%
Decoder_Decode_queryObject-2 36.0 ± 0%
Decoder_Decode_jsonParam-2 13.0 ± 0%
DecoderFactory_SetDecoderFunc-2 16.0 ± 0%
pkg:github.com/swaggest/rest/response/gzip goos:linux goarch:amd64
Middleware-2 11.0 ± 0%
Middleware_control-2 9.00 ± 0%
Examples Benchmark Result
Benchmark diff with base branch
name old time/op new time/op delta
pkg:github.com/swaggest/rest/_examples/advanced goos:linux goarch:amd64
_directGzip-2 22.3µs ± 1% 22.6µs ± 1% +1.70% (p=0.016 n=4+5)
_directGzipHead-2 22.7µs ± 3% 23.6µs ±13% ~ (p=0.310 n=5+5)
_noDirectGzip-2 124µs ± 1% 123µs ± 1% ~ (p=0.690 n=5+5)
_directGzip_decode-2 432µs ± 1% 474µs ± 9% +9.49% (p=0.008 n=5+5)
_noDirectGzip_decode-2 124µs ± 2% 123µs ± 1% ~ (p=0.151 n=5+5)
_jsonBody-2 41.2µs ± 2% 41.7µs ± 2% ~ (p=0.222 n=5+5)
_jsonBodyValidation-2 47.6µs ± 2% 48.6µs ± 1% +2.07% (p=0.032 n=5+5)
_outputHeaders-2 22.0µs ± 1% 22.5µs ± 1% +2.36% (p=0.016 n=5+5)
_requestResponseMapping-2 41.2µs ± 3% 40.6µs ± 1% ~ (p=0.151 n=5+5)
_validation-2 43.3µs ± 1% 43.7µs ± 1% ~ (p=0.056 n=5+5)
_noValidation-2 31.9µs ± 1% 32.9µs ± 1% +3.03% (p=0.008 n=5+5)
pkg:github.com/swaggest/rest/_examples/advanced-generic goos:linux goarch:amd64
_directGzip-2 23.4µs ±13% 23.0µs ± 0% ~ (p=0.690 n=5+5)
_directGzipHead-2 22.4µs ± 1% 22.8µs ± 1% +1.71% (p=0.016 n=5+4)
_noDirectGzip-2 124µs ± 1% 126µs ± 3% ~ (p=0.310 n=5+5)
_directGzip_decode-2 428µs ± 0% 439µs ± 2% +2.66% (p=0.008 n=5+5)
_noDirectGzip_decode-2 124µs ± 1% 125µs ± 1% +1.46% (p=0.032 n=5+5)
_jsonBody-2 40.9µs ± 3% 42.1µs ± 2% +2.96% (p=0.032 n=5+5)
_jsonBodyValidation-2 48.5µs ± 2% 48.3µs ± 1% ~ (p=0.421 n=5+5)
_outputHeaders-2 22.1µs ± 1% 22.1µs ± 1% ~ (p=0.746 n=5+5)
_requestResponseMapping-2 40.5µs ± 1% 40.8µs ± 1% ~ (p=0.151 n=5+5)
_validation-2 43.7µs ± 1% 44.3µs ± 1% +1.48% (p=0.016 n=5+5)
_noValidation-2 32.3µs ± 3% 32.5µs ± 1% ~ (p=0.421 n=5+5)
pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64
_notFoundSrv-2 25.8µs ± 0% 26.0µs ± 1% ~ (p=0.063 n=4+5)
_ok-2 26.6µs ± 2% 27.7µs ±17% ~ (p=0.841 n=5+5)
_invalidBody-2 36.6µs ± 1% 36.3µs ± 2% ~ (p=0.095 n=5+5)
name old B:rcvd/op new B:rcvd/op delta
pkg:github.com/swaggest/rest/_examples/advanced goos:linux goarch:amd64
_directGzip-2 639 ± 0% 639 ± 0% ~ (all equal)
_directGzipHead-2 183 ± 0% 183 ± 0% ~ (all equal)
_noDirectGzip-2 1.04k ± 0% 1.04k ± 0% ~ (all equal)
_directGzip_decode-2 639 ± 0% 639 ± 0% ~ (all equal)
_noDirectGzip_decode-2 1.04k ± 0% 1.04k ± 0% ~ (all equal)
_jsonBody-2 208 ± 0% 208 ± 0% ~ (all equal)
_jsonBodyValidation-2 194 ± 0% 194 ± 0% ~ (all equal)
_outputHeaders-2 155 ± 0% 155 ± 0% ~ (all equal)
_requestResponseMapping-2 94.0 ± 0% 94.0 ± 0% ~ (all equal)
_validation-2 177 ± 0% 177 ± 0% ~ (all equal)
_noValidation-2 177 ± 0% 177 ± 0% ~ (all equal)
pkg:github.com/swaggest/rest/_examples/advanced-generic goos:linux goarch:amd64
_directGzip-2 639 ± 0% 639 ± 0% ~ (all equal)
_directGzipHead-2 183 ± 0% 183 ± 0% ~ (all equal)
_noDirectGzip-2 1.04k ± 0% 1.04k ± 0% ~ (all equal)
_directGzip_decode-2 639 ± 0% 639 ± 0% ~ (all equal)
_noDirectGzip_decode-2 1.04k ± 0% 1.04k ± 0% ~ (all equal)
_jsonBody-2 208 ± 0% 208 ± 0% ~ (all equal)
_jsonBodyValidation-2 194 ± 0% 194 ± 0% ~ (all equal)
_outputHeaders-2 155 ± 0% 155 ± 0% ~ (all equal)
_requestResponseMapping-2 94.0 ± 0% 94.0 ± 0% ~ (all equal)
_validation-2 177 ± 0% 177 ± 0% ~ (all equal)
_noValidation-2 177 ± 0% 177 ± 0% ~ (all equal)
pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64
_notFoundSrv-2 337 ± 0% 337 ± 0% ~ (all equal)
_ok-2 359 ± 0% 359 ± 0% ~ (all equal)
_invalidBody-2 435 ± 0% 435 ± 0% ~ (all equal)
name old B:sent/op new B:sent/op delta
pkg:github.com/swaggest/rest/_examples/advanced goos:linux goarch:amd64
_directGzip-2 103 ± 0% 103 ± 0% ~ (all equal)
_directGzipHead-2 104 ± 0% 104 ± 0% ~ (all equal)
_noDirectGzip-2 117 ± 0% 117 ± 0% ~ (all equal)
_directGzip_decode-2 116 ± 0% 116 ± 0% ~ (all equal)
_noDirectGzip_decode-2 130 ± 0% 130 ± 0% ~ (all equal)
_jsonBody-2 188 ± 0% 188 ± 0% ~ (all equal)
_jsonBodyValidation-2 192 ± 0% 192 ± 0% ~ (all equal)
_outputHeaders-2 77.0 ± 0% 77.0 ± 0% ~ (all equal)
_requestResponseMapping-2 169 ± 0% 169 ± 0% ~ (all equal)
_validation-2 170 ± 0% 170 ± 0% ~ (all equal)
_noValidation-2 173 ± 0% 173 ± 0% ~ (all equal)
pkg:github.com/swaggest/rest/_examples/advanced-generic goos:linux goarch:amd64
_directGzip-2 103 ± 0% 103 ± 0% ~ (all equal)
_directGzipHead-2 104 ± 0% 104 ± 0% ~ (all equal)
_noDirectGzip-2 117 ± 0% 117 ± 0% ~ (all equal)
_directGzip_decode-2 116 ± 0% 116 ± 0% ~ (all equal)
_noDirectGzip_decode-2 130 ± 0% 130 ± 0% ~ (all equal)
_jsonBody-2 188 ± 0% 188 ± 0% ~ (all equal)
_jsonBodyValidation-2 192 ± 0% 192 ± 0% ~ (all equal)
_outputHeaders-2 77.0 ± 0% 77.0 ± 0% ~ (all equal)
_requestResponseMapping-2 169 ± 0% 169 ± 0% ~ (all equal)
_validation-2 170 ± 0% 170 ± 0% ~ (all equal)
_noValidation-2 173 ± 0% 173 ± 0% ~ (all equal)
pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64
_notFoundSrv-2 74.0 ± 0% 74.0 ± 0% ~ (all equal)
_ok-2 74.0 ± 0% 74.0 ± 0% ~ (all equal)
_invalidBody-2 137 ± 0% 137 ± 0% ~ (all equal)
name old rps new rps delta
pkg:github.com/swaggest/rest/_examples/advanced goos:linux goarch:amd64
_directGzip-2 44.9k ± 1% 44.2k ± 1% -1.67% (p=0.016 n=4+5)
_directGzipHead-2 44.1k ± 3% 42.6k ±12% ~ (p=0.310 n=5+5)
_noDirectGzip-2 8.09k ± 1% 8.10k ± 1% ~ (p=0.690 n=5+5)
_directGzip_decode-2 2.31k ± 1% 2.12k ± 9% -8.47% (p=0.008 n=5+5)
_noDirectGzip_decode-2 8.06k ± 2% 8.15k ± 1% ~ (p=0.151 n=5+5)
_jsonBody-2 24.3k ± 2% 24.0k ± 2% ~ (p=0.222 n=5+5)
_jsonBodyValidation-2 21.0k ± 2% 20.6k ± 1% -2.05% (p=0.032 n=5+5)
_outputHeaders-2 45.5k ± 1% 44.4k ± 1% -2.31% (p=0.016 n=5+5)
_requestResponseMapping-2 24.3k ± 3% 24.6k ± 1% ~ (p=0.151 n=5+5)
_validation-2 23.1k ± 1% 22.9k ± 1% ~ (p=0.056 n=5+5)
_noValidation-2 31.3k ± 1% 30.4k ± 1% -2.94% (p=0.008 n=5+5)
pkg:github.com/swaggest/rest/_examples/advanced-generic goos:linux goarch:amd64
_directGzip-2 42.9k ±12% 43.5k ± 0% ~ (p=0.690 n=5+5)
_directGzipHead-2 44.6k ± 1% 43.8k ± 1% -1.68% (p=0.016 n=5+4)
_noDirectGzip-2 8.07k ± 1% 7.97k ± 3% ~ (p=0.246 n=5+5)
_directGzip_decode-2 2.34k ± 0% 2.28k ± 2% -2.57% (p=0.008 n=5+5)
_noDirectGzip_decode-2 8.09k ± 1% 7.98k ± 1% -1.44% (p=0.032 n=5+5)
_jsonBody-2 24.4k ± 3% 23.7k ± 2% -2.88% (p=0.032 n=5+5)
_jsonBodyValidation-2 20.6k ± 2% 20.7k ± 1% ~ (p=0.421 n=5+5)
_outputHeaders-2 45.3k ± 1% 45.2k ± 1% ~ (p=0.841 n=5+5)
_requestResponseMapping-2 24.7k ± 1% 24.5k ± 1% ~ (p=0.151 n=5+5)
_validation-2 22.9k ± 1% 22.6k ± 1% -1.45% (p=0.016 n=5+5)
_noValidation-2 31.0k ± 3% 30.7k ± 1% ~ (p=0.421 n=5+5)
pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64
_notFoundSrv-2 38.7k ± 0% 38.4k ± 1% ~ (p=0.063 n=4+5)
_ok-2 37.7k ± 2% 36.3k ±15% ~ (p=0.841 n=5+5)
_invalidBody-2 27.3k ± 1% 27.5k ± 2% ~ (p=0.095 n=5+5)
name old alloc/op new alloc/op delta
pkg:github.com/swaggest/rest/_examples/advanced goos:linux goarch:amd64
_directGzip-2 3.92kB ± 0% 3.92kB ± 0% ~ (p=0.397 n=5+5)
_directGzipHead-2 3.92kB ± 0% 3.92kB ± 0% ~ (p=0.873 n=5+5)
_noDirectGzip-2 6.68kB ±22% 6.53kB ±14% ~ (p=0.690 n=5+5)
_directGzip_decode-2 403kB ± 0% 403kB ± 0% ~ (p=0.310 n=5+5)
_noDirectGzip_decode-2 5.44kB ± 5% 5.61kB ± 9% ~ (p=0.548 n=5+5)
_jsonBody-2 13.2kB ± 0% 13.2kB ± 0% ~ (p=0.833 n=5+5)
_jsonBodyValidation-2 19.0kB ± 0% 19.0kB ± 0% ~ (p=0.246 n=5+5)
_outputHeaders-2 3.71kB ± 0% 3.71kB ± 0% ~ (p=1.000 n=5+5)
_requestResponseMapping-2 16.7kB ± 0% 16.7kB ± 0% ~ (p=0.587 n=5+5)
_validation-2 16.6kB ± 0% 16.6kB ± 0% ~ (p=0.357 n=5+5)
_noValidation-2 7.88kB ± 0% 7.88kB ± 0% ~ (p=0.802 n=5+5)
pkg:github.com/swaggest/rest/_examples/advanced-generic goos:linux goarch:amd64
_directGzip-2 3.94kB ± 0% 3.94kB ± 0% +0.03% (p=0.029 n=4+4)
_directGzipHead-2 3.93kB ± 0% 3.93kB ± 0% ~ (p=0.484 n=5+5)
_noDirectGzip-2 6.57kB ±21% 6.48kB ±17% ~ (p=0.690 n=5+5)
_directGzip_decode-2 403kB ± 0% 403kB ± 0% ~ (p=0.421 n=5+5)
_noDirectGzip_decode-2 5.63kB ± 9% 5.96kB ± 7% ~ (p=0.222 n=5+5)
_jsonBody-2 13.3kB ± 0% 13.3kB ± 0% ~ (p=0.532 n=5+5)
_jsonBodyValidation-2 19.1kB ± 0% 19.1kB ± 0% ~ (p=0.881 n=5+5)
_outputHeaders-2 3.71kB ± 0% 3.71kB ± 0% ~ (p=0.238 n=5+5)
_requestResponseMapping-2 16.7kB ± 0% 16.7kB ± 0% ~ (p=0.968 n=5+5)
_validation-2 16.6kB ± 0% 16.6kB ± 0% ~ (p=0.190 n=5+5)
_noValidation-2 7.91kB ± 0% 7.91kB ± 0% ~ (p=0.468 n=5+5)
pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64
_notFoundSrv-2 4.88kB ± 0% 4.88kB ± 0% ~ (p=0.905 n=5+5)
_ok-2 4.78kB ± 0% 4.78kB ± 0% ~ (p=0.686 n=4+4)
_invalidBody-2 8.67kB ± 0% 8.67kB ± 0% ~ (p=1.000 n=4+4)
name old allocs/op new allocs/op delta
pkg:github.com/swaggest/rest/_examples/advanced goos:linux goarch:amd64
_directGzip-2 42.0 ± 0% 42.0 ± 0% ~ (all equal)
_directGzipHead-2 42.0 ± 0% 42.0 ± 0% ~ (all equal)
_noDirectGzip-2 49.6 ± 3% 49.6 ± 3% ~ (p=1.000 n=5+5)
_directGzip_decode-2 501 ± 0% 500 ± 0% ~ (p=0.095 n=4+5)
_noDirectGzip_decode-2 50.0 ± 0% 50.0 ± 0% ~ (all equal)
_jsonBody-2 130 ± 0% 130 ± 0% ~ (all equal)
_jsonBodyValidation-2 186 ± 0% 186 ± 0% ~ (all equal)
_outputHeaders-2 37.0 ± 0% 37.0 ± 0% ~ (all equal)
_requestResponseMapping-2 126 ± 0% 126 ± 0% ~ (all equal)
_validation-2 155 ± 0% 155 ± 0% ~ (all equal)
_noValidation-2 92.0 ± 0% 92.0 ± 0% ~ (all equal)
pkg:github.com/swaggest/rest/_examples/advanced-generic goos:linux goarch:amd64
_directGzip-2 43.0 ± 0% 43.0 ± 0% ~ (all equal)
_directGzipHead-2 43.0 ± 0% 43.0 ± 0% ~ (all equal)
_noDirectGzip-2 50.4 ± 3% 50.4 ± 3% ~ (p=1.000 n=5+5)
_directGzip_decode-2 502 ± 0% 501 ± 0% ~ (p=0.095 n=4+5)
_noDirectGzip_decode-2 51.0 ± 0% 51.0 ± 0% ~ (all equal)
_jsonBody-2 131 ± 0% 131 ± 0% ~ (all equal)
_jsonBodyValidation-2 187 ± 0% 187 ± 0% ~ (all equal)
_outputHeaders-2 37.0 ± 0% 37.0 ± 0% ~ (all equal)
_requestResponseMapping-2 127 ± 0% 127 ± 0% ~ (all equal)
_validation-2 156 ± 0% 156 ± 0% ~ (all equal)
_noValidation-2 93.0 ± 0% 93.0 ± 0% ~ (all equal)
pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64
_notFoundSrv-2 54.0 ± 0% 54.0 ± 0% ~ (all equal)
_ok-2 50.0 ± 0% 50.0 ± 0% ~ (all equal)
_invalidBody-2 100 ± 0% 100 ± 0% ~ (all equal)