location_enum_gen.go•1.33 kB
// Code generated by enumerator. DO NOT EDIT.
package location
import (
"database/sql/driver"
"fmt"
)
type LocationType struct {
v locationTypeEnum
}
var (
LocationTypePhysical = LocationType{locationTypePhysical}
LocationTypeVirtual = LocationType{locationTypeVirtual}
)
func (r LocationType) Format(f fmt.State, verb rune) {
switch verb {
case 's':
fmt.Fprint(f, r.v)
case 'q':
fmt.Fprintf(f, "%q", r.String())
default:
fmt.Fprint(f, r.v)
}
}
func (r LocationType) String() string {
return string(r.v)
}
func (r LocationType) MarshalText() ([]byte, error) {
return []byte(r.v), nil
}
func (r *LocationType) UnmarshalText(__iNpUt__ []byte) error {
s, err := NewLocationType(string(__iNpUt__))
if err != nil {
return err
}
*r = s
return nil
}
func (r LocationType) Value() (driver.Value, error) {
return r.v, nil
}
func (r *LocationType) Scan(__iNpUt__ any) error {
s, err := NewLocationType(fmt.Sprint(__iNpUt__))
if err != nil {
return err
}
*r = s
return nil
}
func NewLocationType(__iNpUt__ string) (LocationType, error) {
switch __iNpUt__ {
case string(locationTypePhysical):
return LocationTypePhysical, nil
case string(locationTypeVirtual):
return LocationTypeVirtual, nil
default:
return LocationType{}, fmt.Errorf("invalid value for type 'LocationType': '%s'", __iNpUt__)
}
}