2018-06-19 18:03:59 -05:00
|
|
|
package plans
|
|
|
|
|
|
|
|
type Action rune
|
|
|
|
|
|
|
|
const (
|
2018-09-21 19:08:52 -05:00
|
|
|
NoOp Action = 0
|
|
|
|
Create Action = '+'
|
|
|
|
Read Action = '←'
|
|
|
|
Update Action = '~'
|
|
|
|
DeleteThenCreate Action = '∓'
|
|
|
|
CreateThenDelete Action = '±'
|
|
|
|
Delete Action = '-'
|
2018-06-19 18:03:59 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
//go:generate stringer -type Action
|
2018-09-21 19:08:52 -05:00
|
|
|
|
|
|
|
// IsReplace returns true if the action is one of the two actions that
|
|
|
|
// represents replacing an existing object with a new object:
|
|
|
|
// DeleteThenCreate or CreateThenDelete.
|
|
|
|
func (a Action) IsReplace() bool {
|
|
|
|
return a == DeleteThenCreate || a == CreateThenDelete
|
|
|
|
}
|