Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
e1b2d61c
Unverified
Commit
e1b2d61c
authored
Aug 06, 2019
by
Kyle Brandt
Committed by
GitHub
Aug 06, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
backend: null.Float NaN -> null for json marshal (#18284)
parent
54f3e873
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
1 deletions
+2
-1
pkg/components/null/float.go
+2
-1
No files found.
pkg/components/null/float.go
View file @
e1b2d61c
...
@@ -4,6 +4,7 @@ import (
...
@@ -4,6 +4,7 @@ import (
"database/sql"
"database/sql"
"encoding/json"
"encoding/json"
"fmt"
"fmt"
"math"
"reflect"
"reflect"
"strconv"
"strconv"
)
)
...
@@ -99,7 +100,7 @@ func (f *Float) UnmarshalText(text []byte) error {
...
@@ -99,7 +100,7 @@ func (f *Float) UnmarshalText(text []byte) error {
// MarshalJSON implements json.Marshaler.
// MarshalJSON implements json.Marshaler.
// It will encode null if this Float is null.
// It will encode null if this Float is null.
func
(
f
Float
)
MarshalJSON
()
([]
byte
,
error
)
{
func
(
f
Float
)
MarshalJSON
()
([]
byte
,
error
)
{
if
!
f
.
Valid
{
if
!
f
.
Valid
||
math
.
IsNaN
(
f
.
Float64
)
{
return
[]
byte
(
nullString
),
nil
return
[]
byte
(
nullString
),
nil
}
}
return
[]
byte
(
strconv
.
FormatFloat
(
f
.
Float64
,
'f'
,
-
1
,
64
)),
nil
return
[]
byte
(
strconv
.
FormatFloat
(
f
.
Float64
,
'f'
,
-
1
,
64
)),
nil
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment