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

commit

parent 7cf20278
......@@ -3,7 +3,6 @@ package model
import (
"database/sql/driver"
"encoding/json"
"strings"
"github.com/rs/zerolog/log"
)
......@@ -11,13 +10,12 @@ import (
type HostList []string
func (h HostList) Value() (driver.Value, error) {
return strings.Join(h, ","), nil
return json.Marshal(h)
}
func (h *HostList) Scan(src interface{}) error {
log.Info().Msgf("Scan host list: %v", src)
*h = strings.Split(src.(string), ",")
return nil
return json.Unmarshal(src.([]byte), h)
}
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