Documentation
¶
Index ¶
Constants ¶
const COLUMN_CANCEL_AT_PERIOD_END = "cancel_at_period_end"
const COLUMN_CREATED_AT = "created_at"
const COLUMN_CURRENCY = "currency"
const COLUMN_DESCRIPTION = "description"
const COLUMN_FEATURES = "features"
const COLUMN_ID = "id"
const COLUMN_INTERVAL = "interval"
const COLUMN_MEMO = "memo"
const COLUMN_METAS = "metas"
const COLUMN_PAYMENT_METHOD_ID = "payment_method_id"
const COLUMN_PERIOD_END = "period_end"
const COLUMN_PERIOD_START = "period_start"
const COLUMN_PLAN_ID = "plan_id"
const COLUMN_PRICE = "price"
const COLUMN_SOFT_DELETED_AT = "soft_deleted_at"
const COLUMN_STATUS = "status"
const COLUMN_STRIPE_PRICE_ID = "stripe_price_id"
const COLUMN_SUBSCRIBER_ID = "subscriber_id"
const COLUMN_TITLE = "title"
const COLUMN_TYPE = "type"
const COLUMN_UPDATED_AT = "updated_at"
const CURRENCY_EUR = "EUR"
const CURRENCY_GBP = "GBP"
const CURRENCY_USD = "USD"
const MAX_DATETIME = "9999-12-31 23:59:59"
const NO = "no"
const PLAN_INTERVAL_DAILY = "daily"
const PLAN_INTERVAL_MONTHLY = "monthly"
const PLAN_INTERVAL_NONE = "none"
const PLAN_INTERVAL_QUARTERLY = "quarterly"
const PLAN_INTERVAL_WEEKLY = "weekly"
const PLAN_INTERVAL_YEARLY = "yearly"
const PLAN_STATUS_ACTIVE = "active"
const PLAN_STATUS_INACTIVE = "inactive"
const PLAN_TYPE_BRONZE = "bronze"
const PLAN_TYPE_GOLD = "gold"
const PLAN_TYPE_PLATINUM = "platinum"
const PLAN_TYPE_SILVER = "silver"
const PLAN_TYPE_TRIAL = "trial"
const SUBSCRIPTION_STATUS_ACTIVE = "active"
const SUBSCRIPTION_STATUS_CANCELLED = "cancelled"
const SUBSCRIPTION_STATUS_INACTIVE = "inactive"
const YES = "yes"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NewStoreOptions ¶
type NewStoreOptions struct {
PlanTableName string
SubscriptionTableName string
DB *sql.DB
AutomigrateEnabled bool
DebugEnabled bool
}
NewStoreOptions define the options for creating a new subscription store
type PlanInterface ¶
type PlanInterface interface {
IsSoftDeleted() bool
GetCreatedAt() string
GetCreatedAtCarbon() *carbon.Carbon
SetCreatedAt(createdAt string) PlanInterface
GetCurrency() string
SetCurrency(currency string) PlanInterface
GetDescription() string
SetDescription(description string) PlanInterface
GetFeatures() string
SetFeatures(features string) PlanInterface
GetID() string
SetID(id string) PlanInterface
GetInterval() string
SetInterval(interval string) PlanInterface
GetMemo() string
SetMemo(memo string) PlanInterface
GetMetas() (map[string]string, error)
SetMetas(data map[string]string) (PlanInterface, error)
HasMeta(key string) (bool, error)
Meta(key string) (string, error)
SetMeta(key string, value string) (PlanInterface, error)
DeleteMeta(key string) (PlanInterface, error)
GetPrice() string
GetPriceFloat() float64
SetPrice(price string) PlanInterface
GetSoftDeletedAt() string
GetSoftDeletedAtCarbon() *carbon.Carbon
SetSoftDeletedAt(deletedAt string) PlanInterface
GetStatus() string
SetStatus(status string) PlanInterface
GetStripePriceID() string
SetStripePriceID(stripePriceID string) PlanInterface
GetTitle() string
SetTitle(title string) PlanInterface
GetType() string
SetType(type_ string) PlanInterface
GetUpdatedAt() string
GetUpdatedAtCarbon() *carbon.Carbon
SetUpdatedAt(updatedAt string) PlanInterface
}
PlanInterface defines the methods for a Plan entity
func NewPlan ¶
func NewPlan() PlanInterface
func NewPlanFromExistingData ¶
func NewPlanFromExistingData(data map[string]string) PlanInterface
type PlanQueryInterface ¶
type PlanQueryInterface interface {
Validate() error
IsCountOnly() bool
HasCountOnly() bool
SetCountOnly(countOnly bool) PlanQueryInterface
HasID() bool
ID() string
SetID(id string) PlanQueryInterface
HasIDIn() bool
IDIn() []string
SetIDIn(idIn []string) PlanQueryInterface
HasStatus() bool
Status() string
SetStatus(status string) PlanQueryInterface
HasStatusIn() bool
StatusIn() []string
SetStatusIn(statusIn []string) PlanQueryInterface
HasInterval() bool
Interval() string
SetInterval(interval string) PlanQueryInterface
HasIntervalIn() bool
IntervalIn() []string
SetIntervalIn(intervalIn []string) PlanQueryInterface
HasType() bool
Type() string
SetType(type_ string) PlanQueryInterface
HasOffset() bool
Offset() int
SetOffset(offset int) PlanQueryInterface
HasLimit() bool
Limit() int
SetLimit(limit int) PlanQueryInterface
HasOrderBy() bool
OrderBy() string
SetOrderBy(orderBy string) PlanQueryInterface
HasSortOrder() bool
SortOrder() string
SetSortOrder(sortOrder string) PlanQueryInterface
HasSoftDeletedIncluded() bool
SoftDeletedIncluded() bool
SetSoftDeletedIncluded(withSoftDeleted bool) PlanQueryInterface
}
PlanQueryInterface defines the interface for querying plans.
type StoreInterface ¶
type StoreInterface interface {
MigrateDown(ctx context.Context, tx ...*sql.Tx) error
MigrateUp(ctx context.Context, tx ...*sql.Tx) error
EnableDebug(debug bool)
PlanCount(ctx context.Context, query PlanQueryInterface) (int64, error)
PlanCreate(ctx context.Context, plan PlanInterface) error
PlanDelete(ctx context.Context, plan PlanInterface) error
PlanDeleteByID(ctx context.Context, id string) error
PlanExists(ctx context.Context, planID string) (bool, error)
PlanFindByID(ctx context.Context, id string) (PlanInterface, error)
PlanList(ctx context.Context, query PlanQueryInterface) ([]PlanInterface, error)
PlanSoftDelete(ctx context.Context, plan PlanInterface) error
PlanSoftDeleteByID(ctx context.Context, id string) error
PlanTableName() string
PlanUpdate(ctx context.Context, plan PlanInterface) error
SubscriptionCount(ctx context.Context, query SubscriptionQueryInterface) (int64, error)
SubscriptionCreate(ctx context.Context, subscription SubscriptionInterface) error
SubscriptionDelete(ctx context.Context, subscription SubscriptionInterface) error
SubscriptionDeleteByID(ctx context.Context, id string) error
SubscriptionExists(ctx context.Context, subscriptionID string) (bool, error)
SubscriptionFindByID(ctx context.Context, id string) (SubscriptionInterface, error)
SubscriptionList(ctx context.Context, query SubscriptionQueryInterface) ([]SubscriptionInterface, error)
SubscriptionSoftDelete(ctx context.Context, subscription SubscriptionInterface) error
SubscriptionSoftDeleteByID(ctx context.Context, id string) error
SubscriptionTableName() string
SubscriptionUpdate(ctx context.Context, subscription SubscriptionInterface) error
}
StoreInterface defines the interface for the subscription store.
func NewStore ¶
func NewStore(opts NewStoreOptions) (StoreInterface, error)
NewStore creates a new subscription store
type SubscriptionInterface ¶
type SubscriptionInterface interface {
IsSoftDeleted() bool
GetCreatedAt() string
GetCreatedAtCarbon() *carbon.Carbon
SetCreatedAt(createdAt string) SubscriptionInterface
GetID() string
SetID(id string) SubscriptionInterface
GetStatus() string
SetStatus(status string) SubscriptionInterface
GetSubscriberID() string
SetSubscriberID(subscriberID string) SubscriptionInterface
GetPlanID() string
SetPlanID(planID string) SubscriptionInterface
GetPeriodStart() string
GetPeriodStartCarbon() *carbon.Carbon
SetPeriodStart(periodStart string) SubscriptionInterface
GetPeriodEnd() string
GetPeriodEndCarbon() *carbon.Carbon
SetPeriodEnd(periodEnd string) SubscriptionInterface
GetCancelAtPeriodEnd() bool
SetCancelAtPeriodEnd(cancelAtPeriodEnd bool) SubscriptionInterface
GetPaymentMethodID() string
SetPaymentMethodID(paymentMethodID string) SubscriptionInterface
GetMemo() string
SetMemo(memo string) SubscriptionInterface
GetMetas() (map[string]string, error)
SetMetas(data map[string]string) (SubscriptionInterface, error)
HasMeta(key string) (bool, error)
Meta(key string) (string, error)
SetMeta(key string, value string) (SubscriptionInterface, error)
DeleteMeta(key string) (SubscriptionInterface, error)
GetSoftDeletedAt() string
GetSoftDeletedAtCarbon() *carbon.Carbon
SetSoftDeletedAt(deletedAt string) SubscriptionInterface
GetUpdatedAt() string
GetUpdatedAtCarbon() *carbon.Carbon
SetUpdatedAt(updatedAt string) SubscriptionInterface
}
SubscriptionInterface defines the methods for a Subscription entity
func NewSubscription ¶
func NewSubscription() SubscriptionInterface
func NewSubscriptionFromExistingData ¶
func NewSubscriptionFromExistingData(data map[string]string) SubscriptionInterface
type SubscriptionQueryInterface ¶
type SubscriptionQueryInterface interface {
Validate() error
IsCountOnly() bool
HasCountOnly() bool
SetCountOnly(countOnly bool) SubscriptionQueryInterface
HasID() bool
ID() string
SetID(id string) SubscriptionQueryInterface
HasIDIn() bool
IDIn() []string
SetIDIn(idIn []string) SubscriptionQueryInterface
HasStatus() bool
Status() string
SetStatus(status string) SubscriptionQueryInterface
HasStatusIn() bool
StatusIn() []string
SetStatusIn(statusIn []string) SubscriptionQueryInterface
HasSubscriberID() bool
SubscriberID() string
SetSubscriberID(subscriberID string) SubscriptionQueryInterface
HasPlanID() bool
PlanID() string
SetPlanID(planID string) SubscriptionQueryInterface
HasOffset() bool
Offset() int
SetOffset(offset int) SubscriptionQueryInterface
HasLimit() bool
Limit() int
SetLimit(limit int) SubscriptionQueryInterface
HasOrderBy() bool
OrderBy() string
SetOrderBy(orderBy string) SubscriptionQueryInterface
HasSortOrder() bool
SortOrder() string
SetSortOrder(sortOrder string) SubscriptionQueryInterface
HasSoftDeletedIncluded() bool
SoftDeletedIncluded() bool
SetSoftDeletedIncluded(withSoftDeleted bool) SubscriptionQueryInterface
}
SubscriptionQueryInterface defines the interface for querying subscriptions.
func NewSubscriptionQuery ¶
func NewSubscriptionQuery() SubscriptionQueryInterface
NewSubscriptionQuery creates a new subscription query
func SubscriptionQuery ¶
func SubscriptionQuery() SubscriptionQueryInterface
SubscriptionQuery is a shortcut alias for NewSubscriptionQuery