replace retval of ToDB with {}interface(nil) #1044

Closed
koron wants to merge 1 commits from koron/nullable-ToDB into master
koron commented 2018-07-21 05:45:59 +00:00 (Migrated from github.com)

instead of []byte(nil).

current custom types can't be set to NULL.
because some drivers (like lib/pq) don't consider that []byte(nil) is NULL . when ToDB() return nil, it is []byte(nil).

This PR checks return values from ToDB(), and when it is []byte(nil)
translates those to {}interface(nil). it is treated as NULL

instead of `[]byte(nil)`. current custom types can't be set to `NULL`. because some drivers ([like lib/pq](https://github.com/lib/pq/issues/773)) don't consider that `[]byte(nil)` is NULL . when `ToDB()` return `nil`, it is `[]byte(nil)`. This PR checks return values from `ToDB()`, and when it is `[]byte(nil)` translates those to `{}interface(nil)`. it is treated as `NULL`
codecov-io commented 2018-07-21 06:02:26 +00:00 (Migrated from github.com)

Codecov Report

Merging #1044 into master will decrease coverage by 0.04%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1044      +/-   ##
==========================================
- Coverage   54.28%   54.24%   -0.05%     
==========================================
  Files          41       41              
  Lines        7551     7557       +6     
==========================================
  Hits         4099     4099              
- Misses       2936     2941       +5     
- Partials      516      517       +1
Impacted Files Coverage Δ
session_convert.go 22.1% <0%> (-0.19%) ⬇️
statement.go 66.66% <0%> (-0.18%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ad69f7d...19b2069. Read the comment docs.

# [Codecov](https://codecov.io/gh/go-xorm/xorm/pull/1044?src=pr&el=h1) Report > Merging [#1044](https://codecov.io/gh/go-xorm/xorm/pull/1044?src=pr&el=desc) into [master](https://codecov.io/gh/go-xorm/xorm/commit/ad69f7d8f0861a29438154bb0a20b60501298480?src=pr&el=desc) will **decrease** coverage by `0.04%`. > The diff coverage is `0%`. [![Impacted file tree graph](https://codecov.io/gh/go-xorm/xorm/pull/1044/graphs/tree.svg?height=150&width=650&token=yB5nO1krEe&src=pr)](https://codecov.io/gh/go-xorm/xorm/pull/1044?src=pr&el=tree) ```diff @@ Coverage Diff @@ ## master #1044 +/- ## ========================================== - Coverage 54.28% 54.24% -0.05% ========================================== Files 41 41 Lines 7551 7557 +6 ========================================== Hits 4099 4099 - Misses 2936 2941 +5 - Partials 516 517 +1 ``` | [Impacted Files](https://codecov.io/gh/go-xorm/xorm/pull/1044?src=pr&el=tree) | Coverage Δ | | |---|---|---| | [session\_convert.go](https://codecov.io/gh/go-xorm/xorm/pull/1044/diff?src=pr&el=tree#diff-c2Vzc2lvbl9jb252ZXJ0Lmdv) | `22.1% <0%> (-0.19%)` | :arrow_down: | | [statement.go](https://codecov.io/gh/go-xorm/xorm/pull/1044/diff?src=pr&el=tree#diff-c3RhdGVtZW50Lmdv) | `66.66% <0%> (-0.18%)` | :arrow_down: | ------ [Continue to review full report at Codecov](https://codecov.io/gh/go-xorm/xorm/pull/1044?src=pr&el=continue). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta) > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://codecov.io/gh/go-xorm/xorm/pull/1044?src=pr&el=footer). Last update [ad69f7d...19b2069](https://codecov.io/gh/go-xorm/xorm/pull/1044?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
lunny added the
kind
enhancement
label 2020-02-21 05:37:29 +00:00
lunny added this to the 1.1.1 milestone 2020-02-21 05:37:36 +00:00
lunny referenced this issue from a commit 2021-06-09 02:24:02 +00:00
lunny removed this from the 1.1.1 milestone 2021-06-09 02:24:37 +00:00
lunny closed this pull request 2021-06-09 02:24:43 +00:00
lunny deleted branch koron/nullable-ToDB 2021-06-09 02:26:57 +00:00
lunny referenced this issue from a commit 2021-07-11 13:33:01 +00:00

Pull request closed

Sign in to join this conversation.
No description provided.