mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
types: add exchange name sql value and unmarshalling
This commit is contained in:
parent
5b5f083e92
commit
b0ea2bfe14
|
@ -2,6 +2,7 @@ package types
|
|||
|
||||
import (
|
||||
"context"
|
||||
"database/sql/driver"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
@ -14,9 +15,13 @@ const DateFormat = "2006-01-02"
|
|||
|
||||
type ExchangeName string
|
||||
|
||||
func (n *ExchangeName) Value() (driver.Value, error) {
|
||||
return n.String(), nil
|
||||
}
|
||||
|
||||
func (n *ExchangeName) UnmarshalJSON(data []byte) error {
|
||||
var s string
|
||||
if err := json.Unmarshal(data, &s) ; err != nil {
|
||||
if err := json.Unmarshal(data, &s); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user