Skip to content

Commit 89f5181

Browse files
committed
Support 0.4.0 for C_SHARP sync implementation.
1 parent 563012f commit 89f5181

File tree

4 files changed

+43
-21
lines changed

4 files changed

+43
-21
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net9.0</TargetFramework>
5+
<ImplicitUsings>enable</ImplicitUsings>
6+
<Nullable>enable</Nullable>
7+
<IsPackable>false</IsPackable>
8+
</PropertyGroup>
9+
10+
<ItemGroup>
11+
<PackageReference Include="coverlet.collector" Version="6.0.2" />
12+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
13+
<PackageReference Include="xunit" Version="2.9.2" />
14+
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2" />
15+
</ItemGroup>
16+
17+
<ItemGroup>
18+
<Using Include="Xunit" />
19+
</ItemGroup>
20+
21+
</Project>

PowerSync/PowerSync.Common/Client/Sync/Bucket/SqliteBucketStorage.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ await db.WriteTransaction(async tx =>
111111
foreach (var b in batch.Buckets)
112112
{
113113
var result = await tx.Execute("INSERT INTO powersync_operations(op, data) VALUES(?, ?)",
114-
["save", JsonConvert.SerializeObject(new { buckets = new[] { b.ToJSON() } })]);
114+
["save", JsonConvert.SerializeObject(new { buckets = new[] { JsonConvert.DeserializeObject(b.ToJSON()) } })]);
115115
logger.LogDebug("saveSyncData {message}", JsonConvert.SerializeObject(result));
116116
count += b.Data.Length;
117117
}

PowerSync/PowerSync.Common/Client/Sync/Bucket/SyncDataBucket.cs

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ public class SyncDataBucketJSON
99
[JsonProperty("bucket")]
1010
public string Bucket { get; set; } = null!;
1111

12-
[JsonProperty("has_more")]
13-
public bool? HasMore { get; set; }
12+
// [JsonProperty("has_more")]
13+
// public bool? HasMore { get; set; }
1414

15-
[JsonProperty("after")]
16-
public string? After { get; set; }
15+
// [JsonProperty("after")]
16+
// public string? After { get; set; }
1717

18-
[JsonProperty("next_after")]
19-
public string? NextAfter { get; set; }
18+
// [JsonProperty("next_after")]
19+
// public string? NextAfter { get; set; }
2020

2121
[JsonProperty("data")]
2222
public List<object> Data { get; set; } = [];
@@ -25,15 +25,16 @@ public class SyncDataBucketJSON
2525
public class SyncDataBucket(
2626
string bucket,
2727
OplogEntry[] data,
28-
bool hasMore,
29-
string? after = null,
30-
string? nextAfter = null)
28+
bool hasMore = false
29+
// string? after = null,
30+
// string? nextAfter = null
31+
)
3132
{
3233
public string Bucket { get; private set; } = bucket;
3334
public OplogEntry[] Data { get; private set; } = data;
34-
public bool HasMore { get; private set; } = hasMore;
35-
public string? After { get; private set; } = after;
36-
public string? NextAfter { get; private set; } = nextAfter;
35+
36+
// public string? After { get; private set; } = after;
37+
// public string? NextAfter { get; private set; } = nextAfter;
3738

3839
public static SyncDataBucket FromRow(SyncDataBucketJSON row)
3940
{
@@ -46,10 +47,10 @@ public static SyncDataBucket FromRow(SyncDataBucketJSON row)
4647

4748
return new SyncDataBucket(
4849
row.Bucket,
49-
dataEntries,
50-
row.HasMore ?? false,
51-
row.After,
52-
row.NextAfter
50+
dataEntries
51+
// row.HasMore ?? false,
52+
// row.After,
53+
// row.NextAfter
5354
);
5455
}
5556

@@ -63,9 +64,9 @@ public string ToJSON()
6364
var jsonObject = new SyncDataBucketJSON
6465
{
6566
Bucket = Bucket,
66-
HasMore = HasMore,
67-
After = After,
68-
NextAfter = NextAfter,
67+
// HasMore = HasMore,
68+
// After = After,
69+
// NextAfter = NextAfter,
6970
Data = dataObjects
7071
};
7172

Tools/Setup/Setup.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
public class PowerSyncSetup
99
{
10-
private const string VERSION = "0.3.14";
10+
private const string VERSION = "0.4.0";
1111
private const string GITHUB_BASE_URL = $"https://github.com/powersync-ja/powersync-sqlite-core/releases/download/v{VERSION}";
1212
private const string MAVEN_BASE_URL = $"https://repo1.maven.org/maven2/co/powersync/powersync-sqlite-core/{VERSION}";
1313

0 commit comments

Comments
 (0)