postgres

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExtensibleRepository added in v0.4.0

type ExtensibleRepository struct {
	*Repository // Embed the base repository
}

ExtensibleRepository implements tenant.ExtensibleRepository for PostgreSQL

func NewExtensibleRepository added in v0.4.0

func NewExtensibleRepository(db *sql.DB, logger *zap.Logger) *ExtensibleRepository

NewExtensibleRepository creates a new extensible PostgreSQL repository

func (*ExtensibleRepository) CreateExtended added in v0.4.0

func (r *ExtensibleRepository) CreateExtended(ctx context.Context, t *tenant.ExtensibleTenant) error

CreateExtended creates a new tenant with metadata

func (*ExtensibleRepository) CreateMasterTablesExtended added in v0.4.0

func (r *ExtensibleRepository) CreateMasterTablesExtended(ctx context.Context) error

CreateMasterTablesExtended creates the master tables with metadata support

func (*ExtensibleRepository) FindByMetadata added in v0.4.0

func (r *ExtensibleRepository) FindByMetadata(ctx context.Context, key string, value interface{}) ([]*tenant.ExtensibleTenant, error)

FindByMetadata finds tenants by a specific metadata key-value pair

func (*ExtensibleRepository) FindByMetadataKeys added in v0.4.0

func (r *ExtensibleRepository) FindByMetadataKeys(ctx context.Context, keys []string) ([]*tenant.ExtensibleTenant, error)

FindByMetadataKeys finds tenants that have any of the specified metadata keys

func (*ExtensibleRepository) GetExtendedByID added in v0.4.0

func (r *ExtensibleRepository) GetExtendedByID(ctx context.Context, id uuid.UUID) (*tenant.ExtensibleTenant, error)

GetExtendedByID retrieves an extended tenant by ID

func (*ExtensibleRepository) GetExtendedBySubdomain added in v0.4.0

func (r *ExtensibleRepository) GetExtendedBySubdomain(ctx context.Context, subdomain string) (*tenant.ExtensibleTenant, error)

GetExtendedBySubdomain retrieves an extended tenant by subdomain

func (*ExtensibleRepository) GetMetadata added in v0.4.0

func (r *ExtensibleRepository) GetMetadata(ctx context.Context, tenantID uuid.UUID) (tenant.TenantMetadata, error)

GetMetadata retrieves only the metadata for a tenant

func (*ExtensibleRepository) ListExtended added in v0.4.0

func (r *ExtensibleRepository) ListExtended(ctx context.Context, page, perPage int) ([]*tenant.ExtensibleTenant, int, error)

ListExtended retrieves extended tenants with pagination

func (*ExtensibleRepository) RemoveMetadataField added in v0.4.0

func (r *ExtensibleRepository) RemoveMetadataField(ctx context.Context, tenantID uuid.UUID, key string) error

RemoveMetadataField removes a single metadata field

func (*ExtensibleRepository) UpdateExtended added in v0.4.0

func (r *ExtensibleRepository) UpdateExtended(ctx context.Context, t *tenant.ExtensibleTenant) error

UpdateExtended updates an extended tenant

func (*ExtensibleRepository) UpdateMetadata added in v0.4.0

func (r *ExtensibleRepository) UpdateMetadata(ctx context.Context, tenantID uuid.UUID, metadata tenant.TenantMetadata) error

UpdateMetadata updates only the metadata field for a tenant

func (*ExtensibleRepository) UpdateMetadataField added in v0.4.0

func (r *ExtensibleRepository) UpdateMetadataField(ctx context.Context, tenantID uuid.UUID, key string, value interface{}) error

UpdateMetadataField updates a single metadata field

type Repository

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

Repository implements tenant.Repository for PostgreSQL

func NewRepository

func NewRepository(db *sql.DB, logger *zap.Logger) *Repository

NewRepository creates a new PostgreSQL repository

func (*Repository) Create

func (r *Repository) Create(ctx context.Context, t *tenant.Tenant) error

Create creates a new tenant

func (*Repository) CreateMasterTables

func (r *Repository) CreateMasterTables(ctx context.Context) error

CreateMasterTables creates the master tables needed for tenant management

func (*Repository) Delete

func (r *Repository) Delete(ctx context.Context, id uuid.UUID) error

Delete soft deletes a tenant (sets status to cancelled)

func (*Repository) GetByID

func (r *Repository) GetByID(ctx context.Context, id uuid.UUID) (*tenant.Tenant, error)

GetByID retrieves a tenant by ID

func (*Repository) GetBySubdomain

func (r *Repository) GetBySubdomain(ctx context.Context, subdomain string) (*tenant.Tenant, error)

GetBySubdomain retrieves a tenant by subdomain

func (*Repository) GetStats

func (r *Repository) GetStats(ctx context.Context, tenantID uuid.UUID) (*tenant.Stats, error)

GetStats retrieves usage statistics for a tenant

func (*Repository) List

func (r *Repository) List(ctx context.Context, page, perPage int) ([]*tenant.Tenant, int, error)

List retrieves tenants with pagination

func (*Repository) Update

func (r *Repository) Update(ctx context.Context, t *tenant.Tenant) error

Update updates a tenant

Jump to

Keyboard shortcuts

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