Files
data-mesher/pkg/model/signature_type_enum.go
brianmcgee e3a7790e57
buildbot/nix-eval Build done.
PR Size Review Check / pr-size-review-gate (pull_request) Successful in 24s
sizelint / sizelint (pull_request) Successful in 2m12s
buildbot/nix-build Build done.
gitea-mq Already up to date with target branch
fix breaks in gofumpt and golangci-lint from updating nixpkgs
2026-07-07 16:32:14 +01:00

98 lines
2.8 KiB
Go

// Code generated by "enumer -type=SignatureType -json -transform=snake -trimprefix SignatureType -output=./signature_type_enum.go"; DO NOT EDIT.
package model
import (
"encoding/json"
"fmt"
"strings"
)
const _SignatureTypeName = "filetombstone"
var _SignatureTypeIndex = [...]uint8{0, 4, 13}
const _SignatureTypeLowerName = "filetombstone"
func (i SignatureType) String() string {
i -= 1
if i >= SignatureType(len(_SignatureTypeIndex)-1) {
return fmt.Sprintf("SignatureType(%d)", i+1)
}
return _SignatureTypeName[_SignatureTypeIndex[i]:_SignatureTypeIndex[i+1]]
}
// An "invalid array index" compiler error signifies that the constant values have changed.
// Re-run the stringer command to generate them again.
func _SignatureTypeNoOp() {
var x [1]struct{}
_ = x[SignatureTypeFile-1]
_ = x[SignatureTypeTombstone-2]
}
var _SignatureTypeValues = []SignatureType{SignatureTypeFile, SignatureTypeTombstone}
var _SignatureTypeNameToValueMap = map[string]SignatureType{
_SignatureTypeName[0:4]: SignatureTypeFile,
_SignatureTypeLowerName[0:4]: SignatureTypeFile,
_SignatureTypeName[4:13]: SignatureTypeTombstone,
_SignatureTypeLowerName[4:13]: SignatureTypeTombstone,
}
var _SignatureTypeNames = []string{
_SignatureTypeName[0:4],
_SignatureTypeName[4:13],
}
// SignatureTypeString retrieves an enum value from the enum constants string name.
// Throws an error if the param is not part of the enum.
func SignatureTypeString(s string) (SignatureType, error) {
if val, ok := _SignatureTypeNameToValueMap[s]; ok {
return val, nil
}
if val, ok := _SignatureTypeNameToValueMap[strings.ToLower(s)]; ok {
return val, nil
}
return 0, fmt.Errorf("%s does not belong to SignatureType values", s)
}
// SignatureTypeValues returns all values of the enum
func SignatureTypeValues() []SignatureType {
return _SignatureTypeValues
}
// SignatureTypeStrings returns a slice of all String values of the enum
func SignatureTypeStrings() []string {
strs := make([]string, len(_SignatureTypeNames))
copy(strs, _SignatureTypeNames)
return strs
}
// IsASignatureType returns "true" if the value is listed in the enum definition. "false" otherwise
func (i SignatureType) IsASignatureType() bool {
for _, v := range _SignatureTypeValues {
if i == v {
return true
}
}
return false
}
// MarshalJSON implements the json.Marshaler interface for SignatureType
func (i SignatureType) MarshalJSON() ([]byte, error) {
return json.Marshal(i.String())
}
// UnmarshalJSON implements the json.Unmarshaler interface for SignatureType
func (i *SignatureType) UnmarshalJSON(data []byte) error {
var s string
if err := json.Unmarshal(data, &s); err != nil {
return fmt.Errorf("SignatureType should be a string, got %s", data)
}
var err error
*i, err = SignatureTypeString(s)
return err
}