blob: 6463823b604b33c82bd869ca763590ea2ce3809e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
package model
import (
"fmt"
"strings"
"time"
"go.neonxp.dev/json/model"
)
type Mutation struct {
Date time.Time
Type CommandType
Path []string
Body model.Node
}
func (m *Mutation) String() string {
body, _ := m.Body.MarshalJSON()
return fmt.Sprintf(
"Date=%s Type=%s Path='%s' Body=%s",
m.Date.Format(time.RFC3339),
m.Type,
strings.Join(m.Path, "/"),
string(body),
)
}
//go:generate stringer -type=CommandType
type CommandType int
const (
Create CommandType = iota
Merge
Remove
)
|