importer

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DriverInterface

type DriverInterface interface {
	Prefix() string
	FetchAllUserGroups(ctx context.Context) ([]UserGroupMapping, error)
}

DriverInterface defines the contract for external data sources that can provide user-to-group mappings for import into the local database.

type Importer

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

Importer handles the bulk import of user-group mappings from an external driver into the local database.

func NewImporter

func NewImporter(driver DriverInterface, storage StorageInterface, logger logging.LoggerInterface) *Importer

NewImporter creates a new Importer with the given driver, storage, and logger.

func (*Importer) Run

func (i *Importer) Run(ctx context.Context) error

Run executes the import process: 1. Fetches all user-group mappings from the driver. 2. Finds or creates groups in the database (deduplicating by name). 3. Adds users to their respective groups.

type SalesforceDriver

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

SalesforceDriver implements DriverInterface by querying the Salesforce API for all team member records and extracting user-to-group mappings.

func NewSalesforceDriver

func NewSalesforceDriver(client salesforce.SalesforceInterface) *SalesforceDriver

NewSalesforceDriver creates a new SalesforceDriver with the given Salesforce client.

func (*SalesforceDriver) FetchAllUserGroups

func (d *SalesforceDriver) FetchAllUserGroups(ctx context.Context) ([]UserGroupMapping, error)

FetchAllUserGroups queries Salesforce for all team members and returns a flat list of user-to-group mappings. Each user may have up to two group mappings: one for their department and one for their team.

func (*SalesforceDriver) Prefix

func (d *SalesforceDriver) Prefix() string

type StorageInterface

type StorageInterface interface {
	CreateGroup(ctx context.Context, group *types.Group) (*types.Group, error)
	GetGroupByName(ctx context.Context, name, tenantID string) (*types.Group, error)
	AddUsersToGroup(ctx context.Context, groupID string, userIDs []string) error
}

StorageInterface defines the storage operations required by the Importer.

type TeamMemberRecord

type TeamMemberRecord struct {
	Email      string `mapstructure:"fHCM2__Email__c"`
	Department string `mapstructure:"Department2__c"`
	Team       string `mapstructure:"fHCM2__Team__c"`
}

TeamMemberRecord represents a single Salesforce team member record.

type UserGroupMapping

type UserGroupMapping struct {
	UserID    string
	GroupName string
}

UserGroupMapping represents a mapping between a user identifier and a group name.

Jump to

Keyboard shortcuts

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