|
|
@ -15,13 +15,13 @@ type Factor struct { |
|
|
|
} |
|
|
|
|
|
|
|
// redis序列化
|
|
|
|
func (p *Factor) MarshalBinary() (data []byte, err error) { |
|
|
|
return json.Marshal(p) |
|
|
|
func (f *Factor) MarshalBinary() (data []byte, err error) { |
|
|
|
return json.Marshal(f) |
|
|
|
} |
|
|
|
|
|
|
|
// redis序列化
|
|
|
|
func (p *Factor) UnmarshalBinary(data []byte) error { |
|
|
|
return json.Unmarshal(data, p) |
|
|
|
func (f *Factor) UnmarshalBinary(data []byte) error { |
|
|
|
return json.Unmarshal(data, f) |
|
|
|
} |
|
|
|
|
|
|
|
type ProtoItem struct { |
|
|
@ -58,6 +58,10 @@ func (f *Factor) GetFieldNames() []string { |
|
|
|
} |
|
|
|
|
|
|
|
func (p *Proto) GetProtoItem(fieldName string) *ProtoItem { |
|
|
|
if fieldName == "" { |
|
|
|
return &ProtoItem{} |
|
|
|
} |
|
|
|
|
|
|
|
for _, item := range p.Items { |
|
|
|
if item.FieldName == fieldName { |
|
|
|
return &item |
|
|
|