1995 lines
51 KiB
Go
1995 lines
51 KiB
Go
// Code generated by go-enum DO NOT EDIT.
|
|
// Version: -
|
|
// Revision: -
|
|
// Build Date: -
|
|
// Built By: -
|
|
|
|
package consts
|
|
|
|
import (
|
|
"database/sql/driver"
|
|
"errors"
|
|
"fmt"
|
|
"strings"
|
|
)
|
|
|
|
const (
|
|
// ContentAccessStatusActive is a ContentAccessStatus of type active.
|
|
ContentAccessStatusActive ContentAccessStatus = "active"
|
|
// ContentAccessStatusRevoked is a ContentAccessStatus of type revoked.
|
|
ContentAccessStatusRevoked ContentAccessStatus = "revoked"
|
|
// ContentAccessStatusExpired is a ContentAccessStatus of type expired.
|
|
ContentAccessStatusExpired ContentAccessStatus = "expired"
|
|
)
|
|
|
|
var ErrInvalidContentAccessStatus = fmt.Errorf("not a valid ContentAccessStatus, try [%s]", strings.Join(_ContentAccessStatusNames, ", "))
|
|
|
|
var _ContentAccessStatusNames = []string{
|
|
string(ContentAccessStatusActive),
|
|
string(ContentAccessStatusRevoked),
|
|
string(ContentAccessStatusExpired),
|
|
}
|
|
|
|
// ContentAccessStatusNames returns a list of possible string values of ContentAccessStatus.
|
|
func ContentAccessStatusNames() []string {
|
|
tmp := make([]string, len(_ContentAccessStatusNames))
|
|
copy(tmp, _ContentAccessStatusNames)
|
|
return tmp
|
|
}
|
|
|
|
// ContentAccessStatusValues returns a list of the values for ContentAccessStatus
|
|
func ContentAccessStatusValues() []ContentAccessStatus {
|
|
return []ContentAccessStatus{
|
|
ContentAccessStatusActive,
|
|
ContentAccessStatusRevoked,
|
|
ContentAccessStatusExpired,
|
|
}
|
|
}
|
|
|
|
// String implements the Stringer interface.
|
|
func (x ContentAccessStatus) 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 ContentAccessStatus) IsValid() bool {
|
|
_, err := ParseContentAccessStatus(string(x))
|
|
return err == nil
|
|
}
|
|
|
|
var _ContentAccessStatusValue = map[string]ContentAccessStatus{
|
|
"active": ContentAccessStatusActive,
|
|
"revoked": ContentAccessStatusRevoked,
|
|
"expired": ContentAccessStatusExpired,
|
|
}
|
|
|
|
// ParseContentAccessStatus attempts to convert a string to a ContentAccessStatus.
|
|
func ParseContentAccessStatus(name string) (ContentAccessStatus, error) {
|
|
if x, ok := _ContentAccessStatusValue[name]; ok {
|
|
return x, nil
|
|
}
|
|
return ContentAccessStatus(""), fmt.Errorf("%s is %w", name, ErrInvalidContentAccessStatus)
|
|
}
|
|
|
|
var errContentAccessStatusNilPtr = errors.New("value pointer is nil") // one per type for package clashes
|
|
|
|
// Scan implements the Scanner interface.
|
|
func (x *ContentAccessStatus) Scan(value interface{}) (err error) {
|
|
if value == nil {
|
|
*x = ContentAccessStatus("")
|
|
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 = ParseContentAccessStatus(v)
|
|
case []byte:
|
|
*x, err = ParseContentAccessStatus(string(v))
|
|
case ContentAccessStatus:
|
|
*x = v
|
|
case *ContentAccessStatus:
|
|
if v == nil {
|
|
return errContentAccessStatusNilPtr
|
|
}
|
|
*x = *v
|
|
case *string:
|
|
if v == nil {
|
|
return errContentAccessStatusNilPtr
|
|
}
|
|
*x, err = ParseContentAccessStatus(*v)
|
|
default:
|
|
return errors.New("invalid type for ContentAccessStatus")
|
|
}
|
|
|
|
return
|
|
}
|
|
|
|
// Value implements the driver Valuer interface.
|
|
func (x ContentAccessStatus) Value() (driver.Value, error) {
|
|
return x.String(), nil
|
|
}
|
|
|
|
// Set implements the Golang flag.Value interface func.
|
|
func (x *ContentAccessStatus) Set(val string) error {
|
|
v, err := ParseContentAccessStatus(val)
|
|
*x = v
|
|
return err
|
|
}
|
|
|
|
// Get implements the Golang flag.Getter interface func.
|
|
func (x *ContentAccessStatus) Get() interface{} {
|
|
return *x
|
|
}
|
|
|
|
// Type implements the github.com/spf13/pFlag Value interface.
|
|
func (x *ContentAccessStatus) Type() string {
|
|
return "ContentAccessStatus"
|
|
}
|
|
|
|
type NullContentAccessStatus struct {
|
|
ContentAccessStatus ContentAccessStatus
|
|
Valid bool
|
|
}
|
|
|
|
func NewNullContentAccessStatus(val interface{}) (x NullContentAccessStatus) {
|
|
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 *NullContentAccessStatus) Scan(value interface{}) (err error) {
|
|
if value == nil {
|
|
x.ContentAccessStatus, x.Valid = ContentAccessStatus(""), false
|
|
return
|
|
}
|
|
|
|
err = x.ContentAccessStatus.Scan(value)
|
|
x.Valid = (err == nil)
|
|
return
|
|
}
|
|
|
|
// Value implements the driver Valuer interface.
|
|
func (x NullContentAccessStatus) Value() (driver.Value, error) {
|
|
if !x.Valid {
|
|
return nil, nil
|
|
}
|
|
// driver.Value accepts int64 for int values.
|
|
return string(x.ContentAccessStatus), nil
|
|
}
|
|
|
|
type NullContentAccessStatusStr struct {
|
|
NullContentAccessStatus
|
|
}
|
|
|
|
func NewNullContentAccessStatusStr(val interface{}) (x NullContentAccessStatusStr) {
|
|
x.Scan(val) // yes, we ignore this error, it will just be an invalid value.
|
|
return
|
|
}
|
|
|
|
// Value implements the driver Valuer interface.
|
|
func (x NullContentAccessStatusStr) Value() (driver.Value, error) {
|
|
if !x.Valid {
|
|
return nil, nil
|
|
}
|
|
return x.ContentAccessStatus.String(), nil
|
|
}
|
|
|
|
const (
|
|
// ContentAssetRoleMain is a ContentAssetRole of type main.
|
|
ContentAssetRoleMain ContentAssetRole = "main"
|
|
// ContentAssetRoleCover is a ContentAssetRole of type cover.
|
|
ContentAssetRoleCover ContentAssetRole = "cover"
|
|
// ContentAssetRolePreview is a ContentAssetRole of type preview.
|
|
ContentAssetRolePreview ContentAssetRole = "preview"
|
|
)
|
|
|
|
var ErrInvalidContentAssetRole = fmt.Errorf("not a valid ContentAssetRole, try [%s]", strings.Join(_ContentAssetRoleNames, ", "))
|
|
|
|
var _ContentAssetRoleNames = []string{
|
|
string(ContentAssetRoleMain),
|
|
string(ContentAssetRoleCover),
|
|
string(ContentAssetRolePreview),
|
|
}
|
|
|
|
// ContentAssetRoleNames returns a list of possible string values of ContentAssetRole.
|
|
func ContentAssetRoleNames() []string {
|
|
tmp := make([]string, len(_ContentAssetRoleNames))
|
|
copy(tmp, _ContentAssetRoleNames)
|
|
return tmp
|
|
}
|
|
|
|
// ContentAssetRoleValues returns a list of the values for ContentAssetRole
|
|
func ContentAssetRoleValues() []ContentAssetRole {
|
|
return []ContentAssetRole{
|
|
ContentAssetRoleMain,
|
|
ContentAssetRoleCover,
|
|
ContentAssetRolePreview,
|
|
}
|
|
}
|
|
|
|
// String implements the Stringer interface.
|
|
func (x ContentAssetRole) 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 ContentAssetRole) IsValid() bool {
|
|
_, err := ParseContentAssetRole(string(x))
|
|
return err == nil
|
|
}
|
|
|
|
var _ContentAssetRoleValue = map[string]ContentAssetRole{
|
|
"main": ContentAssetRoleMain,
|
|
"cover": ContentAssetRoleCover,
|
|
"preview": ContentAssetRolePreview,
|
|
}
|
|
|
|
// ParseContentAssetRole attempts to convert a string to a ContentAssetRole.
|
|
func ParseContentAssetRole(name string) (ContentAssetRole, error) {
|
|
if x, ok := _ContentAssetRoleValue[name]; ok {
|
|
return x, nil
|
|
}
|
|
return ContentAssetRole(""), fmt.Errorf("%s is %w", name, ErrInvalidContentAssetRole)
|
|
}
|
|
|
|
var errContentAssetRoleNilPtr = errors.New("value pointer is nil") // one per type for package clashes
|
|
|
|
// Scan implements the Scanner interface.
|
|
func (x *ContentAssetRole) Scan(value interface{}) (err error) {
|
|
if value == nil {
|
|
*x = ContentAssetRole("")
|
|
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 = ParseContentAssetRole(v)
|
|
case []byte:
|
|
*x, err = ParseContentAssetRole(string(v))
|
|
case ContentAssetRole:
|
|
*x = v
|
|
case *ContentAssetRole:
|
|
if v == nil {
|
|
return errContentAssetRoleNilPtr
|
|
}
|
|
*x = *v
|
|
case *string:
|
|
if v == nil {
|
|
return errContentAssetRoleNilPtr
|
|
}
|
|
*x, err = ParseContentAssetRole(*v)
|
|
default:
|
|
return errors.New("invalid type for ContentAssetRole")
|
|
}
|
|
|
|
return
|
|
}
|
|
|
|
// Value implements the driver Valuer interface.
|
|
func (x ContentAssetRole) Value() (driver.Value, error) {
|
|
return x.String(), nil
|
|
}
|
|
|
|
// Set implements the Golang flag.Value interface func.
|
|
func (x *ContentAssetRole) Set(val string) error {
|
|
v, err := ParseContentAssetRole(val)
|
|
*x = v
|
|
return err
|
|
}
|
|
|
|
// Get implements the Golang flag.Getter interface func.
|
|
func (x *ContentAssetRole) Get() interface{} {
|
|
return *x
|
|
}
|
|
|
|
// Type implements the github.com/spf13/pFlag Value interface.
|
|
func (x *ContentAssetRole) Type() string {
|
|
return "ContentAssetRole"
|
|
}
|
|
|
|
type NullContentAssetRole struct {
|
|
ContentAssetRole ContentAssetRole
|
|
Valid bool
|
|
}
|
|
|
|
func NewNullContentAssetRole(val interface{}) (x NullContentAssetRole) {
|
|
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 *NullContentAssetRole) Scan(value interface{}) (err error) {
|
|
if value == nil {
|
|
x.ContentAssetRole, x.Valid = ContentAssetRole(""), false
|
|
return
|
|
}
|
|
|
|
err = x.ContentAssetRole.Scan(value)
|
|
x.Valid = (err == nil)
|
|
return
|
|
}
|
|
|
|
// Value implements the driver Valuer interface.
|
|
func (x NullContentAssetRole) Value() (driver.Value, error) {
|
|
if !x.Valid {
|
|
return nil, nil
|
|
}
|
|
// driver.Value accepts int64 for int values.
|
|
return string(x.ContentAssetRole), nil
|
|
}
|
|
|
|
type NullContentAssetRoleStr struct {
|
|
NullContentAssetRole
|
|
}
|
|
|
|
func NewNullContentAssetRoleStr(val interface{}) (x NullContentAssetRoleStr) {
|
|
x.Scan(val) // yes, we ignore this error, it will just be an invalid value.
|
|
return
|
|
}
|
|
|
|
// Value implements the driver Valuer interface.
|
|
func (x NullContentAssetRoleStr) Value() (driver.Value, error) {
|
|
if !x.Valid {
|
|
return nil, nil
|
|
}
|
|
return x.ContentAssetRole.String(), nil
|
|
}
|
|
|
|
const (
|
|
// ContentStatusDraft is a ContentStatus of type draft.
|
|
ContentStatusDraft ContentStatus = "draft"
|
|
// ContentStatusReviewing is a ContentStatus of type reviewing.
|
|
ContentStatusReviewing ContentStatus = "reviewing"
|
|
// ContentStatusPublished is a ContentStatus of type published.
|
|
ContentStatusPublished ContentStatus = "published"
|
|
// ContentStatusUnpublished is a ContentStatus of type unpublished.
|
|
ContentStatusUnpublished ContentStatus = "unpublished"
|
|
// ContentStatusBlocked is a ContentStatus of type blocked.
|
|
ContentStatusBlocked ContentStatus = "blocked"
|
|
)
|
|
|
|
var ErrInvalidContentStatus = fmt.Errorf("not a valid ContentStatus, try [%s]", strings.Join(_ContentStatusNames, ", "))
|
|
|
|
var _ContentStatusNames = []string{
|
|
string(ContentStatusDraft),
|
|
string(ContentStatusReviewing),
|
|
string(ContentStatusPublished),
|
|
string(ContentStatusUnpublished),
|
|
string(ContentStatusBlocked),
|
|
}
|
|
|
|
// ContentStatusNames returns a list of possible string values of ContentStatus.
|
|
func ContentStatusNames() []string {
|
|
tmp := make([]string, len(_ContentStatusNames))
|
|
copy(tmp, _ContentStatusNames)
|
|
return tmp
|
|
}
|
|
|
|
// ContentStatusValues returns a list of the values for ContentStatus
|
|
func ContentStatusValues() []ContentStatus {
|
|
return []ContentStatus{
|
|
ContentStatusDraft,
|
|
ContentStatusReviewing,
|
|
ContentStatusPublished,
|
|
ContentStatusUnpublished,
|
|
ContentStatusBlocked,
|
|
}
|
|
}
|
|
|
|
// String implements the Stringer interface.
|
|
func (x ContentStatus) 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 ContentStatus) IsValid() bool {
|
|
_, err := ParseContentStatus(string(x))
|
|
return err == nil
|
|
}
|
|
|
|
var _ContentStatusValue = map[string]ContentStatus{
|
|
"draft": ContentStatusDraft,
|
|
"reviewing": ContentStatusReviewing,
|
|
"published": ContentStatusPublished,
|
|
"unpublished": ContentStatusUnpublished,
|
|
"blocked": ContentStatusBlocked,
|
|
}
|
|
|
|
// ParseContentStatus attempts to convert a string to a ContentStatus.
|
|
func ParseContentStatus(name string) (ContentStatus, error) {
|
|
if x, ok := _ContentStatusValue[name]; ok {
|
|
return x, nil
|
|
}
|
|
return ContentStatus(""), fmt.Errorf("%s is %w", name, ErrInvalidContentStatus)
|
|
}
|
|
|
|
var errContentStatusNilPtr = errors.New("value pointer is nil") // one per type for package clashes
|
|
|
|
// Scan implements the Scanner interface.
|
|
func (x *ContentStatus) Scan(value interface{}) (err error) {
|
|
if value == nil {
|
|
*x = ContentStatus("")
|
|
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 = ParseContentStatus(v)
|
|
case []byte:
|
|
*x, err = ParseContentStatus(string(v))
|
|
case ContentStatus:
|
|
*x = v
|
|
case *ContentStatus:
|
|
if v == nil {
|
|
return errContentStatusNilPtr
|
|
}
|
|
*x = *v
|
|
case *string:
|
|
if v == nil {
|
|
return errContentStatusNilPtr
|
|
}
|
|
*x, err = ParseContentStatus(*v)
|
|
default:
|
|
return errors.New("invalid type for ContentStatus")
|
|
}
|
|
|
|
return
|
|
}
|
|
|
|
// Value implements the driver Valuer interface.
|
|
func (x ContentStatus) Value() (driver.Value, error) {
|
|
return x.String(), nil
|
|
}
|
|
|
|
// Set implements the Golang flag.Value interface func.
|
|
func (x *ContentStatus) Set(val string) error {
|
|
v, err := ParseContentStatus(val)
|
|
*x = v
|
|
return err
|
|
}
|
|
|
|
// Get implements the Golang flag.Getter interface func.
|
|
func (x *ContentStatus) Get() interface{} {
|
|
return *x
|
|
}
|
|
|
|
// Type implements the github.com/spf13/pFlag Value interface.
|
|
func (x *ContentStatus) Type() string {
|
|
return "ContentStatus"
|
|
}
|
|
|
|
type NullContentStatus struct {
|
|
ContentStatus ContentStatus
|
|
Valid bool
|
|
}
|
|
|
|
func NewNullContentStatus(val interface{}) (x NullContentStatus) {
|
|
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 *NullContentStatus) Scan(value interface{}) (err error) {
|
|
if value == nil {
|
|
x.ContentStatus, x.Valid = ContentStatus(""), false
|
|
return
|
|
}
|
|
|
|
err = x.ContentStatus.Scan(value)
|
|
x.Valid = (err == nil)
|
|
return
|
|
}
|
|
|
|
// Value implements the driver Valuer interface.
|
|
func (x NullContentStatus) Value() (driver.Value, error) {
|
|
if !x.Valid {
|
|
return nil, nil
|
|
}
|
|
// driver.Value accepts int64 for int values.
|
|
return string(x.ContentStatus), nil
|
|
}
|
|
|
|
type NullContentStatusStr struct {
|
|
NullContentStatus
|
|
}
|
|
|
|
func NewNullContentStatusStr(val interface{}) (x NullContentStatusStr) {
|
|
x.Scan(val) // yes, we ignore this error, it will just be an invalid value.
|
|
return
|
|
}
|
|
|
|
// Value implements the driver Valuer interface.
|
|
func (x NullContentStatusStr) Value() (driver.Value, error) {
|
|
if !x.Valid {
|
|
return nil, nil
|
|
}
|
|
return x.ContentStatus.String(), nil
|
|
}
|
|
|
|
const (
|
|
// ContentVisibilityPublic is a ContentVisibility of type public.
|
|
ContentVisibilityPublic ContentVisibility = "public"
|
|
// ContentVisibilityTenantOnly is a ContentVisibility of type tenant_only.
|
|
ContentVisibilityTenantOnly ContentVisibility = "tenant_only"
|
|
// ContentVisibilityPrivate is a ContentVisibility of type private.
|
|
ContentVisibilityPrivate ContentVisibility = "private"
|
|
)
|
|
|
|
var ErrInvalidContentVisibility = fmt.Errorf("not a valid ContentVisibility, try [%s]", strings.Join(_ContentVisibilityNames, ", "))
|
|
|
|
var _ContentVisibilityNames = []string{
|
|
string(ContentVisibilityPublic),
|
|
string(ContentVisibilityTenantOnly),
|
|
string(ContentVisibilityPrivate),
|
|
}
|
|
|
|
// ContentVisibilityNames returns a list of possible string values of ContentVisibility.
|
|
func ContentVisibilityNames() []string {
|
|
tmp := make([]string, len(_ContentVisibilityNames))
|
|
copy(tmp, _ContentVisibilityNames)
|
|
return tmp
|
|
}
|
|
|
|
// ContentVisibilityValues returns a list of the values for ContentVisibility
|
|
func ContentVisibilityValues() []ContentVisibility {
|
|
return []ContentVisibility{
|
|
ContentVisibilityPublic,
|
|
ContentVisibilityTenantOnly,
|
|
ContentVisibilityPrivate,
|
|
}
|
|
}
|
|
|
|
// String implements the Stringer interface.
|
|
func (x ContentVisibility) 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 ContentVisibility) IsValid() bool {
|
|
_, err := ParseContentVisibility(string(x))
|
|
return err == nil
|
|
}
|
|
|
|
var _ContentVisibilityValue = map[string]ContentVisibility{
|
|
"public": ContentVisibilityPublic,
|
|
"tenant_only": ContentVisibilityTenantOnly,
|
|
"private": ContentVisibilityPrivate,
|
|
}
|
|
|
|
// ParseContentVisibility attempts to convert a string to a ContentVisibility.
|
|
func ParseContentVisibility(name string) (ContentVisibility, error) {
|
|
if x, ok := _ContentVisibilityValue[name]; ok {
|
|
return x, nil
|
|
}
|
|
return ContentVisibility(""), fmt.Errorf("%s is %w", name, ErrInvalidContentVisibility)
|
|
}
|
|
|
|
var errContentVisibilityNilPtr = errors.New("value pointer is nil") // one per type for package clashes
|
|
|
|
// Scan implements the Scanner interface.
|
|
func (x *ContentVisibility) Scan(value interface{}) (err error) {
|
|
if value == nil {
|
|
*x = ContentVisibility("")
|
|
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 = ParseContentVisibility(v)
|
|
case []byte:
|
|
*x, err = ParseContentVisibility(string(v))
|
|
case ContentVisibility:
|
|
*x = v
|
|
case *ContentVisibility:
|
|
if v == nil {
|
|
return errContentVisibilityNilPtr
|
|
}
|
|
*x = *v
|
|
case *string:
|
|
if v == nil {
|
|
return errContentVisibilityNilPtr
|
|
}
|
|
*x, err = ParseContentVisibility(*v)
|
|
default:
|
|
return errors.New("invalid type for ContentVisibility")
|
|
}
|
|
|
|
return
|
|
}
|
|
|
|
// Value implements the driver Valuer interface.
|
|
func (x ContentVisibility) Value() (driver.Value, error) {
|
|
return x.String(), nil
|
|
}
|
|
|
|
// Set implements the Golang flag.Value interface func.
|
|
func (x *ContentVisibility) Set(val string) error {
|
|
v, err := ParseContentVisibility(val)
|
|
*x = v
|
|
return err
|
|
}
|
|
|
|
// Get implements the Golang flag.Getter interface func.
|
|
func (x *ContentVisibility) Get() interface{} {
|
|
return *x
|
|
}
|
|
|
|
// Type implements the github.com/spf13/pFlag Value interface.
|
|
func (x *ContentVisibility) Type() string {
|
|
return "ContentVisibility"
|
|
}
|
|
|
|
type NullContentVisibility struct {
|
|
ContentVisibility ContentVisibility
|
|
Valid bool
|
|
}
|
|
|
|
func NewNullContentVisibility(val interface{}) (x NullContentVisibility) {
|
|
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 *NullContentVisibility) Scan(value interface{}) (err error) {
|
|
if value == nil {
|
|
x.ContentVisibility, x.Valid = ContentVisibility(""), false
|
|
return
|
|
}
|
|
|
|
err = x.ContentVisibility.Scan(value)
|
|
x.Valid = (err == nil)
|
|
return
|
|
}
|
|
|
|
// Value implements the driver Valuer interface.
|
|
func (x NullContentVisibility) Value() (driver.Value, error) {
|
|
if !x.Valid {
|
|
return nil, nil
|
|
}
|
|
// driver.Value accepts int64 for int values.
|
|
return string(x.ContentVisibility), nil
|
|
}
|
|
|
|
type NullContentVisibilityStr struct {
|
|
NullContentVisibility
|
|
}
|
|
|
|
func NewNullContentVisibilityStr(val interface{}) (x NullContentVisibilityStr) {
|
|
x.Scan(val) // yes, we ignore this error, it will just be an invalid value.
|
|
return
|
|
}
|
|
|
|
// Value implements the driver Valuer interface.
|
|
func (x NullContentVisibilityStr) Value() (driver.Value, error) {
|
|
if !x.Valid {
|
|
return nil, nil
|
|
}
|
|
return x.ContentVisibility.String(), nil
|
|
}
|
|
|
|
const (
|
|
// CurrencyCNY is a Currency of type CNY.
|
|
CurrencyCNY Currency = "CNY"
|
|
)
|
|
|
|
var ErrInvalidCurrency = fmt.Errorf("not a valid Currency, try [%s]", strings.Join(_CurrencyNames, ", "))
|
|
|
|
var _CurrencyNames = []string{
|
|
string(CurrencyCNY),
|
|
}
|
|
|
|
// CurrencyNames returns a list of possible string values of Currency.
|
|
func CurrencyNames() []string {
|
|
tmp := make([]string, len(_CurrencyNames))
|
|
copy(tmp, _CurrencyNames)
|
|
return tmp
|
|
}
|
|
|
|
// CurrencyValues returns a list of the values for Currency
|
|
func CurrencyValues() []Currency {
|
|
return []Currency{
|
|
CurrencyCNY,
|
|
}
|
|
}
|
|
|
|
// String implements the Stringer interface.
|
|
func (x Currency) 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 Currency) IsValid() bool {
|
|
_, err := ParseCurrency(string(x))
|
|
return err == nil
|
|
}
|
|
|
|
var _CurrencyValue = map[string]Currency{
|
|
"CNY": CurrencyCNY,
|
|
}
|
|
|
|
// ParseCurrency attempts to convert a string to a Currency.
|
|
func ParseCurrency(name string) (Currency, error) {
|
|
if x, ok := _CurrencyValue[name]; ok {
|
|
return x, nil
|
|
}
|
|
return Currency(""), fmt.Errorf("%s is %w", name, ErrInvalidCurrency)
|
|
}
|
|
|
|
var errCurrencyNilPtr = errors.New("value pointer is nil") // one per type for package clashes
|
|
|
|
// Scan implements the Scanner interface.
|
|
func (x *Currency) Scan(value interface{}) (err error) {
|
|
if value == nil {
|
|
*x = Currency("")
|
|
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 = ParseCurrency(v)
|
|
case []byte:
|
|
*x, err = ParseCurrency(string(v))
|
|
case Currency:
|
|
*x = v
|
|
case *Currency:
|
|
if v == nil {
|
|
return errCurrencyNilPtr
|
|
}
|
|
*x = *v
|
|
case *string:
|
|
if v == nil {
|
|
return errCurrencyNilPtr
|
|
}
|
|
*x, err = ParseCurrency(*v)
|
|
default:
|
|
return errors.New("invalid type for Currency")
|
|
}
|
|
|
|
return
|
|
}
|
|
|
|
// Value implements the driver Valuer interface.
|
|
func (x Currency) Value() (driver.Value, error) {
|
|
return x.String(), nil
|
|
}
|
|
|
|
// Set implements the Golang flag.Value interface func.
|
|
func (x *Currency) Set(val string) error {
|
|
v, err := ParseCurrency(val)
|
|
*x = v
|
|
return err
|
|
}
|
|
|
|
// Get implements the Golang flag.Getter interface func.
|
|
func (x *Currency) Get() interface{} {
|
|
return *x
|
|
}
|
|
|
|
// Type implements the github.com/spf13/pFlag Value interface.
|
|
func (x *Currency) Type() string {
|
|
return "Currency"
|
|
}
|
|
|
|
type NullCurrency struct {
|
|
Currency Currency
|
|
Valid bool
|
|
}
|
|
|
|
func NewNullCurrency(val interface{}) (x NullCurrency) {
|
|
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 *NullCurrency) Scan(value interface{}) (err error) {
|
|
if value == nil {
|
|
x.Currency, x.Valid = Currency(""), false
|
|
return
|
|
}
|
|
|
|
err = x.Currency.Scan(value)
|
|
x.Valid = (err == nil)
|
|
return
|
|
}
|
|
|
|
// Value implements the driver Valuer interface.
|
|
func (x NullCurrency) Value() (driver.Value, error) {
|
|
if !x.Valid {
|
|
return nil, nil
|
|
}
|
|
// driver.Value accepts int64 for int values.
|
|
return string(x.Currency), nil
|
|
}
|
|
|
|
type NullCurrencyStr struct {
|
|
NullCurrency
|
|
}
|
|
|
|
func NewNullCurrencyStr(val interface{}) (x NullCurrencyStr) {
|
|
x.Scan(val) // yes, we ignore this error, it will just be an invalid value.
|
|
return
|
|
}
|
|
|
|
// Value implements the driver Valuer interface.
|
|
func (x NullCurrencyStr) Value() (driver.Value, error) {
|
|
if !x.Valid {
|
|
return nil, nil
|
|
}
|
|
return x.Currency.String(), nil
|
|
}
|
|
|
|
const (
|
|
// DiscountTypeNone is a DiscountType of type none.
|
|
DiscountTypeNone DiscountType = "none"
|
|
// DiscountTypePercent is a DiscountType of type percent.
|
|
DiscountTypePercent DiscountType = "percent"
|
|
// DiscountTypeAmount is a DiscountType of type amount.
|
|
DiscountTypeAmount DiscountType = "amount"
|
|
)
|
|
|
|
var ErrInvalidDiscountType = fmt.Errorf("not a valid DiscountType, try [%s]", strings.Join(_DiscountTypeNames, ", "))
|
|
|
|
var _DiscountTypeNames = []string{
|
|
string(DiscountTypeNone),
|
|
string(DiscountTypePercent),
|
|
string(DiscountTypeAmount),
|
|
}
|
|
|
|
// DiscountTypeNames returns a list of possible string values of DiscountType.
|
|
func DiscountTypeNames() []string {
|
|
tmp := make([]string, len(_DiscountTypeNames))
|
|
copy(tmp, _DiscountTypeNames)
|
|
return tmp
|
|
}
|
|
|
|
// DiscountTypeValues returns a list of the values for DiscountType
|
|
func DiscountTypeValues() []DiscountType {
|
|
return []DiscountType{
|
|
DiscountTypeNone,
|
|
DiscountTypePercent,
|
|
DiscountTypeAmount,
|
|
}
|
|
}
|
|
|
|
// String implements the Stringer interface.
|
|
func (x DiscountType) 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 DiscountType) IsValid() bool {
|
|
_, err := ParseDiscountType(string(x))
|
|
return err == nil
|
|
}
|
|
|
|
var _DiscountTypeValue = map[string]DiscountType{
|
|
"none": DiscountTypeNone,
|
|
"percent": DiscountTypePercent,
|
|
"amount": DiscountTypeAmount,
|
|
}
|
|
|
|
// ParseDiscountType attempts to convert a string to a DiscountType.
|
|
func ParseDiscountType(name string) (DiscountType, error) {
|
|
if x, ok := _DiscountTypeValue[name]; ok {
|
|
return x, nil
|
|
}
|
|
return DiscountType(""), fmt.Errorf("%s is %w", name, ErrInvalidDiscountType)
|
|
}
|
|
|
|
var errDiscountTypeNilPtr = errors.New("value pointer is nil") // one per type for package clashes
|
|
|
|
// Scan implements the Scanner interface.
|
|
func (x *DiscountType) Scan(value interface{}) (err error) {
|
|
if value == nil {
|
|
*x = DiscountType("")
|
|
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 = ParseDiscountType(v)
|
|
case []byte:
|
|
*x, err = ParseDiscountType(string(v))
|
|
case DiscountType:
|
|
*x = v
|
|
case *DiscountType:
|
|
if v == nil {
|
|
return errDiscountTypeNilPtr
|
|
}
|
|
*x = *v
|
|
case *string:
|
|
if v == nil {
|
|
return errDiscountTypeNilPtr
|
|
}
|
|
*x, err = ParseDiscountType(*v)
|
|
default:
|
|
return errors.New("invalid type for DiscountType")
|
|
}
|
|
|
|
return
|
|
}
|
|
|
|
// Value implements the driver Valuer interface.
|
|
func (x DiscountType) Value() (driver.Value, error) {
|
|
return x.String(), nil
|
|
}
|
|
|
|
// Set implements the Golang flag.Value interface func.
|
|
func (x *DiscountType) Set(val string) error {
|
|
v, err := ParseDiscountType(val)
|
|
*x = v
|
|
return err
|
|
}
|
|
|
|
// Get implements the Golang flag.Getter interface func.
|
|
func (x *DiscountType) Get() interface{} {
|
|
return *x
|
|
}
|
|
|
|
// Type implements the github.com/spf13/pFlag Value interface.
|
|
func (x *DiscountType) Type() string {
|
|
return "DiscountType"
|
|
}
|
|
|
|
type NullDiscountType struct {
|
|
DiscountType DiscountType
|
|
Valid bool
|
|
}
|
|
|
|
func NewNullDiscountType(val interface{}) (x NullDiscountType) {
|
|
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 *NullDiscountType) Scan(value interface{}) (err error) {
|
|
if value == nil {
|
|
x.DiscountType, x.Valid = DiscountType(""), false
|
|
return
|
|
}
|
|
|
|
err = x.DiscountType.Scan(value)
|
|
x.Valid = (err == nil)
|
|
return
|
|
}
|
|
|
|
// Value implements the driver Valuer interface.
|
|
func (x NullDiscountType) Value() (driver.Value, error) {
|
|
if !x.Valid {
|
|
return nil, nil
|
|
}
|
|
// driver.Value accepts int64 for int values.
|
|
return string(x.DiscountType), nil
|
|
}
|
|
|
|
type NullDiscountTypeStr struct {
|
|
NullDiscountType
|
|
}
|
|
|
|
func NewNullDiscountTypeStr(val interface{}) (x NullDiscountTypeStr) {
|
|
x.Scan(val) // yes, we ignore this error, it will just be an invalid value.
|
|
return
|
|
}
|
|
|
|
// Value implements the driver Valuer interface.
|
|
func (x NullDiscountTypeStr) Value() (driver.Value, error) {
|
|
if !x.Valid {
|
|
return nil, nil
|
|
}
|
|
return x.DiscountType.String(), nil
|
|
}
|
|
|
|
const (
|
|
// MediaAssetStatusUploaded is a MediaAssetStatus of type uploaded.
|
|
MediaAssetStatusUploaded MediaAssetStatus = "uploaded"
|
|
// MediaAssetStatusProcessing is a MediaAssetStatus of type processing.
|
|
MediaAssetStatusProcessing MediaAssetStatus = "processing"
|
|
// MediaAssetStatusReady is a MediaAssetStatus of type ready.
|
|
MediaAssetStatusReady MediaAssetStatus = "ready"
|
|
// MediaAssetStatusFailed is a MediaAssetStatus of type failed.
|
|
MediaAssetStatusFailed MediaAssetStatus = "failed"
|
|
// MediaAssetStatusDeleted is a MediaAssetStatus of type deleted.
|
|
MediaAssetStatusDeleted MediaAssetStatus = "deleted"
|
|
)
|
|
|
|
var ErrInvalidMediaAssetStatus = fmt.Errorf("not a valid MediaAssetStatus, try [%s]", strings.Join(_MediaAssetStatusNames, ", "))
|
|
|
|
var _MediaAssetStatusNames = []string{
|
|
string(MediaAssetStatusUploaded),
|
|
string(MediaAssetStatusProcessing),
|
|
string(MediaAssetStatusReady),
|
|
string(MediaAssetStatusFailed),
|
|
string(MediaAssetStatusDeleted),
|
|
}
|
|
|
|
// MediaAssetStatusNames returns a list of possible string values of MediaAssetStatus.
|
|
func MediaAssetStatusNames() []string {
|
|
tmp := make([]string, len(_MediaAssetStatusNames))
|
|
copy(tmp, _MediaAssetStatusNames)
|
|
return tmp
|
|
}
|
|
|
|
// MediaAssetStatusValues returns a list of the values for MediaAssetStatus
|
|
func MediaAssetStatusValues() []MediaAssetStatus {
|
|
return []MediaAssetStatus{
|
|
MediaAssetStatusUploaded,
|
|
MediaAssetStatusProcessing,
|
|
MediaAssetStatusReady,
|
|
MediaAssetStatusFailed,
|
|
MediaAssetStatusDeleted,
|
|
}
|
|
}
|
|
|
|
// String implements the Stringer interface.
|
|
func (x MediaAssetStatus) 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 MediaAssetStatus) IsValid() bool {
|
|
_, err := ParseMediaAssetStatus(string(x))
|
|
return err == nil
|
|
}
|
|
|
|
var _MediaAssetStatusValue = map[string]MediaAssetStatus{
|
|
"uploaded": MediaAssetStatusUploaded,
|
|
"processing": MediaAssetStatusProcessing,
|
|
"ready": MediaAssetStatusReady,
|
|
"failed": MediaAssetStatusFailed,
|
|
"deleted": MediaAssetStatusDeleted,
|
|
}
|
|
|
|
// ParseMediaAssetStatus attempts to convert a string to a MediaAssetStatus.
|
|
func ParseMediaAssetStatus(name string) (MediaAssetStatus, error) {
|
|
if x, ok := _MediaAssetStatusValue[name]; ok {
|
|
return x, nil
|
|
}
|
|
return MediaAssetStatus(""), fmt.Errorf("%s is %w", name, ErrInvalidMediaAssetStatus)
|
|
}
|
|
|
|
var errMediaAssetStatusNilPtr = errors.New("value pointer is nil") // one per type for package clashes
|
|
|
|
// Scan implements the Scanner interface.
|
|
func (x *MediaAssetStatus) Scan(value interface{}) (err error) {
|
|
if value == nil {
|
|
*x = MediaAssetStatus("")
|
|
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 = ParseMediaAssetStatus(v)
|
|
case []byte:
|
|
*x, err = ParseMediaAssetStatus(string(v))
|
|
case MediaAssetStatus:
|
|
*x = v
|
|
case *MediaAssetStatus:
|
|
if v == nil {
|
|
return errMediaAssetStatusNilPtr
|
|
}
|
|
*x = *v
|
|
case *string:
|
|
if v == nil {
|
|
return errMediaAssetStatusNilPtr
|
|
}
|
|
*x, err = ParseMediaAssetStatus(*v)
|
|
default:
|
|
return errors.New("invalid type for MediaAssetStatus")
|
|
}
|
|
|
|
return
|
|
}
|
|
|
|
// Value implements the driver Valuer interface.
|
|
func (x MediaAssetStatus) Value() (driver.Value, error) {
|
|
return x.String(), nil
|
|
}
|
|
|
|
// Set implements the Golang flag.Value interface func.
|
|
func (x *MediaAssetStatus) Set(val string) error {
|
|
v, err := ParseMediaAssetStatus(val)
|
|
*x = v
|
|
return err
|
|
}
|
|
|
|
// Get implements the Golang flag.Getter interface func.
|
|
func (x *MediaAssetStatus) Get() interface{} {
|
|
return *x
|
|
}
|
|
|
|
// Type implements the github.com/spf13/pFlag Value interface.
|
|
func (x *MediaAssetStatus) Type() string {
|
|
return "MediaAssetStatus"
|
|
}
|
|
|
|
type NullMediaAssetStatus struct {
|
|
MediaAssetStatus MediaAssetStatus
|
|
Valid bool
|
|
}
|
|
|
|
func NewNullMediaAssetStatus(val interface{}) (x NullMediaAssetStatus) {
|
|
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 *NullMediaAssetStatus) Scan(value interface{}) (err error) {
|
|
if value == nil {
|
|
x.MediaAssetStatus, x.Valid = MediaAssetStatus(""), false
|
|
return
|
|
}
|
|
|
|
err = x.MediaAssetStatus.Scan(value)
|
|
x.Valid = (err == nil)
|
|
return
|
|
}
|
|
|
|
// Value implements the driver Valuer interface.
|
|
func (x NullMediaAssetStatus) Value() (driver.Value, error) {
|
|
if !x.Valid {
|
|
return nil, nil
|
|
}
|
|
// driver.Value accepts int64 for int values.
|
|
return string(x.MediaAssetStatus), nil
|
|
}
|
|
|
|
type NullMediaAssetStatusStr struct {
|
|
NullMediaAssetStatus
|
|
}
|
|
|
|
func NewNullMediaAssetStatusStr(val interface{}) (x NullMediaAssetStatusStr) {
|
|
x.Scan(val) // yes, we ignore this error, it will just be an invalid value.
|
|
return
|
|
}
|
|
|
|
// Value implements the driver Valuer interface.
|
|
func (x NullMediaAssetStatusStr) Value() (driver.Value, error) {
|
|
if !x.Valid {
|
|
return nil, nil
|
|
}
|
|
return x.MediaAssetStatus.String(), nil
|
|
}
|
|
|
|
const (
|
|
// MediaAssetTypeVideo is a MediaAssetType of type video.
|
|
MediaAssetTypeVideo MediaAssetType = "video"
|
|
// MediaAssetTypeAudio is a MediaAssetType of type audio.
|
|
MediaAssetTypeAudio MediaAssetType = "audio"
|
|
// MediaAssetTypeImage is a MediaAssetType of type image.
|
|
MediaAssetTypeImage MediaAssetType = "image"
|
|
)
|
|
|
|
var ErrInvalidMediaAssetType = fmt.Errorf("not a valid MediaAssetType, try [%s]", strings.Join(_MediaAssetTypeNames, ", "))
|
|
|
|
var _MediaAssetTypeNames = []string{
|
|
string(MediaAssetTypeVideo),
|
|
string(MediaAssetTypeAudio),
|
|
string(MediaAssetTypeImage),
|
|
}
|
|
|
|
// 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{
|
|
MediaAssetTypeVideo,
|
|
MediaAssetTypeAudio,
|
|
MediaAssetTypeImage,
|
|
}
|
|
}
|
|
|
|
// 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{
|
|
"video": MediaAssetTypeVideo,
|
|
"audio": MediaAssetTypeAudio,
|
|
"image": MediaAssetTypeImage,
|
|
}
|
|
|
|
// 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
|
|
}
|
|
|
|
const (
|
|
// RoleUser is a Role of type user.
|
|
RoleUser Role = "user"
|
|
// RoleSuperAdmin is a Role of type super_admin.
|
|
RoleSuperAdmin Role = "super_admin"
|
|
)
|
|
|
|
var ErrInvalidRole = fmt.Errorf("not a valid Role, try [%s]", strings.Join(_RoleNames, ", "))
|
|
|
|
var _RoleNames = []string{
|
|
string(RoleUser),
|
|
string(RoleSuperAdmin),
|
|
}
|
|
|
|
// RoleNames returns a list of possible string values of Role.
|
|
func RoleNames() []string {
|
|
tmp := make([]string, len(_RoleNames))
|
|
copy(tmp, _RoleNames)
|
|
return tmp
|
|
}
|
|
|
|
// RoleValues returns a list of the values for Role
|
|
func RoleValues() []Role {
|
|
return []Role{
|
|
RoleUser,
|
|
RoleSuperAdmin,
|
|
}
|
|
}
|
|
|
|
// String implements the Stringer interface.
|
|
func (x Role) 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 Role) IsValid() bool {
|
|
_, err := ParseRole(string(x))
|
|
return err == nil
|
|
}
|
|
|
|
var _RoleValue = map[string]Role{
|
|
"user": RoleUser,
|
|
"super_admin": RoleSuperAdmin,
|
|
}
|
|
|
|
// ParseRole attempts to convert a string to a Role.
|
|
func ParseRole(name string) (Role, error) {
|
|
if x, ok := _RoleValue[name]; ok {
|
|
return x, nil
|
|
}
|
|
return Role(""), fmt.Errorf("%s is %w", name, ErrInvalidRole)
|
|
}
|
|
|
|
var errRoleNilPtr = errors.New("value pointer is nil") // one per type for package clashes
|
|
|
|
// Scan implements the Scanner interface.
|
|
func (x *Role) Scan(value interface{}) (err error) {
|
|
if value == nil {
|
|
*x = Role("")
|
|
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 = ParseRole(v)
|
|
case []byte:
|
|
*x, err = ParseRole(string(v))
|
|
case Role:
|
|
*x = v
|
|
case *Role:
|
|
if v == nil {
|
|
return errRoleNilPtr
|
|
}
|
|
*x = *v
|
|
case *string:
|
|
if v == nil {
|
|
return errRoleNilPtr
|
|
}
|
|
*x, err = ParseRole(*v)
|
|
default:
|
|
return errors.New("invalid type for Role")
|
|
}
|
|
|
|
return
|
|
}
|
|
|
|
// Value implements the driver Valuer interface.
|
|
func (x Role) Value() (driver.Value, error) {
|
|
return x.String(), nil
|
|
}
|
|
|
|
// Set implements the Golang flag.Value interface func.
|
|
func (x *Role) Set(val string) error {
|
|
v, err := ParseRole(val)
|
|
*x = v
|
|
return err
|
|
}
|
|
|
|
// Get implements the Golang flag.Getter interface func.
|
|
func (x *Role) Get() interface{} {
|
|
return *x
|
|
}
|
|
|
|
// Type implements the github.com/spf13/pFlag Value interface.
|
|
func (x *Role) Type() string {
|
|
return "Role"
|
|
}
|
|
|
|
type NullRole struct {
|
|
Role Role
|
|
Valid bool
|
|
}
|
|
|
|
func NewNullRole(val interface{}) (x NullRole) {
|
|
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 *NullRole) Scan(value interface{}) (err error) {
|
|
if value == nil {
|
|
x.Role, x.Valid = Role(""), false
|
|
return
|
|
}
|
|
|
|
err = x.Role.Scan(value)
|
|
x.Valid = (err == nil)
|
|
return
|
|
}
|
|
|
|
// Value implements the driver Valuer interface.
|
|
func (x NullRole) Value() (driver.Value, error) {
|
|
if !x.Valid {
|
|
return nil, nil
|
|
}
|
|
// driver.Value accepts int64 for int values.
|
|
return string(x.Role), nil
|
|
}
|
|
|
|
type NullRoleStr struct {
|
|
NullRole
|
|
}
|
|
|
|
func NewNullRoleStr(val interface{}) (x NullRoleStr) {
|
|
x.Scan(val) // yes, we ignore this error, it will just be an invalid value.
|
|
return
|
|
}
|
|
|
|
// Value implements the driver Valuer interface.
|
|
func (x NullRoleStr) Value() (driver.Value, error) {
|
|
if !x.Valid {
|
|
return nil, nil
|
|
}
|
|
return x.Role.String(), nil
|
|
}
|
|
|
|
const (
|
|
// TenantStatusPendingVerify is a TenantStatus of type pending_verify.
|
|
TenantStatusPendingVerify TenantStatus = "pending_verify"
|
|
// TenantStatusVerified is a TenantStatus of type verified.
|
|
TenantStatusVerified TenantStatus = "verified"
|
|
// TenantStatusBanned is a TenantStatus of type banned.
|
|
TenantStatusBanned TenantStatus = "banned"
|
|
)
|
|
|
|
var ErrInvalidTenantStatus = fmt.Errorf("not a valid TenantStatus, try [%s]", strings.Join(_TenantStatusNames, ", "))
|
|
|
|
var _TenantStatusNames = []string{
|
|
string(TenantStatusPendingVerify),
|
|
string(TenantStatusVerified),
|
|
string(TenantStatusBanned),
|
|
}
|
|
|
|
// TenantStatusNames returns a list of possible string values of TenantStatus.
|
|
func TenantStatusNames() []string {
|
|
tmp := make([]string, len(_TenantStatusNames))
|
|
copy(tmp, _TenantStatusNames)
|
|
return tmp
|
|
}
|
|
|
|
// TenantStatusValues returns a list of the values for TenantStatus
|
|
func TenantStatusValues() []TenantStatus {
|
|
return []TenantStatus{
|
|
TenantStatusPendingVerify,
|
|
TenantStatusVerified,
|
|
TenantStatusBanned,
|
|
}
|
|
}
|
|
|
|
// String implements the Stringer interface.
|
|
func (x TenantStatus) 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 TenantStatus) IsValid() bool {
|
|
_, err := ParseTenantStatus(string(x))
|
|
return err == nil
|
|
}
|
|
|
|
var _TenantStatusValue = map[string]TenantStatus{
|
|
"pending_verify": TenantStatusPendingVerify,
|
|
"verified": TenantStatusVerified,
|
|
"banned": TenantStatusBanned,
|
|
}
|
|
|
|
// ParseTenantStatus attempts to convert a string to a TenantStatus.
|
|
func ParseTenantStatus(name string) (TenantStatus, error) {
|
|
if x, ok := _TenantStatusValue[name]; ok {
|
|
return x, nil
|
|
}
|
|
return TenantStatus(""), fmt.Errorf("%s is %w", name, ErrInvalidTenantStatus)
|
|
}
|
|
|
|
var errTenantStatusNilPtr = errors.New("value pointer is nil") // one per type for package clashes
|
|
|
|
// Scan implements the Scanner interface.
|
|
func (x *TenantStatus) Scan(value interface{}) (err error) {
|
|
if value == nil {
|
|
*x = TenantStatus("")
|
|
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 = ParseTenantStatus(v)
|
|
case []byte:
|
|
*x, err = ParseTenantStatus(string(v))
|
|
case TenantStatus:
|
|
*x = v
|
|
case *TenantStatus:
|
|
if v == nil {
|
|
return errTenantStatusNilPtr
|
|
}
|
|
*x = *v
|
|
case *string:
|
|
if v == nil {
|
|
return errTenantStatusNilPtr
|
|
}
|
|
*x, err = ParseTenantStatus(*v)
|
|
default:
|
|
return errors.New("invalid type for TenantStatus")
|
|
}
|
|
|
|
return
|
|
}
|
|
|
|
// Value implements the driver Valuer interface.
|
|
func (x TenantStatus) Value() (driver.Value, error) {
|
|
return x.String(), nil
|
|
}
|
|
|
|
// Set implements the Golang flag.Value interface func.
|
|
func (x *TenantStatus) Set(val string) error {
|
|
v, err := ParseTenantStatus(val)
|
|
*x = v
|
|
return err
|
|
}
|
|
|
|
// Get implements the Golang flag.Getter interface func.
|
|
func (x *TenantStatus) Get() interface{} {
|
|
return *x
|
|
}
|
|
|
|
// Type implements the github.com/spf13/pFlag Value interface.
|
|
func (x *TenantStatus) Type() string {
|
|
return "TenantStatus"
|
|
}
|
|
|
|
type NullTenantStatus struct {
|
|
TenantStatus TenantStatus
|
|
Valid bool
|
|
}
|
|
|
|
func NewNullTenantStatus(val interface{}) (x NullTenantStatus) {
|
|
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 *NullTenantStatus) Scan(value interface{}) (err error) {
|
|
if value == nil {
|
|
x.TenantStatus, x.Valid = TenantStatus(""), false
|
|
return
|
|
}
|
|
|
|
err = x.TenantStatus.Scan(value)
|
|
x.Valid = (err == nil)
|
|
return
|
|
}
|
|
|
|
// Value implements the driver Valuer interface.
|
|
func (x NullTenantStatus) Value() (driver.Value, error) {
|
|
if !x.Valid {
|
|
return nil, nil
|
|
}
|
|
// driver.Value accepts int64 for int values.
|
|
return string(x.TenantStatus), nil
|
|
}
|
|
|
|
type NullTenantStatusStr struct {
|
|
NullTenantStatus
|
|
}
|
|
|
|
func NewNullTenantStatusStr(val interface{}) (x NullTenantStatusStr) {
|
|
x.Scan(val) // yes, we ignore this error, it will just be an invalid value.
|
|
return
|
|
}
|
|
|
|
// Value implements the driver Valuer interface.
|
|
func (x NullTenantStatusStr) Value() (driver.Value, error) {
|
|
if !x.Valid {
|
|
return nil, nil
|
|
}
|
|
return x.TenantStatus.String(), nil
|
|
}
|
|
|
|
const (
|
|
// TenantUserRoleMember is a TenantUserRole of type member.
|
|
TenantUserRoleMember TenantUserRole = "member"
|
|
// TenantUserRoleTenantAdmin is a TenantUserRole of type tenant_admin.
|
|
TenantUserRoleTenantAdmin TenantUserRole = "tenant_admin"
|
|
)
|
|
|
|
var ErrInvalidTenantUserRole = fmt.Errorf("not a valid TenantUserRole, try [%s]", strings.Join(_TenantUserRoleNames, ", "))
|
|
|
|
var _TenantUserRoleNames = []string{
|
|
string(TenantUserRoleMember),
|
|
string(TenantUserRoleTenantAdmin),
|
|
}
|
|
|
|
// TenantUserRoleNames returns a list of possible string values of TenantUserRole.
|
|
func TenantUserRoleNames() []string {
|
|
tmp := make([]string, len(_TenantUserRoleNames))
|
|
copy(tmp, _TenantUserRoleNames)
|
|
return tmp
|
|
}
|
|
|
|
// TenantUserRoleValues returns a list of the values for TenantUserRole
|
|
func TenantUserRoleValues() []TenantUserRole {
|
|
return []TenantUserRole{
|
|
TenantUserRoleMember,
|
|
TenantUserRoleTenantAdmin,
|
|
}
|
|
}
|
|
|
|
// String implements the Stringer interface.
|
|
func (x TenantUserRole) 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 TenantUserRole) IsValid() bool {
|
|
_, err := ParseTenantUserRole(string(x))
|
|
return err == nil
|
|
}
|
|
|
|
var _TenantUserRoleValue = map[string]TenantUserRole{
|
|
"member": TenantUserRoleMember,
|
|
"tenant_admin": TenantUserRoleTenantAdmin,
|
|
}
|
|
|
|
// ParseTenantUserRole attempts to convert a string to a TenantUserRole.
|
|
func ParseTenantUserRole(name string) (TenantUserRole, error) {
|
|
if x, ok := _TenantUserRoleValue[name]; ok {
|
|
return x, nil
|
|
}
|
|
return TenantUserRole(""), fmt.Errorf("%s is %w", name, ErrInvalidTenantUserRole)
|
|
}
|
|
|
|
var errTenantUserRoleNilPtr = errors.New("value pointer is nil") // one per type for package clashes
|
|
|
|
// Scan implements the Scanner interface.
|
|
func (x *TenantUserRole) Scan(value interface{}) (err error) {
|
|
if value == nil {
|
|
*x = TenantUserRole("")
|
|
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 = ParseTenantUserRole(v)
|
|
case []byte:
|
|
*x, err = ParseTenantUserRole(string(v))
|
|
case TenantUserRole:
|
|
*x = v
|
|
case *TenantUserRole:
|
|
if v == nil {
|
|
return errTenantUserRoleNilPtr
|
|
}
|
|
*x = *v
|
|
case *string:
|
|
if v == nil {
|
|
return errTenantUserRoleNilPtr
|
|
}
|
|
*x, err = ParseTenantUserRole(*v)
|
|
default:
|
|
return errors.New("invalid type for TenantUserRole")
|
|
}
|
|
|
|
return
|
|
}
|
|
|
|
// Value implements the driver Valuer interface.
|
|
func (x TenantUserRole) Value() (driver.Value, error) {
|
|
return x.String(), nil
|
|
}
|
|
|
|
// Set implements the Golang flag.Value interface func.
|
|
func (x *TenantUserRole) Set(val string) error {
|
|
v, err := ParseTenantUserRole(val)
|
|
*x = v
|
|
return err
|
|
}
|
|
|
|
// Get implements the Golang flag.Getter interface func.
|
|
func (x *TenantUserRole) Get() interface{} {
|
|
return *x
|
|
}
|
|
|
|
// Type implements the github.com/spf13/pFlag Value interface.
|
|
func (x *TenantUserRole) Type() string {
|
|
return "TenantUserRole"
|
|
}
|
|
|
|
type NullTenantUserRole struct {
|
|
TenantUserRole TenantUserRole
|
|
Valid bool
|
|
}
|
|
|
|
func NewNullTenantUserRole(val interface{}) (x NullTenantUserRole) {
|
|
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 *NullTenantUserRole) Scan(value interface{}) (err error) {
|
|
if value == nil {
|
|
x.TenantUserRole, x.Valid = TenantUserRole(""), false
|
|
return
|
|
}
|
|
|
|
err = x.TenantUserRole.Scan(value)
|
|
x.Valid = (err == nil)
|
|
return
|
|
}
|
|
|
|
// Value implements the driver Valuer interface.
|
|
func (x NullTenantUserRole) Value() (driver.Value, error) {
|
|
if !x.Valid {
|
|
return nil, nil
|
|
}
|
|
// driver.Value accepts int64 for int values.
|
|
return string(x.TenantUserRole), nil
|
|
}
|
|
|
|
type NullTenantUserRoleStr struct {
|
|
NullTenantUserRole
|
|
}
|
|
|
|
func NewNullTenantUserRoleStr(val interface{}) (x NullTenantUserRoleStr) {
|
|
x.Scan(val) // yes, we ignore this error, it will just be an invalid value.
|
|
return
|
|
}
|
|
|
|
// Value implements the driver Valuer interface.
|
|
func (x NullTenantUserRoleStr) Value() (driver.Value, error) {
|
|
if !x.Valid {
|
|
return nil, nil
|
|
}
|
|
return x.TenantUserRole.String(), nil
|
|
}
|
|
|
|
const (
|
|
// UserStatusPendingVerify is a UserStatus of type pending_verify.
|
|
UserStatusPendingVerify UserStatus = "pending_verify"
|
|
// UserStatusVerified is a UserStatus of type verified.
|
|
UserStatusVerified UserStatus = "verified"
|
|
// UserStatusBanned is a UserStatus of type banned.
|
|
UserStatusBanned UserStatus = "banned"
|
|
)
|
|
|
|
var ErrInvalidUserStatus = fmt.Errorf("not a valid UserStatus, try [%s]", strings.Join(_UserStatusNames, ", "))
|
|
|
|
var _UserStatusNames = []string{
|
|
string(UserStatusPendingVerify),
|
|
string(UserStatusVerified),
|
|
string(UserStatusBanned),
|
|
}
|
|
|
|
// UserStatusNames returns a list of possible string values of UserStatus.
|
|
func UserStatusNames() []string {
|
|
tmp := make([]string, len(_UserStatusNames))
|
|
copy(tmp, _UserStatusNames)
|
|
return tmp
|
|
}
|
|
|
|
// UserStatusValues returns a list of the values for UserStatus
|
|
func UserStatusValues() []UserStatus {
|
|
return []UserStatus{
|
|
UserStatusPendingVerify,
|
|
UserStatusVerified,
|
|
UserStatusBanned,
|
|
}
|
|
}
|
|
|
|
// String implements the Stringer interface.
|
|
func (x UserStatus) 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 UserStatus) IsValid() bool {
|
|
_, err := ParseUserStatus(string(x))
|
|
return err == nil
|
|
}
|
|
|
|
var _UserStatusValue = map[string]UserStatus{
|
|
"pending_verify": UserStatusPendingVerify,
|
|
"verified": UserStatusVerified,
|
|
"banned": UserStatusBanned,
|
|
}
|
|
|
|
// ParseUserStatus attempts to convert a string to a UserStatus.
|
|
func ParseUserStatus(name string) (UserStatus, error) {
|
|
if x, ok := _UserStatusValue[name]; ok {
|
|
return x, nil
|
|
}
|
|
return UserStatus(""), fmt.Errorf("%s is %w", name, ErrInvalidUserStatus)
|
|
}
|
|
|
|
var errUserStatusNilPtr = errors.New("value pointer is nil") // one per type for package clashes
|
|
|
|
// Scan implements the Scanner interface.
|
|
func (x *UserStatus) Scan(value interface{}) (err error) {
|
|
if value == nil {
|
|
*x = UserStatus("")
|
|
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 = ParseUserStatus(v)
|
|
case []byte:
|
|
*x, err = ParseUserStatus(string(v))
|
|
case UserStatus:
|
|
*x = v
|
|
case *UserStatus:
|
|
if v == nil {
|
|
return errUserStatusNilPtr
|
|
}
|
|
*x = *v
|
|
case *string:
|
|
if v == nil {
|
|
return errUserStatusNilPtr
|
|
}
|
|
*x, err = ParseUserStatus(*v)
|
|
default:
|
|
return errors.New("invalid type for UserStatus")
|
|
}
|
|
|
|
return
|
|
}
|
|
|
|
// Value implements the driver Valuer interface.
|
|
func (x UserStatus) Value() (driver.Value, error) {
|
|
return x.String(), nil
|
|
}
|
|
|
|
// Set implements the Golang flag.Value interface func.
|
|
func (x *UserStatus) Set(val string) error {
|
|
v, err := ParseUserStatus(val)
|
|
*x = v
|
|
return err
|
|
}
|
|
|
|
// Get implements the Golang flag.Getter interface func.
|
|
func (x *UserStatus) Get() interface{} {
|
|
return *x
|
|
}
|
|
|
|
// Type implements the github.com/spf13/pFlag Value interface.
|
|
func (x *UserStatus) Type() string {
|
|
return "UserStatus"
|
|
}
|
|
|
|
type NullUserStatus struct {
|
|
UserStatus UserStatus
|
|
Valid bool
|
|
}
|
|
|
|
func NewNullUserStatus(val interface{}) (x NullUserStatus) {
|
|
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 *NullUserStatus) Scan(value interface{}) (err error) {
|
|
if value == nil {
|
|
x.UserStatus, x.Valid = UserStatus(""), false
|
|
return
|
|
}
|
|
|
|
err = x.UserStatus.Scan(value)
|
|
x.Valid = (err == nil)
|
|
return
|
|
}
|
|
|
|
// Value implements the driver Valuer interface.
|
|
func (x NullUserStatus) Value() (driver.Value, error) {
|
|
if !x.Valid {
|
|
return nil, nil
|
|
}
|
|
// driver.Value accepts int64 for int values.
|
|
return string(x.UserStatus), nil
|
|
}
|
|
|
|
type NullUserStatusStr struct {
|
|
NullUserStatus
|
|
}
|
|
|
|
func NewNullUserStatusStr(val interface{}) (x NullUserStatusStr) {
|
|
x.Scan(val) // yes, we ignore this error, it will just be an invalid value.
|
|
return
|
|
}
|
|
|
|
// Value implements the driver Valuer interface.
|
|
func (x NullUserStatusStr) Value() (driver.Value, error) {
|
|
if !x.Valid {
|
|
return nil, nil
|
|
}
|
|
return x.UserStatus.String(), nil
|
|
}
|