Skip to content

Commit

Permalink
Hide test id generator
Browse files Browse the repository at this point in the history
  • Loading branch information
sunesimonsen committed Jun 15, 2023
1 parent db10156 commit 9b93a7c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions id.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ func (_ UlidIdGenerator) NextId() Id {
// Id generator that returns incremental blob ids.
//
// This is only useful for test scenarios.
type TestIdgenerator struct{ nextId int }
type testIdgenerator struct{ nextId int }

// Returns ids of the following form:
//
// blob:0
// blob:1
// blob:2
// ...
func (idGen *TestIdgenerator) NextId() Id {
func (idGen *testIdgenerator) NextId() Id {
id := Id(fmt.Sprintf("blob:%d", idGen.nextId))
idGen.nextId++
return id
Expand Down
2 changes: 1 addition & 1 deletion options_example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func ExampleWithSystemTime() {
func ExampleWithIdGenerator() {
db := fdbConnect()

idGenerator := &TestIdgenerator{}
idGenerator := &testIdgenerator{}
store, err := NewStore(db, testNamespace(), WithIdGenerator(idGenerator))
if err != nil {
log.Fatalln("Could not create store")
Expand Down
6 changes: 3 additions & 3 deletions store_example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func ExampleNewStore() {
}

func ExampleStore_Blob() {
store := createTestStore(WithIdGenerator(&TestIdgenerator{}))
store := createTestStore(WithIdGenerator(&testIdgenerator{}))

r := strings.NewReader("My blob content")
_, err := store.Create(r)
Expand Down Expand Up @@ -112,7 +112,7 @@ func ExampleStore_Create() {
func ExampleStore_DeleteRemovedBlobsBefore() {
db := fdbConnect()

idGenerator := &TestIdgenerator{}
idGenerator := &testIdgenerator{}
store, err := NewStore(db, testNamespace(), WithIdGenerator(idGenerator))
if err != nil {
log.Fatalln("Could not create store")
Expand Down Expand Up @@ -147,7 +147,7 @@ func ExampleStore_DeleteRemovedBlobsBefore() {
func ExampleStore_DeleteUploadsStartedBefore() {
db := fdbConnect()

idGenerator := &TestIdgenerator{}
idGenerator := &testIdgenerator{}
store, err := NewStore(db, testNamespace(), WithIdGenerator(idGenerator))
if err != nil {
log.Fatalln("Could not create store")
Expand Down
2 changes: 1 addition & 1 deletion test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func createTestBlob() *Blob {
date, _ := time.Parse(time.RFC3339, "2023-01-01T00:00:00Z")
st := &SystemTimeMock{Time: date}

store := createTestStore(WithSystemTime(st), WithIdGenerator(&TestIdgenerator{}))
store := createTestStore(WithSystemTime(st), WithIdGenerator(&testIdgenerator{}))

r := strings.NewReader("My blob content")
blob, err := store.Create(r)
Expand Down

0 comments on commit 9b93a7c

Please sign in to comment.