(b *testing.B)
| 2939 | } |
| 2940 | |
| 2941 | func BenchmarkRawFunc_Int64_single(b *testing.B) { |
| 2942 | c := createTestContext("/search?param=1¶m=100", nil, nil) |
| 2943 | |
| 2944 | rawFunc := func(input string, defaultValue int64) (int64, bool) { |
| 2945 | if input == "" { |
| 2946 | return defaultValue, true |
| 2947 | } |
| 2948 | n, err := strconv.Atoi(input) |
| 2949 | if err != nil { |
| 2950 | return 0, false |
| 2951 | } |
| 2952 | return int64(n), true |
| 2953 | } |
| 2954 | |
| 2955 | b.ReportAllocs() |
| 2956 | b.ResetTimer() |
| 2957 | type Opts struct { |
| 2958 | Param int64 |
| 2959 | } |
| 2960 | for i := 0; i < b.N; i++ { |
| 2961 | var dest Opts |
| 2962 | if n, ok := rawFunc(c.QueryParam("param"), 1); ok { |
| 2963 | dest.Param = n |
| 2964 | } |
| 2965 | } |
| 2966 | } |
| 2967 | |
| 2968 | func BenchmarkDefaultBinder_BindInt64_10_fields(b *testing.B) { |
| 2969 | type Opts struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…