2018-06-20 01:03:59 +02:00
|
|
|
package plans
|
|
|
|
|
|
|
|
type Action rune
|
|
|
|
|
|
|
|
const (
|
2018-09-22 02:08:52 +02:00
|
|
|
NoOp Action = 0
|
|
|
|
Create Action = '+'
|
|
|
|
Read Action = '←'
|
|
|
|
Update Action = '~'
|
|
|
|
DeleteThenCreate Action = '∓'
|
|
|
|
CreateThenDelete Action = '±'
|
|
|
|
Delete Action = '-'
|
2018-06-20 01:03:59 +02:00
|
|
|
)
|
|
|
|
|
2019-10-17 22:17:23 +02:00
|
|
|
//go:generate go run golang.org/x/tools/cmd/stringer -type Action
|
2018-09-22 02:08:52 +02: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
|
|
|
|
}
|