mirror of
https://github.com/zrepl/zrepl.git
synced 2024-11-25 01:44:43 +01:00
def510abfd
Go upgrade: - Go 1.23 is current => use that for release builds - Go 1.22 is less than one year old, it's desirable to support it. - The [`Go Toolchains`](https://go.dev/doc/toolchain) stuff is available in both of these (would also be in Go 1.21). That is quite nice stuff, but required some changes to how we versions we use in CircleCI and the `release-docker` Makefile target. Protobuf upgrade: - Go to protobuf GH release website - Download latest locally - run `sha256sum` - replace existing pinned hashes - `make generate` Deps upgrade: - `go get -t -u all` - repository moves aren't handled well automatically, fix manually - repeat until no changes
80 lines
2.4 KiB
Go
80 lines
2.4 KiB
Go
// Code generated by "enumer -type=ReplicationGuaranteeKind -json -transform=snake -trimprefix=ReplicationGuaranteeKind"; DO NOT EDIT.
|
|
|
|
package endpoint
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
)
|
|
|
|
const (
|
|
_ReplicationGuaranteeKindName_0 = "resumabilityincremental"
|
|
_ReplicationGuaranteeKindName_1 = "none"
|
|
)
|
|
|
|
var (
|
|
_ReplicationGuaranteeKindIndex_0 = [...]uint8{0, 12, 23}
|
|
_ReplicationGuaranteeKindIndex_1 = [...]uint8{0, 4}
|
|
)
|
|
|
|
func (i ReplicationGuaranteeKind) String() string {
|
|
switch {
|
|
case 1 <= i && i <= 2:
|
|
i -= 1
|
|
return _ReplicationGuaranteeKindName_0[_ReplicationGuaranteeKindIndex_0[i]:_ReplicationGuaranteeKindIndex_0[i+1]]
|
|
case i == 4:
|
|
return _ReplicationGuaranteeKindName_1
|
|
default:
|
|
return fmt.Sprintf("ReplicationGuaranteeKind(%d)", i)
|
|
}
|
|
}
|
|
|
|
var _ReplicationGuaranteeKindValues = []ReplicationGuaranteeKind{1, 2, 4}
|
|
|
|
var _ReplicationGuaranteeKindNameToValueMap = map[string]ReplicationGuaranteeKind{
|
|
_ReplicationGuaranteeKindName_0[0:12]: 1,
|
|
_ReplicationGuaranteeKindName_0[12:23]: 2,
|
|
_ReplicationGuaranteeKindName_1[0:4]: 4,
|
|
}
|
|
|
|
// ReplicationGuaranteeKindString retrieves an enum value from the enum constants string name.
|
|
// Throws an error if the param is not part of the enum.
|
|
func ReplicationGuaranteeKindString(s string) (ReplicationGuaranteeKind, error) {
|
|
if val, ok := _ReplicationGuaranteeKindNameToValueMap[s]; ok {
|
|
return val, nil
|
|
}
|
|
return 0, fmt.Errorf("%s does not belong to ReplicationGuaranteeKind values", s)
|
|
}
|
|
|
|
// ReplicationGuaranteeKindValues returns all values of the enum
|
|
func ReplicationGuaranteeKindValues() []ReplicationGuaranteeKind {
|
|
return _ReplicationGuaranteeKindValues
|
|
}
|
|
|
|
// IsAReplicationGuaranteeKind returns "true" if the value is listed in the enum definition. "false" otherwise
|
|
func (i ReplicationGuaranteeKind) IsAReplicationGuaranteeKind() bool {
|
|
for _, v := range _ReplicationGuaranteeKindValues {
|
|
if i == v {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
|
|
// MarshalJSON implements the json.Marshaler interface for ReplicationGuaranteeKind
|
|
func (i ReplicationGuaranteeKind) MarshalJSON() ([]byte, error) {
|
|
return json.Marshal(i.String())
|
|
}
|
|
|
|
// UnmarshalJSON implements the json.Unmarshaler interface for ReplicationGuaranteeKind
|
|
func (i *ReplicationGuaranteeKind) UnmarshalJSON(data []byte) error {
|
|
var s string
|
|
if err := json.Unmarshal(data, &s); err != nil {
|
|
return fmt.Errorf("ReplicationGuaranteeKind should be a string, got %s", data)
|
|
}
|
|
|
|
var err error
|
|
*i, err = ReplicationGuaranteeKindString(s)
|
|
return err
|
|
}
|