MappingRepository

Classes > Sync.SQLite > MappingRepository

SQLite repository for sync mapping state and record hashes. Implements spec Section 7.5.2 tables.

public static class MappingRepository

Methods

GetMappingState(SqliteConnection, string)

public static Result<MappingStateEntry?, SyncError> GetMappingState(SqliteConnection connection, string mappingId)

Gets mapping state by ID.

Parameters:

Name Type Description
connection SqliteConnection SQLite connection.
mappingId String Mapping identifier.

Returns: SyncError> - Mapping state or null if not found.

GetAllMappingStates(SqliteConnection)

public static Result<IReadOnlyList<MappingStateEntry>, SyncError> GetAllMappingStates(SqliteConnection connection)

Gets all mapping states.

Parameters:

Name Type Description
connection SqliteConnection SQLite connection.

Returns: SyncError> - List of mapping states.

UpsertMappingState(SqliteConnection, MappingStateEntry)

public static Result<bool, SyncError> UpsertMappingState(SqliteConnection connection, MappingStateEntry state)

Upserts mapping state.

Parameters:

Name Type Description
connection SqliteConnection SQLite connection.
state MappingStateEntry Mapping state to save.

Returns: SyncError> - Success or error.

DeleteMappingState(SqliteConnection, string)

public static Result<bool, SyncError> DeleteMappingState(SqliteConnection connection, string mappingId)

Deletes mapping state.

Parameters:

Name Type Description
connection SqliteConnection SQLite connection.
mappingId String Mapping identifier.

Returns: SyncError> - Success or error.

GetRecordHash(SqliteConnection, string, string)

public static Result<RecordHashEntry?, SyncError> GetRecordHash(SqliteConnection connection, string mappingId, string sourcePk)

Gets record hash by mapping ID and source PK.

Parameters:

Name Type Description
connection SqliteConnection SQLite connection.
mappingId String Mapping identifier.
sourcePk String Source primary key JSON.

Returns: SyncError> - Record hash or null if not found.

UpsertRecordHash(SqliteConnection, RecordHashEntry)

public static Result<bool, SyncError> UpsertRecordHash(SqliteConnection connection, RecordHashEntry hash)

Upserts record hash.

Parameters:

Name Type Description
connection SqliteConnection SQLite connection.
hash RecordHashEntry Record hash to save.

Returns: SyncError> - Success or error.

DeleteRecordHash(SqliteConnection, string, string)

public static Result<bool, SyncError> DeleteRecordHash(SqliteConnection connection, string mappingId, string sourcePk)

Deletes record hash.

Parameters:

Name Type Description
connection SqliteConnection SQLite connection.
mappingId String Mapping identifier.
sourcePk String Source primary key JSON.

Returns: SyncError> - Success or error.

DeleteRecordHashesByMapping(SqliteConnection, string)

public static Result<int, SyncError> DeleteRecordHashesByMapping(SqliteConnection connection, string mappingId)

Deletes all record hashes for a mapping.

Parameters:

Name Type Description
connection SqliteConnection SQLite connection.
mappingId String Mapping identifier.

Returns: SyncError> - Number of deleted hashes or error.

CountRecordHashes(SqliteConnection, string)

public static Result<long, SyncError> CountRecordHashes(SqliteConnection connection, string mappingId)

Counts record hashes for a mapping.

Parameters:

Name Type Description
connection SqliteConnection SQLite connection.
mappingId String Mapping identifier.

Returns: SyncError> - Count or error.