driver

package
v0.13.1 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package driver defines the TenantStore interface and associated types.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTenantNotFound                  = errors.New("tenant does not exist")
	ErrTenantDeleted                   = errors.New("tenant has been deleted")
	ErrDuplicateDestination            = errors.New("destination already exists")
	ErrDestinationNotFound             = errors.New("destination does not exist")
	ErrDestinationDeleted              = errors.New("destination has been deleted")
	ErrMaxDestinationsPerTenantReached = errors.New("maximum number of destinations per tenant reached")
	ErrListTenantNotSupported          = errors.New("list tenant feature is not enabled")
	ErrInvalidCursor                   = errors.New("invalid cursor")
	ErrInvalidOrder                    = errors.New("invalid order: must be 'asc' or 'desc'")
	ErrConflictingCursors              = errors.New("cannot specify both next and prev cursors")
)

Functions

This section is empty.

Types

type DestinationFilter

type DestinationFilter struct {
	Type   []string
	Topics []string
}

DestinationFilter specifies criteria for filtering destinations.

type ListDestinationByTenantOpts

type ListDestinationByTenantOpts struct {
	Filter *DestinationFilter
}

ListDestinationByTenantOpts contains options for listing destinations.

func WithDestinationFilter

func WithDestinationFilter(filter DestinationFilter) ListDestinationByTenantOpts

WithDestinationFilter creates a ListDestinationByTenantOpts with the given filter.

type ListTenantRequest

type ListTenantRequest struct {
	Limit int    // Number of results per page (default: 20)
	Next  string // Cursor for next page
	Prev  string // Cursor for previous page
	Dir   string // Sort direction: "asc" or "desc" (default: "desc")
}

ListTenantRequest contains parameters for listing tenants.

type SeekPagination

type SeekPagination struct {
	OrderBy string  `json:"order_by"`
	Dir     string  `json:"dir"`
	Limit   int     `json:"limit"`
	Next    *string `json:"next"`
	Prev    *string `json:"prev"`
}

SeekPagination represents cursor-based pagination metadata for list responses.

type TenantPaginatedResult

type TenantPaginatedResult struct {
	Models     []models.Tenant `json:"models"`
	Pagination SeekPagination  `json:"pagination"`
	Count      int             `json:"count"`
}

TenantPaginatedResult contains the paginated list of tenants.

type TenantStore

type TenantStore interface {
	Init(ctx context.Context) error
	RetrieveTenant(ctx context.Context, tenantID string) (*models.Tenant, error)
	UpsertTenant(ctx context.Context, tenant models.Tenant) error
	DeleteTenant(ctx context.Context, tenantID string) error
	ListTenant(ctx context.Context, req ListTenantRequest) (*TenantPaginatedResult, error)
	ListDestinationByTenant(ctx context.Context, tenantID string, options ...ListDestinationByTenantOpts) ([]models.Destination, error)
	RetrieveDestination(ctx context.Context, tenantID, destinationID string) (*models.Destination, error)
	CreateDestination(ctx context.Context, destination models.Destination) error
	UpsertDestination(ctx context.Context, destination models.Destination) error
	DeleteDestination(ctx context.Context, tenantID, destinationID string) error
	MatchEvent(ctx context.Context, event models.Event) ([]string, error)
}

TenantStore is the interface for tenant and destination storage.

Jump to

Keyboard shortcuts

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