• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

s7techlab / hlf-sdk-go / 6615655079

23 Oct 2023 03:42PM UTC coverage: 4.092% (-1.7%) from 5.771%
6615655079

Pull #135

github

Nikita Neznaemov
write-struct 15
Pull Request #135: write-struct

2885 of 2885 new or added lines in 21 files covered. (100.0%)

446 of 10900 relevant lines covered (4.09%)

0.18 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/block/block_write.go
1
package block
2

3
import (
4
        "errors"
5
        "regexp"
6
        "strings"
7

8
        "github.com/golang/protobuf/ptypes/timestamp"
9
        "github.com/hyperledger/fabric-protos-go/ledger/rwset/kvrwset"
10
)
11

12
var (
13
        ErrEmptyKeyAttrs = errors.New(`empty key attrs`)
14
)
15

16
type (
17
        Write struct {
18
                KWWrite *kvrwset.KVWrite
19

20
                KeyObjectType string
21
                KeyAttrs      []string
22
                Key           string
23

24
                Block            uint64
25
                Chaincode        string
26
                ChaincodeVersion string
27
                Tx               string
28
                Timestamp        *timestamp.Timestamp
29
        }
30
)
31

32
func (bw *Write) HasKeyObjectType(objectTypes ...string) bool {
×
33
        for _, t := range objectTypes {
×
34
                if bw.KeyObjectType == t {
×
35
                        return true
×
36
                }
×
37
        }
38
        return false
×
39
}
40

41
func (bw *Write) HasKeyPartObjectType(objectTypes ...string) bool {
×
42
        for _, t := range objectTypes {
×
43
                if strings.Contains(bw.KeyObjectType, t) {
×
44
                        return true
×
45
                }
×
46
        }
47
        return false
×
48
}
49

50
func (bw *Write) HasKeyObjectTypeRegexp(pattern string) bool {
×
51
        matched, _ := regexp.MatchString(pattern, bw.KeyObjectType)
×
52

×
53
        return matched
×
54
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc