MCPcopy Create free account
hub / github.com/alecthomas/devtodo2 / toMarshalableTask

Function toMarshalableTask

jsonio.go:75–95  ·  view source on GitHub ↗
(n TaskNode)

Source from the content-addressed store, hash-verified

73}
74
75func toMarshalableTask(n TaskNode) []*marshalableTask {
76 children := make([]*marshalableTask, n.Len())
77 for i := 0; i < n.Len(); i++ {
78 t := n.At(i)
79 var created, completed int64 = 0, 0
80 if !t.CreationTime().IsZero() {
81 created = t.CreationTime().Unix()
82 }
83 if !t.CompletionTime().IsZero() {
84 completed = t.CompletionTime().Unix()
85 }
86 children[i] = &marshalableTask{
87 Text: t.Text(),
88 Priority: t.Priority().String(),
89 Creation: created,
90 Completion: completed,
91 Tasks: toMarshalableTask(t),
92 }
93 }
94 return children
95}
96
97func fromMarshalableTaskList(l *marshalableTaskList) TaskList {
98 tasks := NewTaskList()

Callers 1

toMarshalableTaskListFunction · 0.85

Calls 7

LenMethod · 0.65
AtMethod · 0.65
CreationTimeMethod · 0.65
CompletionTimeMethod · 0.65
TextMethod · 0.65
PriorityMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected