Browse Source

fix 修正不合理的名称

dev
lucas 4 months ago
parent
commit
1d3ef4fe9e
  1. 12
      factor.go

12
factor.go

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

Loading…
Cancel
Save