export

package
v1.0.32 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2025 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventExporter

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

EventExporter handles feature usage export operations

func NewEventExporter

func NewEventExporter(
	featureUsageRepo events.FeatureUsageRepository,
	integrationFactory *integration.Factory,
	logger *logger.Logger,
) *EventExporter

NewEventExporter creates a new event exporter

func (*EventExporter) GetFilenamePrefix

func (e *EventExporter) GetFilenamePrefix() string

GetFilenamePrefix returns the prefix for the exported file

func (*EventExporter) PrepareData

func (e *EventExporter) PrepareData(ctx context.Context, request *dto.ExportRequest) ([]byte, int, error)

PrepareData fetches feature usage data in batches and converts it to CSV format

type ExportService

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

ExportService handles export operations for different entity types

func NewExportService

func NewExportService(
	featureUsageRepo events.FeatureUsageRepository,
	invoiceRepo invoice.Repository,
	connectionRepo connection.Repository,
	integrationFactory *integration.Factory,
	logger *logger.Logger,
) *ExportService

NewExportService creates a new export service

func (*ExportService) Export

func (s *ExportService) Export(ctx context.Context, request *dto.ExportRequest) (*dto.ExportResponse, error)

Export routes the export request to the appropriate entity exporter

type Exporter

type Exporter interface {
	// PrepareData fetches and prepares data for export
	PrepareData(ctx context.Context, request *dto.ExportRequest) ([]byte, int, error)

	// GetFilenamePrefix returns the prefix for the exported file
	GetFilenamePrefix() string
}

Exporter defines the interface for entity-specific exporters

type FeatureUsageCSV

type FeatureUsageCSV struct {
	ID                 string `csv:"id"`
	TenantID           string `csv:"tenant_id"`
	EnvironmentID      string `csv:"environment_id"`
	ExternalCustomerID string `csv:"external_customer_id"`
	CustomerID         string `csv:"customer_id"`
	SubscriptionID     string `csv:"subscription_id"`
	SubLineItemID      string `csv:"sub_line_item_id"`
	PriceID            string `csv:"price_id"`
	MeterID            string `csv:"meter_id"`
	FeatureID          string `csv:"feature_id"`
	EventName          string `csv:"event_name"`
	Source             string `csv:"source"`
	Timestamp          string `csv:"timestamp"`   // RFC3339 format
	IngestedAt         string `csv:"ingested_at"` // RFC3339 format
	PeriodID           string `csv:"period_id"`   // Billing period ID (uint64 as string)
	QtyTotal           string `csv:"qty_total"`   // Total quantity (decimal as string)
	Properties         string `csv:"properties"`  // Event properties as JSON string
	UniqueHash         string `csv:"unique_hash"` // Deduplication hash
}

FeatureUsageCSV represents the CSV structure for feature usage export

type InvoiceCSV

type InvoiceCSV struct {
	ID               string `csv:"id"`
	TenantID         string `csv:"tenant_id"`
	EnvironmentID    string `csv:"environment_id"`
	CustomerID       string `csv:"customer_id"`
	SubscriptionID   string `csv:"subscription_id"`
	InvoiceNumber    string `csv:"invoice_number"`
	InvoiceType      string `csv:"invoice_type"`
	InvoiceStatus    string `csv:"invoice_status"`
	PaymentStatus    string `csv:"payment_status"`
	Currency         string `csv:"currency"`
	AmountDue        string `csv:"amount_due"`        // Decimal as string
	AmountPaid       string `csv:"amount_paid"`       // Decimal as string
	AmountRemaining  string `csv:"amount_remaining"`  // Decimal as string
	Subtotal         string `csv:"subtotal"`          // Decimal as string
	Total            string `csv:"total"`             // Decimal as string
	TotalDiscount    string `csv:"total_discount"`    // Decimal as string
	TotalTax         string `csv:"total_tax"`         // Decimal as string
	AdjustmentAmount string `csv:"adjustment_amount"` // Decimal as string
	RefundedAmount   string `csv:"refunded_amount"`   // Decimal as string
	BillingSequence  string `csv:"billing_sequence"`  // Integer as string
	Description      string `csv:"description"`
	DueDate          string `csv:"due_date"`     // RFC3339 format
	PaidAt           string `csv:"paid_at"`      // RFC3339 format
	VoidedAt         string `csv:"voided_at"`    // RFC3339 format
	FinalizedAt      string `csv:"finalized_at"` // RFC3339 format
	BillingPeriod    string `csv:"billing_period"`
	PeriodStart      string `csv:"period_start"` // RFC3339 format
	PeriodEnd        string `csv:"period_end"`   // RFC3339 format
	InvoicePDFURL    string `csv:"invoice_pdf_url"`
	BillingReason    string `csv:"billing_reason"`
	Metadata         string `csv:"metadata"` // JSON string
	IdempotencyKey   string `csv:"idempotency_key"`
	Version          string `csv:"version"` // Integer as string
	Status           string `csv:"status"`
	CreatedBy        string `csv:"created_by"`
	UpdatedBy        string `csv:"updated_by"`
	CreatedAt        string `csv:"created_at"` // RFC3339 format
	UpdatedAt        string `csv:"updated_at"` // RFC3339 format
}

InvoiceCSV represents the CSV structure for invoice export

type InvoiceExporter

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

InvoiceExporter handles invoice export operations

func NewInvoiceExporter

func NewInvoiceExporter(
	invoiceRepo invoice.Repository,
	integrationFactory *integration.Factory,
	logger *logger.Logger,
) *InvoiceExporter

NewInvoiceExporter creates a new invoice exporter

func (*InvoiceExporter) GetFilenamePrefix

func (e *InvoiceExporter) GetFilenamePrefix() string

GetFilenamePrefix returns the prefix for the exported file

func (*InvoiceExporter) PrepareData

func (e *InvoiceExporter) PrepareData(ctx context.Context, request *dto.ExportRequest) ([]byte, int, error)

PrepareData fetches invoice data in batches and converts it to CSV format

Jump to

Keyboard shortcuts

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