enum

package
v0.9.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 26, 2021 License: MIT Imports: 5 Imported by: 15

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrIncompatible = errors.New("incompatible type to scan")
)

Enum errors

Functions

This section is empty.

Types

type AccountKind added in v0.5.0

type AccountKind int

AccountKind is an enumeration of login method.

const (
	AccountKindNull AccountKind = iota
	AccountKindFtc
	AccountKindWx
	AccountKindLinked
)

Allowed values for AccountKind

func ParseAccountKind added in v0.5.0

func ParseAccountKind(name string) (AccountKind, error)

func (AccountKind) MarshalJSON added in v0.5.0

func (x AccountKind) MarshalJSON() ([]byte, error)

MarshalJSON implements the Marshaler interface

func (AccountKind) String added in v0.5.0

func (x AccountKind) String() string

func (*AccountKind) UnmarshalJSON added in v0.5.0

func (x *AccountKind) UnmarshalJSON(b []byte) error

type Cycle

type Cycle int

Cycle is an enum for billing cycles.

const (
	CycleNull Cycle = iota
	CycleMonth
	CycleYear
)

Supported billing cycles

func ParseCycle

func ParseCycle(name string) (Cycle, error)

ParseCycle parses a string into Cycle type.

func (Cycle) MarshalJSON

func (c Cycle) MarshalJSON() ([]byte, error)

MarshalJSON implements the Marshaler interface

func (*Cycle) Scan

func (c *Cycle) Scan(src interface{}) error

Scan implements sql.Scanner interface to retrieve value from SQL. SQL null will be turned into zero value CycleInvalid

func (Cycle) String

func (c Cycle) String() string

func (Cycle) StringCN

func (c Cycle) StringCN() string

StringCN output cycle as Chinese text

func (Cycle) StringEN

func (c Cycle) StringEN() string

StringEN output cycle as English text

func (Cycle) TimeAfterACycle

func (c Cycle) TimeAfterACycle(t time.Time) (time.Time, error)

TimeAfterACycle adds one cycle to a time instance and returns the new time.

func (*Cycle) UnmarshalJSON

func (c *Cycle) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the Unmarshaler interface.

func (Cycle) Value

func (c Cycle) Value() (driver.Value, error)

Value implements driver.Valuer interface to save value into SQL.

type Environment added in v0.2.0

type Environment int
const (
	EnvNull Environment = iota
	EnvProduction
	EnvSandbox
)

func ParseEnvironment added in v0.2.0

func ParseEnvironment(name string) (Environment, error)

func (Environment) MarshalJSON added in v0.2.0

func (x Environment) MarshalJSON() ([]byte, error)

func (*Environment) Scan added in v0.2.0

func (x *Environment) Scan(src interface{}) error

func (Environment) String added in v0.2.0

func (x Environment) String() string

func (*Environment) UnmarshalJSON added in v0.2.0

func (x *Environment) UnmarshalJSON(b []byte) error

func (Environment) Value added in v0.2.0

func (x Environment) Value() (driver.Value, error)

type Gender

type Gender int

Gender is an enum for gender.

const (
	GenderNull Gender = iota
	GenderFemale
	GenderMale
)

Gender values.

func ParseGender

func ParseGender(name string) (Gender, error)

ParseGender parsed a string into Gender type.

func (Gender) MarshalJSON

func (g Gender) MarshalJSON() ([]byte, error)

MarshalJSON implements the Marshaler interface

func (*Gender) Scan

func (g *Gender) Scan(src interface{}) error

Scan implements sql.Scanner interface to retrieve enum value from SQL.

func (Gender) String

func (g Gender) String() string

func (*Gender) UnmarshalJSON

func (g *Gender) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the Unmarshaler interface.

func (Gender) Value

func (g Gender) Value() (driver.Value, error)

Value implements driver.Valuer interface to save value into SQL.

type LoginMethod

type LoginMethod int

LoginMethod is an enumeration of login method.

const (
	LoginMethodNull LoginMethod = iota
	LoginMethodEmail
	LoginMethodWx
	LoginMethodMobile
)

Allowed values for LoginMethod

func ParseLoginMethod

func ParseLoginMethod(name string) (LoginMethod, error)

ParseLoginMethod creates a new LoginMethod from a string: email or wechat.

func (LoginMethod) MarshalJSON added in v0.0.10

func (x LoginMethod) MarshalJSON() ([]byte, error)

MarshalJSON implements the Marshaler interface

func (*LoginMethod) Scan

func (x *LoginMethod) Scan(value interface{}) error

Scan implements the Scanner interface

func (LoginMethod) String

func (x LoginMethod) String() string

func (*LoginMethod) UnmarshalJSON added in v0.0.10

func (x *LoginMethod) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the Unmarshaler interface.

func (LoginMethod) Value

func (x LoginMethod) Value() (driver.Value, error)

Value implements the Valuer interface.

type OrderKind added in v0.4.1

type OrderKind int

OrderKind describes what kind of subscription order a user is purchasing.

const (
	OrderKindNull OrderKind = iota
	OrderKindCreate
	OrderKindRenew
	OrderKindUpgrade
	OrderKindDowngrade
	OrderKindAddOn
)

func ParseOrderKind added in v0.4.1

func ParseOrderKind(name string) (OrderKind, error)

ParseOrderKind creates OrderKind from a string.

func (OrderKind) MarshalJSON added in v0.4.1

func (x OrderKind) MarshalJSON() ([]byte, error)

func (*OrderKind) Scan added in v0.4.1

func (x *OrderKind) Scan(src interface{}) error

func (OrderKind) String added in v0.4.1

func (x OrderKind) String() string

func (OrderKind) StringSC added in v0.4.1

func (x OrderKind) StringSC() string

func (*OrderKind) UnmarshalJSON added in v0.4.1

func (x *OrderKind) UnmarshalJSON(b []byte) error

func (OrderKind) Value added in v0.4.1

func (x OrderKind) Value() (driver.Value, error)

type PayMethod

type PayMethod int

PayMethod is an enum for payment methods

const (
	PayMethodNull PayMethod = iota
	PayMethodAli
	PayMethodWx
	PayMethodStripe
	PayMethodApple
	PayMethodB2B
)

Supported payment methods

func ParsePayMethod

func ParsePayMethod(name string) (PayMethod, error)

ParsePayMethod parses a string into a PayMethod value.

func (PayMethod) MarshalJSON

func (x PayMethod) MarshalJSON() ([]byte, error)

MarshalJSON implements the Marshaler interface

func (*PayMethod) Scan

func (x *PayMethod) Scan(src interface{}) error

Scan implements sql.Scanner interface to retrieve value from SQL. SQL null will be turned into zero value InvalidPay.

func (PayMethod) String

func (x PayMethod) String() string

func (PayMethod) StringCN

func (x PayMethod) StringCN() string

StringCN output cycle as Chinese text

func (PayMethod) StringEN

func (x PayMethod) StringEN() string

StringEN output cycle as English text

func (*PayMethod) UnmarshalJSON

func (x *PayMethod) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the Unmarshaler interface.

func (PayMethod) Value

func (x PayMethod) Value() (driver.Value, error)

Value implements driver.Valuer interface to save value into SQL.

type Platform

type Platform int

Platform is used to record on which platform user is visiting the API.

const (
	PlatformNull Platform = iota
	PlatformWeb
	PlatformIOS
	PlatformAndroid
)

Allowed values for ClientPlatforms

func ParsePlatform

func ParsePlatform(name string) (Platform, error)

ParsePlatform parses a string into a Platform value.

func (Platform) MarshalJSON added in v0.0.10

func (x Platform) MarshalJSON() ([]byte, error)

MarshalJSON implements the Marshaler interface

func (*Platform) Scan

func (x *Platform) Scan(src interface{}) error

Scan implements sql.Scanner interface to retrieve value from SQL. SQL null will be turned into InvalidPlatform.

func (Platform) String

func (x Platform) String() string

func (*Platform) UnmarshalJSON added in v0.0.10

func (x *Platform) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the Unmarshaler interface.

func (Platform) Value

func (x Platform) Value() (driver.Value, error)

Value saves ClientPlatform to SQL ENUM.

type SnapshotReason added in v0.2.1

type SnapshotReason int

SnapshotReason tells why we take a snapshot of reader's membership Deprecated

const (
	SnapshotReasonNull        SnapshotReason = iota // Unknow reason.
	SnapshotReasonRenew                             // Backup before renewal
	SnapshotReasonUpgrade                           // Backup before upgrading.
	SnapshotReasonDelete                            // Backup before deletion.
	SnapshotReasonLink                              // Link FTC account to wechat account.
	SnapshotReasonUnlink                            // Unlink FTC account from wechat accout.
	SnapshotReasonAppleLink                         // Link FTC account to Apple IAP.
	SnapshotReasonAppleUnlink                       // Unlink FTC account from Apple IAP.
	SnapshotReasonB2B
	SnapshotReasonManual
	SnapshotReasonIapUpdate
)

Enum of SnapshotReason.

func ParseSnapshotReason added in v0.2.1

func ParseSnapshotReason(name string) (SnapshotReason, error)

ParseSnapshotReason turns a string to an instance of SnapshotReason

func (SnapshotReason) MarshalJSON added in v0.2.1

func (x SnapshotReason) MarshalJSON() ([]byte, error)

func (*SnapshotReason) Scan added in v0.2.1

func (x *SnapshotReason) Scan(src interface{}) error

func (SnapshotReason) String added in v0.2.1

func (x SnapshotReason) String() string

func (*SnapshotReason) UnmarshalJSON added in v0.2.1

func (x *SnapshotReason) UnmarshalJSON(b []byte) error

func (SnapshotReason) Value added in v0.2.1

func (x SnapshotReason) Value() (driver.Value, error)

type SubsSource added in v0.4.2

type SubsSource int
const (
	SubsSourceNull SubsSource = iota
	SubsSourceRetail
	SubsSourceB2B
)

func ParseSubsSource added in v0.4.2

func ParseSubsSource(name string) (SubsSource, error)

ParseOrderKind creates OrderKind from a string.

func (SubsSource) MarshalJSON added in v0.4.2

func (x SubsSource) MarshalJSON() ([]byte, error)

func (*SubsSource) Scan added in v0.4.2

func (x *SubsSource) Scan(src interface{}) error

func (SubsSource) String added in v0.4.2

func (x SubsSource) String() string

func (*SubsSource) UnmarshalJSON added in v0.4.2

func (x *SubsSource) UnmarshalJSON(b []byte) error

func (SubsSource) Value added in v0.4.2

func (x SubsSource) Value() (driver.Value, error)

type SubsStatus added in v0.4.3

type SubsStatus int
const (
	SubsStatusNull SubsStatus = iota // Invalid
	SubsStatusActive
	SubsStatusCanceled // Invalid
	SubsStatusIncomplete
	SubsStatusIncompleteExpired // Invalid
	SubsStatusPastDue           // INvalid
	SubsStatusTrialing
	SubsStatusUnpaid // Invalid
)

func ParseSubsStatus added in v0.4.3

func ParseSubsStatus(name string) (SubsStatus, error)

ParseSubsStatus turns a string to SubsStatus.

func (SubsStatus) IsValid added in v0.5.2

func (x SubsStatus) IsValid() bool

IsValid check if subscription status is in a valid state.

func (SubsStatus) MarshalJSON added in v0.4.3

func (x SubsStatus) MarshalJSON() ([]byte, error)

func (*SubsStatus) Scan added in v0.4.3

func (x *SubsStatus) Scan(src interface{}) error

func (SubsStatus) ShouldCreate added in v0.4.3

func (x SubsStatus) ShouldCreate() bool

ShouldCreate checks whether membership's current status should allow creation of a new membership. Deprecated

func (SubsStatus) String added in v0.4.3

func (x SubsStatus) String() string

func (*SubsStatus) UnmarshalJSON added in v0.4.3

func (x *SubsStatus) UnmarshalJSON(b []byte) error

func (SubsStatus) Value added in v0.4.3

func (x SubsStatus) Value() (driver.Value, error)

type Tier

type Tier int

Tier is an enum for membership tiers.

const (
	TierNull Tier = iota
	TierStandard
	TierPremium
	TierVIP
)

Values of MemberTier

func ParseTier

func ParseTier(name string) (Tier, error)

ParseTier parses a string into Tier type.

func (Tier) MarshalJSON

func (x Tier) MarshalJSON() ([]byte, error)

MarshalJSON implements the Marshaler interface

func (*Tier) Scan

func (x *Tier) Scan(src interface{}) error

Scan implements sql.Scanner interface to retrieve value from SQL. SQL null will be turned into zero value TierFree.

func (Tier) String

func (x Tier) String() string

func (Tier) StringCN

func (x Tier) StringCN() string

StringCN output tier as Chinese text

func (Tier) StringEN

func (x Tier) StringEN() string

StringEN output tier as English text

func (*Tier) UnmarshalJSON

func (x *Tier) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the Unmarshaler interface.

func (Tier) Value

func (x Tier) Value() (driver.Value, error)

Value implements driver.Valuer interface to save value into SQL.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL