public async Task Test() { const string spaceName = "primary_only_index"; using (var tarantoolClient = await Client.Box.Connect(ConnectionStringFactory.GetReplicationSource_1_7())) { var schema = tarantoolClient.GetSchema(); var space = schema[spaceName]; try { await space.Insert((2u, "Music", 0.0f)); } catch (ArgumentException) { await space.Delete <ValueTuple <uint>, ValueTuple <uint, string, double> >(ValueTuple.Create(2u)); await space.Insert((2u, "Music", 0.0f)); } await space.Select <ValueTuple <uint>, ValueTuple <uint, string, double> >(ValueTuple.Create(2u)); await space.Replace((2u, "Car", -24.5)); await space.Update <ValueTuple <uint>, ValueTuple <uint, string, double> >( ValueTuple.Create(2u), new UpdateOperation[] { UpdateOperation.CreateAddition(1, 2) }); await space.Upsert( (5u, "Test", 20), new UpdateOperation[] { UpdateOperation.CreateAssign(1, 1) }); } }
public async Task HashIndexMethods() { const string spaceName = "primary_only_index"; await ClearDataAsync(spaceName); using (var tarantoolClient = await Client.Box.Connect(ConnectionStringFactory.GetReplicationSource_1_7())) { var index = tarantoolClient.GetSchema()[spaceName]["primary"]; try { await index.Insert((2, "Music", 0.0)); } catch (ArgumentException) { await index.Delete <ValueTuple <int>, ValueTuple <int, string, double> >(ValueTuple.Create(2)); await index.Insert((2, "Music", 0.0)); } await index.Select <ValueTuple <uint>, ValueTuple <int, string> >(ValueTuple.Create(1029u)); await index.Replace((2, "Car", -245.3)); await index.Update <ValueTuple <int, string, double>, ValueTuple <int> >( ValueTuple.Create(2), new UpdateOperation[] { UpdateOperation.CreateAddition(100, 2) }); await index.Upsert((6u, "name", 100.0), new UpdateOperation[] { UpdateOperation.CreateAssign(2, 2) }); await index.Upsert((6u, "name", 100.0), new UpdateOperation[] { UpdateOperation.CreateAddition(-2, 2) }); var result = await index.Select <ValueTuple <uint>, ValueTuple <uint, string, double> >(ValueTuple.Create(6u)); result.Data[0].Item1.ShouldBe(6u); } }