enum

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2019 License: MIT Imports: 5 Imported by: 19

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 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 PayMethod

type PayMethod int

PayMethod is an enum for payment methods

const (
	PayMethodNull PayMethod = iota
	PayMethodAli
	PayMethodWx
	PayMethodStripe
	PayMethodApple
)

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

const (
	SnapshotReasonNull SnapshotReason = iota
	SnapshotReasonRenew
	SnapshotReasonUpgrade
	SnapshotReasonDelete
	SnapshotReasonLink
	SnapshotReasonUnlink
	SnapshotReasonAppleIAP
)

func ParseSnapshotReason added in v0.2.1

func ParseSnapshotReason(name string) (SnapshotReason, error)

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 Tier

type Tier int

Tier is an enum for membership tiers.

const (
	TierNull Tier = iota
	TierStandard
	TierPremium
)

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
JackTT - Gopher 🇻🇳