promql: add MarshalJSON method for ExprType.

This commit is contained in:
Fabian Reinartz 2015-06-25 12:01:26 +02:00
parent 52859b8033
commit 7f85b9b215
1 changed files with 6 additions and 0 deletions

View File

@ -14,6 +14,7 @@
package promql package promql
import ( import (
"encoding/json"
"fmt" "fmt"
"time" "time"
@ -97,6 +98,11 @@ const (
ExprString ExprString
) )
// MarshalJSON implements json.Marshaler.
func (et ExprType) MarshalJSON() ([]byte, error) {
return json.Marshal(et.String())
}
func (e ExprType) String() string { func (e ExprType) String() string {
switch e { switch e {
case ExprNone: case ExprNone: