Skip to content

Instantly share code, notes, and snippets.

View Deeptiman's full-sized avatar
:octocat:
Open Source

Deeptiman Pattnaik Deeptiman

:octocat:
Open Source
View GitHub Profile
type User struct {
ID string `json:"id"`
Email string `json:"email"`
Name string `json:"name"`
Mobile string `json:"mobile"`
Age string `json:"age"`
}
type Financial struct {
ID string `json:"id"`
BankName string `json:"bankName"`
IFSCCode string `json:"ifscCode"`
AccNumber string `json:"accNumber"`
CreatedDate string `json:"createdDate"`
}
syntax="proto3";
package main;
message Financial {
string bankName = 1;
string ifscCode = 2;
string accNumber = 3;
string createdDate = 4;
}
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: financial.proto
package main
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
math "math"
)
type User struct {
ID string `json:"id"`
Email string `json:"email"`
Name string `json:"name"`
Mobile string `json:"mobile"`
Age string `json:"age"`
Financial string `json:"financial"`
}
financial := &Financial {
ID: "F1",
BankName: "Hellenic Bank",
IFSCCode: "1234",
AccNumber: "8765",
CreatedDate : "12/12/08,
}
package main
import (
"fmt"
"log"
"github.com/golang/protobuf/proto"
)
func main() {
financialByteData, err := proto.Marshal(financialData)
if err != nil {
log.Fatal("marshaling error: ", err)
}
//Parsing the financial byte data
financial := &Financial{}
err = proto.Unmarshal(financialByteData, financial)
if err != nil {
log.Fatal("unmarshaling error: ", err)
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: financial.proto
package main
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
math "math"
)
req := resmgmt.SaveChannelRequest{
ChannelID: "multiorgledger",
ChannelConfigPath: os.os.Getenv("GOPATH")+"/multiorgledger.channel.tx",
SigningIdentities: []msp.SigningIdentity{Org1SignIdentity, Org2SignIdentity, Org3SignIdentity, Org4SignIdentity},
}
txID, err := s.Resmgmt.SaveChannel(
req, resmgmt.WithOrdererEndpoint(Orderer.OrdererID))
if err != nil || txID.TransactionID == "" {
return errors.WithMessage(err, "failed to save anchor channel for - "+s.OrgName)
}