mirror of
https://github.com/crowdsecurity/crowdsec.git
synced 2025-05-11 20:36:12 +02:00
logs and user messages: use "parse" and "serialize" instead of marshal/unmarshal (#3240)
This commit is contained in:
parent
1591a0c46e
commit
ce085dc4cd
56 changed files with 87 additions and 87 deletions
|
@ -202,7 +202,7 @@ func (m *Machine) assignValues(columns []string, values []any) error {
|
|||
return fmt.Errorf("unexpected type %T for field hubstate", values[i])
|
||||
} else if value != nil && len(*value) > 0 {
|
||||
if err := json.Unmarshal(*value, &m.Hubstate); err != nil {
|
||||
return fmt.Errorf("unmarshal field hubstate: %w", err)
|
||||
return fmt.Errorf("parsing field hubstate: %w", err)
|
||||
}
|
||||
}
|
||||
case machine.FieldDatasources:
|
||||
|
@ -210,7 +210,7 @@ func (m *Machine) assignValues(columns []string, values []any) error {
|
|||
return fmt.Errorf("unexpected type %T for field datasources", values[i])
|
||||
} else if value != nil && len(*value) > 0 {
|
||||
if err := json.Unmarshal(*value, &m.Datasources); err != nil {
|
||||
return fmt.Errorf("unmarshal field datasources: %w", err)
|
||||
return fmt.Errorf("parsing field datasources: %w", err)
|
||||
}
|
||||
}
|
||||
default:
|
||||
|
|
|
@ -13,8 +13,8 @@ var (
|
|||
ItemNotFound = errors.New("object not found")
|
||||
ParseTimeFail = errors.New("unable to parse time")
|
||||
ParseDurationFail = errors.New("unable to parse duration")
|
||||
MarshalFail = errors.New("unable to marshal")
|
||||
UnmarshalFail = errors.New("unable to unmarshal")
|
||||
MarshalFail = errors.New("unable to serialize")
|
||||
UnmarshalFail = errors.New("unable to parse")
|
||||
BulkError = errors.New("unable to insert bulk")
|
||||
ParseType = errors.New("unable to parse type")
|
||||
InvalidIPOrRange = errors.New("invalid ip address / range")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue