MCPcopy
hub / github.com/google/mangle / writeHeader

Method writeHeader

factstore/simplecolumn.go:223–235  ·  view source on GitHub ↗
(preds []ast.PredicateSym, predFactCount []int, w io.Writer)

Source from the content-addressed store, hash-verified

221}
222
223func (sc SimpleColumn) writeHeader(preds []ast.PredicateSym, predFactCount []int, w io.Writer) error {
224 // line 1. <number of predicates>
225 if _, err := fmt.Fprintf(w, "%d\n", len(preds)); err != nil {
226 return err
227 }
228 // line 1 + i. <predicate #i name> <arity> <num facts>
229 for i, p := range preds {
230 if _, err := fmt.Fprintf(w, "%s %d %d\n", p.Symbol, p.Arity, predFactCount[i]); err != nil {
231 return err
232 }
233 }
234 return nil
235}
236
237// WriteTo writes contents of a fact store to the writer. It only
238// calls the ListPredicates and GetFacts methods on the store.

Callers 1

WriteToMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected