Golang UnmarshalJSONEnum示例

说明

golang unmarshaljsonenum示例是从最受好评的开源项目中提取的实现代码,你可以参考下面示例的使用方式。

编程语言: Golang

命名空间/包名称: github.com/golang/protobuf/proto

示例#1
文件: ActionExecution.pb.go 项目: DongyiYang/vmturbo-go-sdk

func (x *ActionItemDTO_CommodityAttribute) UnmarshalJSON(data []byte) error {
	value, err := proto.UnmarshalJSONEnum(ActionItemDTO_CommodityAttribute_value, data, "ActionItemDTO_CommodityAttribute")
	if err != nil {
		return err
	}
	*x = ActionItemDTO_CommodityAttribute(value)
	return nil
}

示例#2
文件: system.pb.go 项目: Slacki/go-steam

func (x *EGCToGCMsg) UnmarshalJSON(data []byte) error {
	value, err := proto.UnmarshalJSONEnum(EGCToGCMsg_value, data, "EGCToGCMsg")
	if err != nil {
		return err
	}
	*x = EGCToGCMsg(value)
	return nil
}

示例#3
文件: urlfetch_service.pb.go 项目: Celluliodio/flannel

func (x *URLFetchServiceError_ErrorCode) UnmarshalJSON(data []byte) error {
	value, err := proto.UnmarshalJSONEnum(URLFetchServiceError_ErrorCode_value, data, "URLFetchServiceError_ErrorCode")
	if err != nil {
		return err
	}
	*x = URLFetchServiceError_ErrorCode(value)
	return nil
}

示例#4
文件: TextSecure.pb.go 项目: elimisteve/textsecure

func (x *Envelope_Type) UnmarshalJSON(data []byte) error {
	value, err := proto.UnmarshalJSONEnum(Envelope_Type_value, data, "Envelope_Type")
	if err != nil {
		return err
	}
	*x = Envelope_Type(value)
	return nil
}

示例#5
文件: gcsdk.pb.go 项目: Inkp/go-steam

func (x *PartnerAccountType) UnmarshalJSON(data []byte) error {
	value, err := proto.UnmarshalJSONEnum(PartnerAccountType_value, data, "PartnerAccountType")
	if err != nil {
		return err
	}
	*x = PartnerAccountType(value)
	return nil
}

示例#6
文件: xmpp_service.pb.go 项目: David-Shibley/goPlayground

func (x *PresenceResponse_SHOW) UnmarshalJSON(data []byte) error {
	value, err := proto.UnmarshalJSONEnum(PresenceResponse_SHOW_value, data, "PresenceResponse_SHOW")
	if err != nil {
		return err
	}
	*x = PresenceResponse_SHOW(value)
	return nil
}

示例#7
文件: TextSecure.pb.go 项目: elimisteve/textsecure

func (x *SyncMessage_Request_Type) UnmarshalJSON(data []byte) error {
	value, err := proto.UnmarshalJSONEnum(SyncMessage_Request_Type_value, data, "SyncMessage_Request_Type")
	if err != nil {
		return err
	}
	*x = SyncMessage_Request_Type(value)
	return nil
}

示例#8
文件: chrome_infra_log.pb.go 项目: nicko96/Chrome-Infra

func (x *ChromeInfraEvent_TimestampKind) UnmarshalJSON(data []byte) error {
	value, err := proto.UnmarshalJSONEnum(ChromeInfraEvent_TimestampKind_value, data, "ChromeInfraEvent_TimestampKind")
	if err != nil {
		return err
	}
	*x = ChromeInfraEvent_TimestampKind(value)
	return nil
}

示例#9
文件: chrome_infra_log.pb.go 项目: nicko96/Chrome-Infra

func (x *CommitQueuePatchsetEvent_CQEventType) UnmarshalJSON(data []byte) error {
	value, err := proto.UnmarshalJSONEnum(CommitQueuePatchsetEvent_CQEventType_value, data, "CommitQueuePatchsetEvent_CQEventType")
	if err != nil {
		return err
	}
	*x = CommitQueuePatchsetEvent_CQEventType(value)
	return nil
}

示例#10
文件: chrome_infra_log.pb.go 项目: nicko96/Chrome-Infra

func (x *ServiceEvent_ServiceEventType) UnmarshalJSON(data []byte) error {
	value, err := proto.UnmarshalJSONEnum(ServiceEvent_ServiceEventType_value, data, "ServiceEvent_ServiceEventType")
	if err != nil {
		return err
	}
	*x = ServiceEvent_ServiceEventType(value)
	return nil
}

示例#11
文件: chrome_infra_log.pb.go 项目: nicko96/Chrome-Infra

func (x *BuildEvent_BuildResult) UnmarshalJSON(data []byte) error {
	value, err := proto.UnmarshalJSONEnum(BuildEvent_BuildResult_value, data, "BuildEvent_BuildResult")
	if err != nil {
		return err
	}
	*x = BuildEvent_BuildResult(value)
	return nil
}

示例#12
文件: messages.pb.go 项目: lsheiba/charmander-scheduler

func (x *StatusUpdateRecord_Type) UnmarshalJSON(data []byte) error {
	value, err := proto.UnmarshalJSONEnum(StatusUpdateRecord_Type_value, data, "StatusUpdateRecord_Type")
	if err != nil {
		return err
	}
	*x = StatusUpdateRecord_Type(value)
	return nil
}

示例#13
文件: container.pb.go 项目: mysll/flynet

func (x *ContainerOP) UnmarshalJSON(data []byte) error {
	value, err := proto.UnmarshalJSONEnum(ContainerOP_value, data, "ContainerOP")
	if err != nil {
		return err
	}
	*x = ContainerOP(value)
	return nil
}

示例#14
文件: ActionExecution.pb.go 项目: DongyiYang/vmturbo-go-sdk

func (x *ActionResponseState) UnmarshalJSON(data []byte) error {
	value, err := proto.UnmarshalJSONEnum(ActionResponseState_value, data, "ActionResponseState")
	if err != nil {
		return err
	}
	*x = ActionResponseState(value)
	return nil
}

示例#15
文件: ZooKeeper.pb.go 项目: yzl11/vessel

func (x *ReplicationState_State) UnmarshalJSON(data []byte) error {
	value, err := proto1.UnmarshalJSONEnum(ReplicationState_State_value, data, "ReplicationState_State")
	if err != nil {
		return err
	}
	*x = ReplicationState_State(value)
	return nil
}

示例#16
文件: spec.pb.go 项目: manuviswam/gauge-go

func (x *ProtoExecutionResult_ErrorType) UnmarshalJSON(data []byte) error {
	value, err := proto.UnmarshalJSONEnum(ProtoExecutionResult_ErrorType_value, data, "ProtoExecutionResult_ErrorType")
	if err != nil {
		return err
	}
	*x = ProtoExecutionResult_ErrorType(value)
	return nil
}

示例#17
文件: ZooKeeper.pb.go 项目: yzl11/vessel

func (x *SplitLogTask_RecoveryMode) UnmarshalJSON(data []byte) error {
	value, err := proto1.UnmarshalJSONEnum(SplitLogTask_RecoveryMode_value, data, "SplitLogTask_RecoveryMode")
	if err != nil {
		return err
	}
	*x = SplitLogTask_RecoveryMode(value)
	return nil
}

示例#18
文件: spec.pb.go 项目: manuviswam/gauge-go

func (x *ProtoItem_ItemType) UnmarshalJSON(data []byte) error {
	value, err := proto.UnmarshalJSONEnum(ProtoItem_ItemType_value, data, "ProtoItem_ItemType")
	if err != nil {
		return err
	}
	*x = ProtoItem_ItemType(value)
	return nil
}

示例#19
文件: xmpp_service.pb.go 项目: David-Shibley/goPlayground

func (x *XmppMessageResponse_XmppMessageStatus) UnmarshalJSON(data []byte) error {
	value, err := proto.UnmarshalJSONEnum(XmppMessageResponse_XmppMessageStatus_value, data, "XmppMessageResponse_XmppMessageStatus")
	if err != nil {
		return err
	}
	*x = XmppMessageResponse_XmppMessageStatus(value)
	return nil
}

示例#20
文件: spec.pb.go 项目: manuviswam/gauge-go

func (x *Fragment_FragmentType) UnmarshalJSON(data []byte) error {
	value, err := proto.UnmarshalJSONEnum(Fragment_FragmentType_value, data, "Fragment_FragmentType")
	if err != nil {
		return err
	}
	*x = Fragment_FragmentType(value)
	return nil
}

示例#21
文件: TextSecure.pb.go 项目: elimisteve/textsecure

func (x *GroupContext_Type) UnmarshalJSON(data []byte) error {
	value, err := proto.UnmarshalJSONEnum(GroupContext_Type_value, data, "GroupContext_Type")
	if err != nil {
		return err
	}
	*x = GroupContext_Type(value)
	return nil
}

示例#22
文件: dota_commonmessages.pb.go 项目: mzuber/yasha

func (x *EDOTAChatWheelMessage) UnmarshalJSON(data []byte) error {
	value, err := proto.UnmarshalJSONEnum(EDOTAChatWheelMessage_value, data, "EDOTAChatWheelMessage")
	if err != nil {
		return err
	}
	*x = EDOTAChatWheelMessage(value)
	return nil
}

示例#23
文件: TextSecure.pb.go 项目: elimisteve/textsecure

func (x *DataMessage_Flags) UnmarshalJSON(data []byte) error {
	value, err := proto.UnmarshalJSONEnum(DataMessage_Flags_value, data, "DataMessage_Flags")
	if err != nil {
		return err
	}
	*x = DataMessage_Flags(value)
	return nil
}

示例#24
文件: dota_commonmessages.pb.go 项目: mzuber/yasha

func (x *EDOTAStatPopupTypes) UnmarshalJSON(data []byte) error {
	value, err := proto.UnmarshalJSONEnum(EDOTAStatPopupTypes_value, data, "EDOTAStatPopupTypes")
	if err != nil {
		return err
	}
	*x = EDOTAStatPopupTypes(value)
	return nil
}

示例#25
文件: gcsdk.pb.go 项目: Inkp/go-steam

func (x *GCConnectionStatus) UnmarshalJSON(data []byte) error {
	value, err := proto.UnmarshalJSONEnum(GCConnectionStatus_value, data, "GCConnectionStatus")
	if err != nil {
		return err
	}
	*x = GCConnectionStatus(value)
	return nil
}

示例#26
文件: dota_commonmessages.pb.go 项目: mzuber/yasha

func (x *DotaunitorderT) UnmarshalJSON(data []byte) error {
	value, err := proto.UnmarshalJSONEnum(DotaunitorderT_value, data, "DotaunitorderT")
	if err != nil {
		return err
	}
	*x = DotaunitorderT(value)
	return nil
}

示例#27
文件: urlfetch_service.pb.go 项目: Celluliodio/flannel

func (x *URLFetchRequest_RequestMethod) UnmarshalJSON(data []byte) error {
	value, err := proto.UnmarshalJSONEnum(URLFetchRequest_RequestMethod_value, data, "URLFetchRequest_RequestMethod")
	if err != nil {
		return err
	}
	*x = URLFetchRequest_RequestMethod(value)
	return nil
}

示例#28
文件: ZooKeeper.pb.go 项目: yzl11/vessel

func (x *Table_State) UnmarshalJSON(data []byte) error {
	value, err := proto1.UnmarshalJSONEnum(Table_State_value, data, "Table_State")
	if err != nil {
		return err
	}
	*x = Table_State(value)
	return nil
}

示例#29
文件: api.pb.go 项目: krwhitney/gauge

func (x *APIMessage_APIMessageType) UnmarshalJSON(data []byte) error {
	value, err := proto.UnmarshalJSONEnum(APIMessage_APIMessageType_value, data, "APIMessage_APIMessageType")
	if err != nil {
		return err
	}
	*x = APIMessage_APIMessageType(value)
	return nil
}

示例#30
文件: ActionExecution.pb.go 项目: DongyiYang/vmturbo-go-sdk

func (x *ActionItemDTO_ActionType) UnmarshalJSON(data []byte) error {
	value, err := proto.UnmarshalJSONEnum(ActionItemDTO_ActionType_value, data, "ActionItemDTO_ActionType")
	if err != nil {
		return err
	}
	*x = ActionItemDTO_ActionType(value)
	return nil
}

展开阅读全文