Skip to main content

repo.go

repo.go - Overview

  1. Overview This file defines the interfaces and methods for managing installed and available integrations, including serialization to and from a database.

  2. Detailed Documentation

InstalledIntegrationConfig

  • Purpose: Represents the configuration of an installed integration.
  • Parameters: None explicitly defined in code, assumes fields are defined elsewhere.
  • Returns: N/A

Scan(src interface{}) error

  • Purpose: Deserializes InstalledIntegrationConfig from a database source (e.g., a byte array).
  • Parameters:
    • src (interface{}: The source data from the database, expected to be a byte array.
  • Returns:
    • error: An error if deserialization fails, nil otherwise.

Value() (driver.Value, error)

  • Purpose: Serializes InstalledIntegrationConfig to a format suitable for database storage (JSON).
  • Parameters: None
  • Returns:
    • driver.Value: The serialized JSON data as a driver.Value.
    • error: An error if serialization fails, nil otherwise.

InstalledIntegrationsRepo

  • Purpose: Defines the interface for managing installed integrations.
  • Parameters: N/A
  • Returns: N/A
list(context.Context) ([]InstalledIntegration, *model.ApiError)
  • Purpose: Lists all installed integrations.
  • Parameters:
    • ctx (context.Context): Context for the operation.
  • Returns:
    • []InstalledIntegration: A slice of installed integrations.
    • *model.ApiError: An API error, if any.
get(ctx context.Context, integrationIds []string) (map[string]InstalledIntegration, *model.ApiError)
  • Purpose: Retrieves installed integrations by their IDs.
  • Parameters:
    • ctx (context.Context): Context for the operation.
    • integrationIds ([]string): A slice of integration IDs to retrieve.
  • Returns:
    • map[string]InstalledIntegration: A map of integration IDs to installed integrations.
    • *model.ApiError: An API error, if any.
upsert(ctx context.Context, integrationId string, config InstalledIntegrationConfig) (*InstalledIntegration, *model.ApiError)
  • Purpose: Inserts or updates an installed integration.
  • Parameters:
    • ctx (context.Context): Context for the operation.
    • integrationId (string): The ID of the integration.
    • config (InstalledIntegrationConfig): The configuration of the installed integration.
  • Returns:
    • *InstalledIntegration: The inserted or updated integration.
    • *model.ApiError: An API error, if any.
delete(ctx context.Context, integrationId string) *model.ApiError
  • Purpose: Deletes an installed integration.
  • Parameters:
    • ctx (context.Context): Context for the operation.
    • integrationId (string): The ID of the integration to delete.
  • Returns:
    • *model.ApiError: An API error, if any.

AvailableIntegrationsRepo

  • Purpose: Defines the interface for managing available integrations.
  • Parameters: N/A
  • Returns: N/A
list(context.Context) ([]IntegrationDetails, *model.ApiError)
  • Purpose: Lists all available integrations.
  • Parameters:
    • ctx (context.Context): Context for the operation.
  • Returns:
    • []IntegrationDetails: A slice of available integration details.
    • *model.ApiError: An API error, if any.
get(ctx context.Context, integrationIds []string) (map[string]IntegrationDetails, *model.ApiError)
  • Purpose: Retrieves available integrations by their IDs.
  • Parameters:
    • ctx (context.Context): Context for the operation.
    • integrationIds ([]string): A slice of integration IDs to retrieve.
  • Returns:
    • map[string]IntegrationDetails: A map of integration IDs to integration details.
    • *model.ApiError: An API error, if any.
  1. Code Examples None.

  2. Clarity and Accuracy The documentation is based on the provided code and aims to be clear and accurate.

  3. Markdown & MDX Perfection The document uses correct markdown syntax.

  4. Edge Cases To Avoid Breaking MDX All necessary precautions have been taken.

  5. Getting Started Relevance Include in Getting Started: NO