200 lines
5.2 KiB
Go
200 lines
5.2 KiB
Go
// Code generated by go-enum DO NOT EDIT.
|
|
// Version: -
|
|
// Revision: -
|
|
// Build Date: -
|
|
// Built By: -
|
|
|
|
package fields
|
|
|
|
import (
|
|
"database/sql/driver"
|
|
"errors"
|
|
"fmt"
|
|
"strings"
|
|
)
|
|
|
|
const (
|
|
// MediaAssetTypeUnknown is a MediaAssetType of type Unknown.
|
|
MediaAssetTypeUnknown MediaAssetType = "unknown"
|
|
// MediaAssetTypePoster is a MediaAssetType of type Poster.
|
|
MediaAssetTypePoster MediaAssetType = "poster"
|
|
// MediaAssetTypeImage is a MediaAssetType of type Image.
|
|
MediaAssetTypeImage MediaAssetType = "image"
|
|
// MediaAssetTypeVideo is a MediaAssetType of type Video.
|
|
MediaAssetTypeVideo MediaAssetType = "video"
|
|
// MediaAssetTypeAudio is a MediaAssetType of type Audio.
|
|
MediaAssetTypeAudio MediaAssetType = "audio"
|
|
// MediaAssetTypeDocument is a MediaAssetType of type Document.
|
|
MediaAssetTypeDocument MediaAssetType = "document"
|
|
// MediaAssetTypeOther is a MediaAssetType of type Other.
|
|
MediaAssetTypeOther MediaAssetType = "other"
|
|
)
|
|
|
|
var ErrInvalidMediaAssetType = fmt.Errorf("not a valid MediaAssetType, try [%s]", strings.Join(_MediaAssetTypeNames, ", "))
|
|
|
|
var _MediaAssetTypeNames = []string{
|
|
string(MediaAssetTypeUnknown),
|
|
string(MediaAssetTypePoster),
|
|
string(MediaAssetTypeImage),
|
|
string(MediaAssetTypeVideo),
|
|
string(MediaAssetTypeAudio),
|
|
string(MediaAssetTypeDocument),
|
|
string(MediaAssetTypeOther),
|
|
}
|
|
|
|
// MediaAssetTypeNames returns a list of possible string values of MediaAssetType.
|
|
func MediaAssetTypeNames() []string {
|
|
tmp := make([]string, len(_MediaAssetTypeNames))
|
|
copy(tmp, _MediaAssetTypeNames)
|
|
return tmp
|
|
}
|
|
|
|
// MediaAssetTypeValues returns a list of the values for MediaAssetType
|
|
func MediaAssetTypeValues() []MediaAssetType {
|
|
return []MediaAssetType{
|
|
MediaAssetTypeUnknown,
|
|
MediaAssetTypePoster,
|
|
MediaAssetTypeImage,
|
|
MediaAssetTypeVideo,
|
|
MediaAssetTypeAudio,
|
|
MediaAssetTypeDocument,
|
|
MediaAssetTypeOther,
|
|
}
|
|
}
|
|
|
|
// String implements the Stringer interface.
|
|
func (x MediaAssetType) String() string {
|
|
return string(x)
|
|
}
|
|
|
|
// IsValid provides a quick way to determine if the typed value is
|
|
// part of the allowed enumerated values
|
|
func (x MediaAssetType) IsValid() bool {
|
|
_, err := ParseMediaAssetType(string(x))
|
|
return err == nil
|
|
}
|
|
|
|
var _MediaAssetTypeValue = map[string]MediaAssetType{
|
|
"unknown": MediaAssetTypeUnknown,
|
|
"poster": MediaAssetTypePoster,
|
|
"image": MediaAssetTypeImage,
|
|
"video": MediaAssetTypeVideo,
|
|
"audio": MediaAssetTypeAudio,
|
|
"document": MediaAssetTypeDocument,
|
|
"other": MediaAssetTypeOther,
|
|
}
|
|
|
|
// ParseMediaAssetType attempts to convert a string to a MediaAssetType.
|
|
func ParseMediaAssetType(name string) (MediaAssetType, error) {
|
|
if x, ok := _MediaAssetTypeValue[name]; ok {
|
|
return x, nil
|
|
}
|
|
return MediaAssetType(""), fmt.Errorf("%s is %w", name, ErrInvalidMediaAssetType)
|
|
}
|
|
|
|
var errMediaAssetTypeNilPtr = errors.New("value pointer is nil") // one per type for package clashes
|
|
|
|
// Scan implements the Scanner interface.
|
|
func (x *MediaAssetType) Scan(value interface{}) (err error) {
|
|
if value == nil {
|
|
*x = MediaAssetType("")
|
|
return
|
|
}
|
|
|
|
// A wider range of scannable types.
|
|
// driver.Value values at the top of the list for expediency
|
|
switch v := value.(type) {
|
|
case string:
|
|
*x, err = ParseMediaAssetType(v)
|
|
case []byte:
|
|
*x, err = ParseMediaAssetType(string(v))
|
|
case MediaAssetType:
|
|
*x = v
|
|
case *MediaAssetType:
|
|
if v == nil {
|
|
return errMediaAssetTypeNilPtr
|
|
}
|
|
*x = *v
|
|
case *string:
|
|
if v == nil {
|
|
return errMediaAssetTypeNilPtr
|
|
}
|
|
*x, err = ParseMediaAssetType(*v)
|
|
default:
|
|
return errors.New("invalid type for MediaAssetType")
|
|
}
|
|
|
|
return
|
|
}
|
|
|
|
// Value implements the driver Valuer interface.
|
|
func (x MediaAssetType) Value() (driver.Value, error) {
|
|
return x.String(), nil
|
|
}
|
|
|
|
// Set implements the Golang flag.Value interface func.
|
|
func (x *MediaAssetType) Set(val string) error {
|
|
v, err := ParseMediaAssetType(val)
|
|
*x = v
|
|
return err
|
|
}
|
|
|
|
// Get implements the Golang flag.Getter interface func.
|
|
func (x *MediaAssetType) Get() interface{} {
|
|
return *x
|
|
}
|
|
|
|
// Type implements the github.com/spf13/pFlag Value interface.
|
|
func (x *MediaAssetType) Type() string {
|
|
return "MediaAssetType"
|
|
}
|
|
|
|
type NullMediaAssetType struct {
|
|
MediaAssetType MediaAssetType
|
|
Valid bool
|
|
}
|
|
|
|
func NewNullMediaAssetType(val interface{}) (x NullMediaAssetType) {
|
|
err := x.Scan(val) // yes, we ignore this error, it will just be an invalid value.
|
|
_ = err // make any errcheck linters happy
|
|
return
|
|
}
|
|
|
|
// Scan implements the Scanner interface.
|
|
func (x *NullMediaAssetType) Scan(value interface{}) (err error) {
|
|
if value == nil {
|
|
x.MediaAssetType, x.Valid = MediaAssetType(""), false
|
|
return
|
|
}
|
|
|
|
err = x.MediaAssetType.Scan(value)
|
|
x.Valid = (err == nil)
|
|
return
|
|
}
|
|
|
|
// Value implements the driver Valuer interface.
|
|
func (x NullMediaAssetType) Value() (driver.Value, error) {
|
|
if !x.Valid {
|
|
return nil, nil
|
|
}
|
|
// driver.Value accepts int64 for int values.
|
|
return string(x.MediaAssetType), nil
|
|
}
|
|
|
|
type NullMediaAssetTypeStr struct {
|
|
NullMediaAssetType
|
|
}
|
|
|
|
func NewNullMediaAssetTypeStr(val interface{}) (x NullMediaAssetTypeStr) {
|
|
x.Scan(val) // yes, we ignore this error, it will just be an invalid value.
|
|
return
|
|
}
|
|
|
|
// Value implements the driver Valuer interface.
|
|
func (x NullMediaAssetTypeStr) Value() (driver.Value, error) {
|
|
if !x.Valid {
|
|
return nil, nil
|
|
}
|
|
return x.MediaAssetType.String(), nil
|
|
}
|