postgres

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2023 License: MIT Imports: 16 Imported by: 0

README

postgres

To regenerate this package, cd into the root of friendly-stripe-sync and run sqlc generate.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildConnectionDSN

func BuildConnectionDSN(dbname string) string

Types

type DBTX

type DBTX interface {
	ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
	PrepareContext(context.Context, string) (*sql.Stmt, error)
	QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
	QueryRowContext(context.Context, string, ...interface{}) *sql.Row
}

type PostgresStore

type PostgresStore struct {
	Q *Queries
	// contains filtered or unexported fields
}

func NewPostgresStore

func NewPostgresStore() *PostgresStore

func NewPostgresTestStore

func NewPostgresTestStore() (*PostgresStore, func())

func (*PostgresStore) GetMigrater

func (pgs *PostgresStore) GetMigrater() (*PostgresStoreMigrater, error)

type PostgresStoreMigrater

type PostgresStoreMigrater struct {
	// contains filtered or unexported fields
}

func (*PostgresStoreMigrater) Close

func (mig *PostgresStoreMigrater) Close() error

func (*PostgresStoreMigrater) Down

func (mig *PostgresStoreMigrater) Down() error

func (*PostgresStoreMigrater) Force

func (mig *PostgresStoreMigrater) Force(version int) error

func (*PostgresStoreMigrater) List

func (mig *PostgresStoreMigrater) List() ([]string, error)

func (*PostgresStoreMigrater) SetLogger

func (mig *PostgresStoreMigrater) SetLogger(logger migrate.Logger)

func (*PostgresStoreMigrater) To

func (mig *PostgresStoreMigrater) To(version uint) error

func (*PostgresStoreMigrater) Up

func (mig *PostgresStoreMigrater) Up() error

func (*PostgresStoreMigrater) Version

func (mig *PostgresStoreMigrater) Version() (uint, bool, error)

type Queries

type Queries struct {
	// contains filtered or unexported fields
}

func New

func New(db DBTX) *Queries

func (*Queries) CouponExists added in v0.1.1

func (q *Queries) CouponExists(ctx context.Context, id string) (bool, error)

func (*Queries) CustomerExists

func (q *Queries) CustomerExists(ctx context.Context, id string) (bool, error)

func (*Queries) DeleteAllCoupons added in v0.1.1

func (q *Queries) DeleteAllCoupons(ctx context.Context) error

func (*Queries) DeleteAllCustomers

func (q *Queries) DeleteAllCustomers(ctx context.Context) error

func (*Queries) DeleteAllPrices

func (q *Queries) DeleteAllPrices(ctx context.Context) error

func (*Queries) DeleteAllProducts

func (q *Queries) DeleteAllProducts(ctx context.Context) error

func (*Queries) DeleteAllSubscriptions

func (q *Queries) DeleteAllSubscriptions(ctx context.Context) error

func (*Queries) DeleteCoupon added in v0.1.1

func (q *Queries) DeleteCoupon(ctx context.Context, id string) error

func (*Queries) DeleteCurrentSyncState

func (q *Queries) DeleteCurrentSyncState(ctx context.Context) error

func (*Queries) DeletePrice

func (q *Queries) DeletePrice(ctx context.Context, id string) error

func (*Queries) DeleteProduct

func (q *Queries) DeleteProduct(ctx context.Context, id string) error

func (*Queries) GetCurrentSyncState

func (q *Queries) GetCurrentSyncState(ctx context.Context) (StripeSyncState, error)

func (*Queries) PriceExists

func (q *Queries) PriceExists(ctx context.Context, id string) (bool, error)

func (*Queries) ProductExists

func (q *Queries) ProductExists(ctx context.Context, id string) (bool, error)

func (*Queries) SetSyncState

func (q *Queries) SetSyncState(ctx context.Context, lastEvent int64) error

func (*Queries) UpdateSubscriptionDiscount added in v0.1.1

func (q *Queries) UpdateSubscriptionDiscount(ctx context.Context, arg UpdateSubscriptionDiscountParams) error

func (*Queries) UpsertCoupons added in v0.1.1

func (q *Queries) UpsertCoupons(ctx context.Context, arg UpsertCouponsParams) error

func (*Queries) UpsertCustomer

func (q *Queries) UpsertCustomer(ctx context.Context, arg UpsertCustomerParams) error

func (*Queries) UpsertPrice

func (q *Queries) UpsertPrice(ctx context.Context, arg UpsertPriceParams) error

func (*Queries) UpsertProduct

func (q *Queries) UpsertProduct(ctx context.Context, arg UpsertProductParams) error

func (*Queries) UpsertSubscription

func (q *Queries) UpsertSubscription(ctx context.Context, arg UpsertSubscriptionParams) error

func (*Queries) UpsertSubscriptionItem

func (q *Queries) UpsertSubscriptionItem(ctx context.Context, arg UpsertSubscriptionItemParams) error

func (*Queries) WithTx

func (q *Queries) WithTx(tx *sql.Tx) *Queries

type StripeCoupon added in v0.1.1

type StripeCoupon struct {
	ID               string
	Object           string
	AmountOff        sql.NullInt64
	Created          int64
	Currency         sql.NullString
	Duration         string
	DurationInMonths sql.NullInt64
	Livemode         bool
	MaxRedemptions   sql.NullInt64
	Metadata         pqtype.NullRawMessage
	Name             string
	PercentOff       sql.NullFloat64
	RedeemBy         sql.NullInt64
	TimesRedeemed    sql.NullInt64
	Valid            bool
	AppliesTo        pqtype.NullRawMessage
	UpdatedAt        time.Time
}

type StripeCustomer

type StripeCustomer struct {
	ID                  string
	Object              string
	Address             pqtype.NullRawMessage
	Description         sql.NullString
	Email               sql.NullString
	Metadata            pqtype.NullRawMessage
	Name                sql.NullString
	Phone               sql.NullString
	Shipping            pqtype.NullRawMessage
	Balance             sql.NullInt64
	Created             int64
	Currency            sql.NullString
	DefaultSource       sql.NullString
	Delinquent          bool
	Discount            pqtype.NullRawMessage
	InvoicePrefix       string
	InvoiceSettings     pqtype.NullRawMessage
	Livemode            bool
	NextInvoiceSequence int64
	PreferredLocales    []string
	TaxExempt           string
	Deleted             bool
	UpdatedAt           time.Time
}

type StripePrice

type StripePrice struct {
	ID                string
	Object            string
	Active            bool
	Currency          string
	Metadata          pqtype.NullRawMessage
	Nickname          sql.NullString
	Recurring         pqtype.NullRawMessage
	Type              string
	UnitAmount        sql.NullInt64
	BillingScheme     string
	Created           int64
	Livemode          bool
	LookupKey         sql.NullString
	TiersMode         sql.NullString
	TransformQuantity pqtype.NullRawMessage
	UnitAmountDecimal sql.NullFloat64
	Product           string
	UpdatedAt         time.Time
}

type StripeProduct

type StripeProduct struct {
	ID                  string
	Object              string
	Active              bool
	Description         sql.NullString
	Metadata            pqtype.NullRawMessage
	Name                string
	Created             int64
	Images              []string
	Livemode            bool
	PackageDimensions   pqtype.NullRawMessage
	Shippable           bool
	StatementDescriptor sql.NullString
	UnitLabel           sql.NullString
	Updated             int64
	Url                 sql.NullString
	UpdatedAt           time.Time
}

type StripeSubscription

type StripeSubscription struct {
	ID                            string
	Object                        string
	CancelAtPeriodEnd             bool
	CurrentPeriodEnd              int64
	CurrentPeriodStart            int64
	DefaultPaymentMethod          sql.NullString
	Metadata                      pqtype.NullRawMessage
	PendingSetupIntent            sql.NullString
	PendingUpdate                 pqtype.NullRawMessage
	Status                        string
	ApplicationFeePercent         sql.NullFloat64
	BillingCycleAnchor            int64
	BillingThresholds             pqtype.NullRawMessage
	CancelAt                      sql.NullInt64
	CanceledAt                    sql.NullInt64
	CollectionMethod              string
	Created                       int64
	DaysUntilDue                  sql.NullInt64
	DefaultSource                 sql.NullString
	DefaultTaxRates               pqtype.NullRawMessage
	EndedAt                       sql.NullInt64
	Livemode                      bool
	NextPendingInvoiceItemInvoice sql.NullInt64
	PauseCollection               pqtype.NullRawMessage
	PendingInvoiceItemInterval    pqtype.NullRawMessage
	StartDate                     int64
	TransferData                  pqtype.NullRawMessage
	TrialEnd                      sql.NullInt64
	TrialStart                    sql.NullInt64
	DiscountID                    sql.NullString
	DiscountStart                 sql.NullInt64
	DiscountEnd                   sql.NullInt64
	DiscountCoupon                sql.NullString
	DiscountDeleted               sql.NullBool
	DiscountPromotionCode         sql.NullString
	Schedule                      sql.NullString
	Customer                      string
	UpdatedAt                     time.Time
}

type StripeSubscriptionItem

type StripeSubscriptionItem struct {
	ID                string
	Object            string
	BillingThresholds pqtype.NullRawMessage
	Created           int64
	Metadata          pqtype.NullRawMessage
	Quantity          int64
	Price             string
	Subscription      string
	TaxRates          pqtype.NullRawMessage
}

type StripeSyncState

type StripeSyncState struct {
	ID        string
	LastEvent int64
}

type UpdateSubscriptionDiscountParams added in v0.1.1

type UpdateSubscriptionDiscountParams struct {
	DiscountID            sql.NullString
	DiscountStart         sql.NullInt64
	DiscountEnd           sql.NullInt64
	DiscountCoupon        sql.NullString
	DiscountDeleted       sql.NullBool
	DiscountPromotionCode sql.NullString
}

type UpsertCouponsParams added in v0.1.1

type UpsertCouponsParams struct {
	ID               string
	Object           string
	AmountOff        sql.NullInt64
	Created          int64
	Currency         sql.NullString
	Duration         string
	DurationInMonths sql.NullInt64
	Livemode         bool
	MaxRedemptions   sql.NullInt64
	Metadata         pqtype.NullRawMessage
	Name             string
	PercentOff       sql.NullFloat64
	RedeemBy         sql.NullInt64
	TimesRedeemed    sql.NullInt64
	Valid            bool
	AppliesTo        pqtype.NullRawMessage
}

type UpsertCustomerParams

type UpsertCustomerParams struct {
	ID                  string
	Object              string
	Address             pqtype.NullRawMessage
	Description         sql.NullString
	Email               sql.NullString
	Metadata            pqtype.NullRawMessage
	Name                sql.NullString
	Phone               sql.NullString
	Shipping            pqtype.NullRawMessage
	Balance             sql.NullInt64
	Created             int64
	Currency            sql.NullString
	Delinquent          bool
	Discount            pqtype.NullRawMessage
	InvoicePrefix       string
	InvoiceSettings     pqtype.NullRawMessage
	Livemode            bool
	NextInvoiceSequence int64
	PreferredLocales    []string
	TaxExempt           string
	Deleted             bool
}

type UpsertPriceParams

type UpsertPriceParams struct {
	ID                string
	Object            string
	Active            bool
	BillingScheme     string
	Created           int64
	Currency          string
	Livemode          bool
	LookupKey         sql.NullString
	Metadata          pqtype.NullRawMessage
	Nickname          sql.NullString
	Recurring         pqtype.NullRawMessage
	Type              string
	UnitAmount        sql.NullInt64
	TiersMode         sql.NullString
	TransformQuantity pqtype.NullRawMessage
	UnitAmountDecimal sql.NullFloat64
	Product           string
}

type UpsertProductParams

type UpsertProductParams struct {
	ID                  string
	Object              string
	Active              bool
	Description         sql.NullString
	Metadata            pqtype.NullRawMessage
	Name                string
	Created             int64
	Images              []string
	Livemode            bool
	PackageDimensions   pqtype.NullRawMessage
	Shippable           bool
	StatementDescriptor sql.NullString
	UnitLabel           sql.NullString
	Updated             int64
	Url                 sql.NullString
}

type UpsertSubscriptionItemParams

type UpsertSubscriptionItemParams struct {
	ID                string
	Object            string
	BillingThresholds pqtype.NullRawMessage
	Created           int64
	Metadata          pqtype.NullRawMessage
	Price             string
	Quantity          int64
	Subscription      string
	TaxRates          pqtype.NullRawMessage
}

type UpsertSubscriptionParams

type UpsertSubscriptionParams struct {
	ID                            string
	Object                        string
	CancelAtPeriodEnd             bool
	CurrentPeriodEnd              int64
	CurrentPeriodStart            int64
	Metadata                      pqtype.NullRawMessage
	PendingUpdate                 pqtype.NullRawMessage
	Status                        string
	ApplicationFeePercent         sql.NullFloat64
	BillingCycleAnchor            int64
	BillingThresholds             pqtype.NullRawMessage
	CancelAt                      sql.NullInt64
	CanceledAt                    sql.NullInt64
	CollectionMethod              string
	Created                       int64
	DaysUntilDue                  sql.NullInt64
	DefaultTaxRates               pqtype.NullRawMessage
	EndedAt                       sql.NullInt64
	Livemode                      bool
	NextPendingInvoiceItemInvoice sql.NullInt64
	PauseCollection               pqtype.NullRawMessage
	PendingInvoiceItemInterval    pqtype.NullRawMessage
	StartDate                     int64
	TransferData                  pqtype.NullRawMessage
	TrialEnd                      sql.NullInt64
	TrialStart                    sql.NullInt64
	DiscountID                    sql.NullString
	DiscountStart                 sql.NullInt64
	DiscountEnd                   sql.NullInt64
	DiscountCoupon                sql.NullString
	DiscountDeleted               sql.NullBool
	DiscountPromotionCode         sql.NullString
	Customer                      string
}

Jump to

Keyboard shortcuts

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