mirror of
https://github.com/hyperledger/fabric-samples.git
synced 2026-06-17 15:35:09 +00:00
Every struct was put in its own file. Every method which is not used outside the parser package was given package scope. All interfaces were removed, they are implemented by the structs which are now used everywhere needed as return values. There is no clear benefit of using interfaces in this sample. Signed-off-by: Stanislav Jakuschevskij <stas@two-giants.com>
30 lines
667 B
Go
30 lines
667 B
Go
package parser
|
|
|
|
import (
|
|
"github.com/hyperledger/fabric-protos-go-apiv2/common"
|
|
)
|
|
|
|
type Transaction struct {
|
|
payload *payload
|
|
}
|
|
|
|
func newTransaction(payload *payload) *Transaction {
|
|
return &Transaction{payload}
|
|
}
|
|
|
|
func (t *Transaction) ChannelHeader() *common.ChannelHeader {
|
|
return t.payload.channelHeader()
|
|
}
|
|
|
|
func (t *Transaction) NamespaceReadWriteSets() []*NamespaceReadWriteSet {
|
|
result := []*NamespaceReadWriteSet{}
|
|
for _, readWriteSet := range t.payload.endorserTransaction().readWriteSets() {
|
|
result = append(result, readWriteSet.namespaceReadWriteSets()...)
|
|
}
|
|
|
|
return result
|
|
}
|
|
|
|
func (t *Transaction) IsValid() bool {
|
|
return t.payload.isValid()
|
|
}
|