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 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
DbDriverName string
AutomigrateEnabled bool
DebugEnabled bool
SqlLogger *slog.Logger
}
NewStoreOptions define the options for creating a new block store
type PlanInterface ¶
type PlanInterface interface {
Data() map[string]string
DataChanged() map[string]string
MarkAsNotDirty()
CreatedAt() string
SetCreatedAt(createdAt string) PlanInterface
CreatedAtCarbon() *carbon.Carbon
Currency() string
SetCurrency(currency string) PlanInterface
SoftDeletedAt() string
SetSoftDeletedAt(softDeletedAt string) PlanInterface
SoftDeletedAtCarbon() *carbon.Carbon
Description() string
SetDescription(description string) PlanInterface
ID() string
SetID(id string) PlanInterface
Features() string
SetFeatures(features string) PlanInterface
Interval() string
SetInterval(interval string) PlanInterface
Memo() string
SetMemo(memo string) PlanInterface
Metas() (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)
Price() string
PriceFloat() float64
SetPrice(price string) PlanInterface
Status() string
SetStatus(status string) PlanInterface
Title() string
SetTitle(title string) PlanInterface
Type() string
SetType(type_ string) PlanInterface
StripePriceID() string
SetStripePriceID(stripePriceID string) PlanInterface
UpdatedAt() string
SetUpdatedAt(updatedAt string) PlanInterface
UpdatedAtCarbon() *carbon.Carbon
}
PlanInterface defines the methods for a Plan entity This interface can be implemented by any Plan struct for flexibility and testability.
func NewPlan ¶
func NewPlan() PlanInterface
func NewPlanFromExistingData ¶
func NewPlanFromExistingData(data map[string]string) PlanInterface
type PlanQueryInterface ¶
type PlanQueryInterface interface {
ToQuery(store StoreInterface) *goqu.SelectDataset
ID() string
HasID() bool
SetID(id string) PlanQueryInterface
IDIn() []string
HasIDIn() bool
SetIDIn(idIn []string) PlanQueryInterface
Status() string
HasStatus() bool
SetStatus(status string) PlanQueryInterface
StatusIn() []string
HasStatusIn() bool
SetStatusIn(statusIn []string) PlanQueryInterface
Interval() string
HasInterval() bool
SetInterval(interval string) PlanQueryInterface
IntervalIn() []string
HasIntervalIn() bool
SetIntervalIn(intervalIn []string) PlanQueryInterface
Type() string
HasType() bool
SetType(type_ string) PlanQueryInterface
Offset() int
HasOffset() bool
SetOffset(offset int) PlanQueryInterface
Limit() int
HasLimit() bool
SetLimit(limit int) PlanQueryInterface
OrderBy() string
HasOrderBy() bool
SetOrderBy(orderBy string) PlanQueryInterface
OrderDirection() string
HasOrderDirection() bool
SetOrderDirection(orderByDirection string) PlanQueryInterface
CountOnly() bool
HasCountOnly() bool
SetCountOnly(countOnly bool) PlanQueryInterface
WithDeleted() bool
HasWithDeleted() bool
SetWithDeleted(withDeleted bool) PlanQueryInterface
}
PlanQueryInterface defines the methods for querying plans using PlanQueryOptions.
func NewPlanQuery ¶
func NewPlanQuery() PlanQueryInterface
type StoreInterface ¶
type StoreInterface interface {
AutoMigrate(ctx context.Context) error
EnableDebug(debug bool)
DatabaseDriverName() string
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 methods for the Subscription store This interface allows for easier testing and separation of concerns between the store implementation and its consumers.
func NewStore ¶
func NewStore(opts NewStoreOptions) (StoreInterface, error)
NewStore creates a new block store
type SubscriptionInterface ¶
type SubscriptionInterface interface {
Data() map[string]string
DataChanged() map[string]string
MarkAsNotDirty()
CreatedAt() string
SetCreatedAt(createdAt string) SubscriptionInterface
CreatedAtCarbon() *carbon.Carbon
ID() string
SetID(id string) SubscriptionInterface
Status() string
SetStatus(status string) SubscriptionInterface
SubscriberID() string
SetSubscriberID(subscriberID string) SubscriptionInterface
PlanID() string
SetPlanID(planID string) SubscriptionInterface
PeriodStart() string
SetPeriodStart(periodStart string) SubscriptionInterface
PeriodEnd() string
SetPeriodEnd(periodEnd string) SubscriptionInterface
CancelAtPeriodEnd() bool
SetCancelAtPeriodEnd(cancelAtPeriodEnd bool) SubscriptionInterface
PaymentMethodID() string
SetPaymentMethodID(paymentMethodID string) SubscriptionInterface
Memo() string
SetMemo(memo string) SubscriptionInterface
Metas() (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)
SoftDeletedAt() string
SetSoftDeletedAt(softDeletedAt string) SubscriptionInterface
SoftDeletedAtCarbon() *carbon.Carbon
UpdatedAt() string
SetUpdatedAt(updatedAt string) SubscriptionInterface
UpdatedAtCarbon() *carbon.Carbon
}
SubscriptionInterface defines the methods for a Subscription entity This interface can be implemented by any Subscription struct for flexibility and testability.
func NewSubscription ¶
func NewSubscription() SubscriptionInterface
func NewSubscriptionFromExistingData ¶
func NewSubscriptionFromExistingData(data map[string]string) SubscriptionInterface
type SubscriptionQueryInterface ¶
type SubscriptionQueryInterface interface {
ToQuery(store StoreInterface) *goqu.SelectDataset
ID() string
HasID() bool
SetID(id string) SubscriptionQueryInterface
IDIn() []string
HasIDIn() bool
SetIDIn(idIn []string) SubscriptionQueryInterface
Status() string
HasStatus() bool
SetStatus(status string) SubscriptionQueryInterface
StatusIn() []string
HasStatusIn() bool
SetStatusIn(statusIn []string) SubscriptionQueryInterface
SubscriberID() string
HasSubscriberID() bool
SetSubscriberID(subscriberID string) SubscriptionQueryInterface
PlanID() string
HasPlanID() bool
SetPlanID(planID string) SubscriptionQueryInterface
Offset() int
HasOffset() bool
SetOffset(offset int) SubscriptionQueryInterface
Limit() int
HasLimit() bool
SetLimit(limit int) SubscriptionQueryInterface
OrderBy() string
HasOrderBy() bool
SetOrderBy(orderBy string) SubscriptionQueryInterface
OrderDirection() string
HasOrderDirection() bool
SetOrderDirection(orderByDirection string) SubscriptionQueryInterface
CountOnly() bool
HasCountOnly() bool
SetCountOnly(countOnly bool) SubscriptionQueryInterface
WithDeleted() bool
HasWithDeleted() bool
SetWithDeleted(withDeleted bool) SubscriptionQueryInterface
}
SubscriptionQueryInterface defines the methods for querying subscriptions using SubscriptionQueryOptions.
func NewSubscriptionQuery ¶
func NewSubscriptionQuery() SubscriptionQueryInterface
func SubscriptionQuery ¶
func SubscriptionQuery() SubscriptionQueryInterface
SubscriptionQuery is a shortcut alias for NewSubscriptionQuery
Source Files
¶
- constants.go
- new.go
- plan_implementation.go
- plan_interface.go
- plan_query_implementation.go
- plan_query_interface.go
- store_implementation.go
- store_interface.go
- store_plan_methods.go
- store_sql_plan.go
- store_sql_subscription.go
- store_subscription_methods.go
- subscription_implementation.go
- subscription_interface.go
- subscription_query_implementation.go
- subscription_query_interface.go