代码拉取完成,页面将自动刷新
/*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package configtx
import (
cb "github.com/hyperledger/fabric/protos/common"
"github.com/golang/protobuf/proto"
)
// UnmarshalConfig attempts to unmarshal bytes to a *cb.Config
func UnmarshalConfig(data []byte) (*cb.Config, error) {
config := &cb.Config{}
err := proto.Unmarshal(data, config)
if err != nil {
return nil, err
}
return config, nil
}
// UnmarshalConfigOrPanic attempts to unmarshal bytes to a *cb.Config or panics on error
func UnmarshalConfigOrPanic(data []byte) *cb.Config {
result, err := UnmarshalConfig(data)
if err != nil {
panic(err)
}
return result
}
// UnmarshalConfigUpdate attempts to unmarshal bytes to a *cb.ConfigUpdate
func UnmarshalConfigUpdate(data []byte) (*cb.ConfigUpdate, error) {
configUpdate := &cb.ConfigUpdate{}
err := proto.Unmarshal(data, configUpdate)
if err != nil {
return nil, err
}
return configUpdate, nil
}
// UnmarshalConfigUpdateOrPanic attempts to unmarshal bytes to a *cb.ConfigUpdate or panics on error
func UnmarshalConfigUpdateOrPanic(data []byte) *cb.ConfigUpdate {
result, err := UnmarshalConfigUpdate(data)
if err != nil {
panic(err)
}
return result
}
// UnmarshalConfigUpdateEnvelope attempts to unmarshal bytes to a *cb.ConfigUpdate
func UnmarshalConfigUpdateEnvelope(data []byte) (*cb.ConfigUpdateEnvelope, error) {
configUpdateEnvelope := &cb.ConfigUpdateEnvelope{}
err := proto.Unmarshal(data, configUpdateEnvelope)
if err != nil {
return nil, err
}
return configUpdateEnvelope, nil
}
// UnmarshalConfigUpdateEnvelopeOrPanic attempts to unmarshal bytes to a *cb.ConfigUpdateEnvelope or panics on error
func UnmarshalConfigUpdateEnvelopeOrPanic(data []byte) *cb.ConfigUpdateEnvelope {
result, err := UnmarshalConfigUpdateEnvelope(data)
if err != nil {
panic(err)
}
return result
}
// UnmarshalConfigEnvelope attempts to unmarshal bytes to a *cb.ConfigEnvelope
func UnmarshalConfigEnvelope(data []byte) (*cb.ConfigEnvelope, error) {
configEnv := &cb.ConfigEnvelope{}
err := proto.Unmarshal(data, configEnv)
if err != nil {
return nil, err
}
return configEnv, nil
}
// UnmarshalConfigEnvelopeOrPanic attempts to unmarshal bytes to a *cb.ConfigEnvelope or panics on error
func UnmarshalConfigEnvelopeOrPanic(data []byte) *cb.ConfigEnvelope {
result, err := UnmarshalConfigEnvelope(data)
if err != nil {
panic(err)
}
return result
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。