mirror of https://github.com/prometheus/prometheus
Merge pull request #845 from prometheus/fabxc/apifix
promql: add MarshalJSON method for ExprType.pull/849/head
commit
689ed7978f
|
@ -14,6 +14,7 @@
|
|||
package promql
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
|
@ -97,6 +98,11 @@ const (
|
|||
ExprString
|
||||
)
|
||||
|
||||
// MarshalJSON implements json.Marshaler.
|
||||
func (et ExprType) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(et.String())
|
||||
}
|
||||
|
||||
func (e ExprType) String() string {
|
||||
switch e {
|
||||
case ExprNone:
|
||||
|
|
Loading…
Reference in New Issue