Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add JSON marshaler for JSON container #18

Merged
merged 2 commits into from
Apr 5, 2024
Merged

Add JSON marshaler for JSON container #18

merged 2 commits into from
Apr 5, 2024

Conversation

vearutop
Copy link
Member

@vearutop vearutop commented Apr 5, 2024

No description provided.

Copy link

github-actions bot commented Apr 5, 2024

Lines Of Code

Language Files Lines Code Comments Blanks Complexity Bytes
Go 6 1305 (+10) 888 (+6) 129 (+2) 288 (+2) 228 29.1K (+268B)
Go (test) 9 1945 (+57) 1502 (+40) 64 379 (+17) 60 45.3K (+1.6K)
YAML 6 486 (+1) 400 (+1) 36 50 0 16.1K (+14B)

Copy link

github-actions bot commented Apr 5, 2024

Go API Changes

# github.com/bool64/sqluct
## compatible changes
(*JSON[V]).UnmarshalJSON: added
JSON[V].MarshalJSON: added

# summary
Inferred base version: v0.2.1
Suggested version: v0.3.0

Copy link

github-actions bot commented Apr 5, 2024

Unit Test Coverage

total: (statements) 76.4%
changed lines: (statements) 100.0%

Coverage of changed lines
File Function Coverage
Total 100.0%
storage.go 100.0%
storage.go:126 InTx 100.0%
storage_go1.18.go 100.0%
storage_go1.18.go:165 UnmarshalJSON 100.0%
storage_go1.18.go:170 MarshalJSON 100.0%
Coverage diff with base branch
File Function Base Coverage Current Coverage
Total 75.2% 76.4% (+1.2%)
storage_go1.18.go MarshalJSON no function 100.0%
storage_go1.18.go Scan 0.0% 50.0% (+50.0%)
storage_go1.18.go UnmarshalJSON no function 100.0%
storage_go1.18.go Value 0.0% 100.0% (+100.0%)

Copy link

github-actions bot commented Apr 5, 2024

Benchmark Result

Benchmark diff with base branch
name                                 old time/op    new time/op    delta
Mapper_Insert_single-4                 5.35µs ± 0%    5.42µs ± 0%  +1.43%  (p=0.004 n=5+6)
Mapper_Insert_singleOmitempty-4        4.83µs ± 0%    4.91µs ± 1%  +1.59%  (p=0.004 n=5+6)
Mapper_Insert_slice_heterogeneous-4    11.0µs ± 1%    11.1µs ± 0%  +1.08%  (p=0.009 n=6+5)
Mapper_Insert_slice_homogeneous-4      8.16µs ± 1%    8.33µs ± 0%  +2.13%  (p=0.004 n=6+5)
Mapper_Select_struct-4                 4.23µs ± 0%    4.26µs ± 0%  +0.82%  (p=0.002 n=6+6)
Mapper_Select_ref-4                    8.67µs ± 0%    8.87µs ± 0%  +2.29%  (p=0.004 n=6+5)
Referencer_Fmt_full-4                  19.6µs ± 4%    19.4µs ± 7%    ~     (p=0.310 n=6+6)
Referencer_Fmt_lite-4                  7.79µs ± 1%    8.09µs ± 1%  +3.80%  (p=0.002 n=6+6)
Referencer_Fmt_raw-4                   5.65µs ± 1%    5.75µs ± 0%  +1.82%  (p=0.002 n=6+6)

name                                 old alloc/op   new alloc/op   delta
Mapper_Insert_single-4                 3.11kB ± 0%    3.11kB ± 0%    ~     (all equal)
Mapper_Insert_singleOmitempty-4        2.74kB ± 0%    2.74kB ± 0%    ~     (all equal)
Mapper_Insert_slice_heterogeneous-4    6.25kB ± 0%    6.25kB ± 0%    ~     (all equal)
Mapper_Insert_slice_homogeneous-4      4.59kB ± 0%    4.59kB ± 0%    ~     (all equal)
Mapper_Select_struct-4                 2.82kB ± 0%    2.82kB ± 0%    ~     (all equal)
Mapper_Select_ref-4                    5.06kB ± 0%    5.06kB ± 0%    ~     (all equal)
Referencer_Fmt_full-4                  9.09kB ± 1%    9.03kB ± 3%    ~     (p=0.240 n=6+6)
Referencer_Fmt_lite-4                  4.40kB ± 0%    4.40kB ± 0%    ~     (all equal)
Referencer_Fmt_raw-4                   4.20kB ± 0%    4.20kB ± 0%    ~     (all equal)

name                                 old allocs/op  new allocs/op  delta
Mapper_Insert_single-4                   68.0 ± 0%      68.0 ± 0%    ~     (all equal)
Mapper_Insert_singleOmitempty-4          61.0 ± 0%      61.0 ± 0%    ~     (all equal)
Mapper_Insert_slice_heterogeneous-4       138 ± 0%       138 ± 0%    ~     (all equal)
Mapper_Insert_slice_homogeneous-4         101 ± 0%       101 ± 0%    ~     (all equal)
Mapper_Select_struct-4                   50.0 ± 0%      50.0 ± 0%    ~     (all equal)
Mapper_Select_ref-4                       108 ± 0%       108 ± 0%    ~     (all equal)
Referencer_Fmt_full-4                     123 ± 0%       123 ± 0%    ~     (all equal)
Referencer_Fmt_lite-4                    92.0 ± 0%      92.0 ± 0%    ~     (all equal)
Referencer_Fmt_raw-4                     66.0 ± 0%      66.0 ± 0%    ~     (all equal)
Benchmark result
name                                 time/op
Mapper_Insert_single-4               5.42µs ± 0%
Mapper_Insert_singleOmitempty-4      4.91µs ± 1%
Mapper_Insert_slice_heterogeneous-4  11.1µs ± 0%
Mapper_Insert_slice_homogeneous-4    8.33µs ± 0%
Mapper_Select_struct-4               4.26µs ± 0%
Mapper_Select_ref-4                  8.87µs ± 0%
Referencer_Fmt_full-4                19.4µs ± 7%
Referencer_Fmt_lite-4                8.09µs ± 1%
Referencer_Fmt_raw-4                 5.75µs ± 0%

name                                 alloc/op
Mapper_Insert_single-4               3.11kB ± 0%
Mapper_Insert_singleOmitempty-4      2.74kB ± 0%
Mapper_Insert_slice_heterogeneous-4  6.25kB ± 0%
Mapper_Insert_slice_homogeneous-4    4.59kB ± 0%
Mapper_Select_struct-4               2.82kB ± 0%
Mapper_Select_ref-4                  5.06kB ± 0%
Referencer_Fmt_full-4                9.03kB ± 3%
Referencer_Fmt_lite-4                4.40kB ± 0%
Referencer_Fmt_raw-4                 4.20kB ± 0%

name                                 allocs/op
Mapper_Insert_single-4                 68.0 ± 0%
Mapper_Insert_singleOmitempty-4        61.0 ± 0%
Mapper_Insert_slice_heterogeneous-4     138 ± 0%
Mapper_Insert_slice_homogeneous-4       101 ± 0%
Mapper_Select_struct-4                 50.0 ± 0%
Mapper_Select_ref-4                     108 ± 0%
Referencer_Fmt_full-4                   123 ± 0%
Referencer_Fmt_lite-4                  92.0 ± 0%
Referencer_Fmt_raw-4                   66.0 ± 0%

@vearutop vearutop merged commit ca130b3 into master Apr 5, 2024
7 checks passed
@vearutop vearutop deleted the json-container branch April 5, 2024 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant