Commit 08f46675 authored by qiuqunfeng's avatar qiuqunfeng
Browse files

commit

parent 7cf20278
...@@ -3,7 +3,6 @@ package model ...@@ -3,7 +3,6 @@ package model
import ( import (
"database/sql/driver" "database/sql/driver"
"encoding/json" "encoding/json"
"strings"
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
) )
...@@ -11,13 +10,12 @@ import ( ...@@ -11,13 +10,12 @@ import (
type HostList []string type HostList []string
func (h HostList) Value() (driver.Value, error) { func (h HostList) Value() (driver.Value, error) {
return strings.Join(h, ","), nil return json.Marshal(h)
} }
func (h *HostList) Scan(src interface{}) error { func (h *HostList) Scan(src interface{}) error {
log.Info().Msgf("Scan host list: %v", src) log.Info().Msgf("Scan host list: %v", src)
*h = strings.Split(src.(string), ",") return json.Unmarshal(src.([]byte), h)
return nil
} }
type RuleCategoryStatus struct { type RuleCategoryStatus struct {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment