superevent 0.1.0.0 → 0.1.0.1
raw patch · 4 files changed
+29/−3 lines, 4 files
Files
- ChangeLog.md +4/−0
- src/SuperEvent/Store/Hasql.hs +1/−1
- superevent.cabal +2/−2
- test/SuperEvent/Store/HasqlSpec.hs +22/−0
ChangeLog.md view
@@ -1,5 +1,9 @@ # Changelog for superevent +## 0.1.0.1++* Fix wrong database constraint.+ ## 0.1.0.0 * First release.
src/SuperEvent/Store/Hasql.hs view
@@ -355,7 +355,7 @@ created timestamptz NOT NULL DEFAULT NOW(), CONSTRAINT "event_id" PRIMARY KEY (id, stream), UNIQUE (stream, version),- CONSTRAINT valid_version CHECK (version >= position)+ CONSTRAINT valid_version CHECK (position >= version) ); CREATE INDEX event_stream ON events (stream);
superevent.cabal view
@@ -2,10 +2,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 1636a007f3d46981133cef8a5a092ad267cf35b4404cb0ce81c84ee90cc74890+-- hash: 0f38d794a84bc7b11884102cf51fa7ea920ae5a670f168193f5c4a039caf5d27 name: superevent-version: 0.1.0.0+version: 0.1.0.1 synopsis: A simple opinionated event store implementation description: A simple opinionated event store implementation category: Database
test/SuperEvent/Store/HasqlSpec.hs view
@@ -21,6 +21,7 @@ spec = around withTempStore $ do it "should work for simple reads" simpleWriteRead+ it "should work for simple reads to two streams" simpleWriteRead2 it "should work for simple stream reads" simpleWriteReadStream it "should work for simple global reads" simpleWriteReadGlobal it "should work for simple subscriptions" simpleWriteSubStream@@ -37,6 +38,27 @@ guid <- UUID.nextRandom writeRes <- writeToStream store stream EvAny (V.singleton $ entry guid) writeRes `shouldBe` WrSuccess+ evt <- readEvent store stream (nextEventNumber firstEventNumber)+ case evt of+ ErrFailed -> expectationFailure "Read failed"+ ErrValue re -> re_guid re `shouldBe` guid++simpleWriteRead2 ::+ (EventStoreReader IO es, EventStoreWriter IO es)+ => es -> IO ()+simpleWriteRead2 store =+ do let payload :: T.Text+ payload = "Hello"+ entry guid =+ EventData guid (EventType "foo") (toJSON payload) (toJSON ())+ stream = StreamId "text"+ guid <- UUID.nextRandom+ writeRes <- writeToStream store stream EvAny (V.singleton $ entry guid)+ writeRes `shouldBe` WrSuccess+ guid2 <- UUID.nextRandom+ writeRes2 <-+ writeToStream store (StreamId "bar") EvAny (V.singleton $ entry guid2)+ writeRes2 `shouldBe` WrSuccess evt <- readEvent store stream (nextEventNumber firstEventNumber) case evt of ErrFailed -> expectationFailure "Read failed"