File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ package bundle
18
18
19
19
import (
20
20
"context"
21
+ "fmt"
21
22
22
23
"github.com/rs/zerolog"
23
24
@@ -134,6 +135,25 @@ func NewBatch(documents map[string]deepcode.BundleFile) *Batch {
134
135
}
135
136
}
136
137
138
+ func NewBatchFromRawContent (documents map [string ][]byte ) * Batch {
139
+ bundleFiles := make (map [string ]deepcode.BundleFile )
140
+
141
+ for key , rawData := range documents {
142
+ bundleFile , err := deepcode .BundleFileFrom (rawData )
143
+ if err != nil {
144
+ // TODO: logging the error
145
+ fmt .Printf ("error creating a bundle from the file" )
146
+ continue
147
+ }
148
+
149
+ bundleFiles [key ] = bundleFile
150
+ }
151
+
152
+ return & Batch {
153
+ documents : bundleFiles ,
154
+ }
155
+ }
156
+
137
157
// todo simplify the size computation
138
158
// maybe consider an addFile / canFitFile interface with proper error handling
139
159
func (b * Batch ) canFitFile (uri string , content []byte ) bool {
You can’t perform that action at this time.
0 commit comments