Documentation
¶
Index ¶
- Constants
- func WithTx[T any](ctx context.Context, repo Repository, ...) (resp T, err error)
- func WithTxNoValue(ctx context.Context, repo Repository, ...) error
- type CreateCustomerInput
- type Customer
- type CustomerExternalMapping
- type CustomerID
- type CustomerRepository
- type CustomerService
- type CustomerUsageAttribution
- type DeleteCustomerInput
- type GetCustomerInput
- type ListCustomersInput
- type NotFoundError
- type Repository
- type Service
- type ServiceConfig
- type SubjectKeyConflictError
- type TxRepository
- type UpdateAfterDeleteError
- type UpdateCustomerInput
- type ValidationError
Constants ¶
View Source
const ( IncludeDeleted = false DefaultPageNumber = 1 DefaultPageSize = 100 )
Variables ¶
This section is empty.
Functions ¶
func WithTx ¶
func WithTx[T any](ctx context.Context, repo Repository, fn func(ctx context.Context, repo TxRepository) (T, error)) (resp T, err error)
func WithTxNoValue ¶
func WithTxNoValue(ctx context.Context, repo Repository, fn func(ctx context.Context, repo TxRepository) error) error
Types ¶
type CreateCustomerInput ¶
CreateCustomerInput represents the input for the CreateCustomer method
type Customer ¶
type Customer struct {
models.ManagedResource
Name string `json:"name"`
Timezone *timezone.Timezone `json:"timezone"`
UsageAttribution CustomerUsageAttribution `json:"usageAttribution"`
PrimaryEmail *string `json:"primaryEmail"`
Currency *currencyx.Code `json:"currency"`
BillingAddress *models.Address `json:"billingAddress"`
External *CustomerExternalMapping `json:"external"`
}
Customer represents a customer
type CustomerExternalMapping ¶
type CustomerExternalMapping struct {
StripeCustomerID *string `json:"stripeCustomerID"`
}
CustomerExternalMapping represents the external mapping for a customer
type CustomerID ¶
type CustomerID models.NamespacedID
func (CustomerID) Validate ¶
func (i CustomerID) Validate() error
type CustomerRepository ¶
type CustomerRepository interface {
ListCustomers(ctx context.Context, params ListCustomersInput) (pagination.PagedResponse[Customer], error)
CreateCustomer(ctx context.Context, params CreateCustomerInput) (*Customer, error)
DeleteCustomer(ctx context.Context, customer DeleteCustomerInput) error
GetCustomer(ctx context.Context, customer GetCustomerInput) (*Customer, error)
UpdateCustomer(ctx context.Context, params UpdateCustomerInput) (*Customer, error)
}
type CustomerService ¶
type CustomerService interface {
ListCustomers(ctx context.Context, params ListCustomersInput) (pagination.PagedResponse[Customer], error)
CreateCustomer(ctx context.Context, params CreateCustomerInput) (*Customer, error)
DeleteCustomer(ctx context.Context, customer DeleteCustomerInput) error
GetCustomer(ctx context.Context, customer GetCustomerInput) (*Customer, error)
UpdateCustomer(ctx context.Context, params UpdateCustomerInput) (*Customer, error)
}
type CustomerUsageAttribution ¶
type CustomerUsageAttribution struct {
SubjectKeys []string
}
CustomerUsageAttribution represents the usage attribution for a customer
type DeleteCustomerInput ¶
type DeleteCustomerInput CustomerID
DeleteCustomerInput represents the input for the DeleteCustomer method
func (DeleteCustomerInput) Validate ¶
func (i DeleteCustomerInput) Validate() error
type GetCustomerInput ¶
type GetCustomerInput CustomerID
GetCustomerInput represents the input for the GetCustomer method
func (GetCustomerInput) Validate ¶
func (i GetCustomerInput) Validate() error
type ListCustomersInput ¶
type ListCustomersInput struct {
Namespace string
pagination.Page
IncludeDeleted bool
}
ListCustomersInput represents the input for the ListCustomers method
type NotFoundError ¶
type NotFoundError struct {
CustomerID
}
func (NotFoundError) Error ¶
func (e NotFoundError) Error() string
type Repository ¶
type Repository interface {
CustomerRepository
WithTx(context.Context) (TxRepository, error)
}
type Service ¶
type Service interface {
CustomerService
}
func NewService ¶
func NewService(c ServiceConfig) (Service, error)
type ServiceConfig ¶
type ServiceConfig struct {
Repository Repository
}
func (*ServiceConfig) Validate ¶
func (c *ServiceConfig) Validate() error
type SubjectKeyConflictError ¶
type SubjectKeyConflictError struct {
Namespace string `json:"namespace"`
SubjectKeys []string `json:"subjectKeys"`
}
SubjectKeyConflictError represents an error when a subject key is already associated with a customer
func (SubjectKeyConflictError) Error ¶
func (e SubjectKeyConflictError) Error() string
type TxRepository ¶
type TxRepository interface {
CustomerRepository
Commit() error
Rollback() error
}
type UpdateAfterDeleteError ¶
type UpdateAfterDeleteError genericError
func (UpdateAfterDeleteError) Error ¶
func (e UpdateAfterDeleteError) Error() string
func (UpdateAfterDeleteError) Unwrap ¶
func (e UpdateAfterDeleteError) Unwrap() error
type UpdateCustomerInput ¶
UpdateCustomerInput represents the input for the UpdateCustomer method
type ValidationError ¶
type ValidationError genericError
func (ValidationError) Error ¶
func (e ValidationError) Error() string
func (ValidationError) Unwrap ¶
func (e ValidationError) Unwrap() error
Click to show internal directories.
Click to hide internal directories.