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

salsadigitalauorg / shipshape / 13157284528

05 Feb 2025 12:23PM UTC coverage: 61.165% (+0.6%) from 60.56%
13157284528

Pull #71

github

yusufhm
[DEVOPS-158] Added more doc pages.

- Started a guide on connections.
- Added a connection example.
- Added stub pages for other sections.
- Added a file for analyse common fields.
- Started adding some details for `allowed:list`.
Pull Request #71: [DEVOPS-158] Implement required value(s)

111 of 156 new or added lines in 11 files covered. (71.15%)

1 existing line in 1 file now uncovered.

3361 of 5495 relevant lines covered (61.16%)

5.01 hits per line

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

54.69
/pkg/data/data.go
1
package data
2

3
type DataFormat string
4

5
const (
6
        // FormatNil is used to represent nil.
7
        FormatNil DataFormat = "nil"
8
        // FormatRaw is used to represent []byte.
9
        FormatRaw DataFormat = "raw"
10
        // FormatString is used to represent string.
11
        FormatString DataFormat = "string"
12
        // FormatListString is used to represent []string.
13
        FormatListString DataFormat = "list-string"
14
        // FormatListMapString is used to represent []map[string]string.
15
        FormatListMapString DataFormat = "list-map-string"
16
        // FormatMapBytes is used to represent map[string][]byte.
17
        FormatMapBytes DataFormat = "map-bytes"
18
        // FormatMapString is used to represent map[string]string.
19
        FormatMapString DataFormat = "map-string"
20
        // FormatMapListString is used to represent map[string][]string.
21
        FormatMapListString DataFormat = "map-list-string"
22
        // FormatMapNestedString is used to represent map[string]map[string]string.
23
        FormatMapNestedString DataFormat = "map-nested-string"
24
)
25

26
func AsBytes(data interface{}) []byte {
5✔
27
        if data == nil {
5✔
28
                return nil
×
29
        }
×
30
        return data.([]byte)
5✔
31
}
32

33
func AsString(data interface{}) string {
2✔
34
        if data == nil {
2✔
35
                return ""
×
36
        }
×
37
        return data.(string)
2✔
38
}
39

40
func AsListString(data interface{}) []string {
5✔
41
        if data == nil {
5✔
42
                return nil
×
43
        }
×
44

45
        if parsedData, ok := data.([]string); ok {
5✔
NEW
46
                return parsedData
×
NEW
47
        }
×
48

49
        ifcList := data.([]interface{})
5✔
50
        strList := []string{}
5✔
51
        for _, v := range ifcList {
18✔
52
                strList = append(strList, v.(string))
13✔
53
        }
13✔
54

55
        return strList
5✔
56
}
57

58
func AsListMapString(data interface{}) []map[string]string {
×
59
        if data == nil {
×
60
                return nil
×
61
        }
×
62
        return data.([]map[string]string)
×
63
}
64

65
func AsMapBytes(data interface{}) map[string][]byte {
10✔
66
        if data == nil {
10✔
67
                return nil
×
68
        }
×
69
        return data.(map[string][]byte)
10✔
70
}
71

72
func AsMapString(data interface{}) map[string]string {
5✔
73
        if data == nil {
5✔
74
                return nil
×
75
        }
×
76

77
        if parsedData, ok := data.(map[string]string); ok {
5✔
NEW
78
                return parsedData
×
NEW
79
        }
×
80

81
        ifcMap := data.(map[string]interface{})
5✔
82
        strMap := map[string]string{}
5✔
83
        for k, v := range ifcMap {
20✔
84
                strMap[k] = v.(string)
15✔
85
        }
15✔
86

87
        return strMap
5✔
88
}
89

90
func AsMapListString(data interface{}) map[string][]string {
6✔
91
        if data == nil {
6✔
92
                return nil
×
93
        }
×
94
        return data.(map[string][]string)
6✔
95
}
96

97
func AsMapNestedString(data interface{}) map[string]map[string]string {
8✔
98
        if data == nil {
8✔
99
                return nil
×
100
        }
×
101

102
        if parsedData, ok := data.(map[string]map[string]string); ok {
16✔
103
                return parsedData
8✔
104
        } else if parsedData, ok := data.(map[string]interface{}); ok {
8✔
105
                strStrMap := map[string]map[string]string{}
×
106
                for k, v := range parsedData {
×
107
                        strStrMap[k] = v.(map[string]string)
×
108
                }
×
109
                return strStrMap
×
110
        }
111
        panic("unexpected data type when converting to MapNestedString")
×
112
}
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