Skip to content

Commit a08cecf

Browse files
committed
return packages in ascending chrological order
1 parent bc61666 commit a08cecf

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Running the binary & tests requires standing up postgres:
1010
```sh
1111
export POSTGRES_USERNAME=postgres
1212
export POSTGRES_PASSWORD=postgres
13-
export POSTGRES_HOST=0.0.0.0
13+
export POSTGRES_HOST=127.0.0.1
1414
export POSTGRES_PORT=55432 # In case 5432 is in use already.
1515
export POSTGRES_DB=index
1616
docker run \

internal/db/db.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func (d *DB) FetchRepoTags(ctx context.Context, since time.Time, limit int64) ([
5252
SELECT org_repo_name, tag_name, module_path, created
5353
FROM repo_tags
5454
WHERE created >= $1
55-
ORDER BY created DESC
55+
ORDER BY created ASC
5656
LIMIT $2;`
5757

5858
rows, err := d.db.QueryContext(ctx, query, since, limit)

internal/db/db_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ func TestFetchRepoTags(t *testing.T) {
1717

1818
allTags := []*db.RepoTag{
1919
// Ordered by Created DESC, which is how we expect it returned.
20-
{OrgRepoName: "foo/gaz", TagName: "v0.0.1", ModulePath: "github.somecompany.net/foo/gaz", Created: time.Now().Add(time.Minute)},
21-
{OrgRepoName: "foo/bar", TagName: "v0.0.2", ModulePath: "github.somecompany.net/foo/bar", Created: time.Now().Add(time.Second)},
2220
{OrgRepoName: "foo/bar", TagName: "v0.0.1", ModulePath: "github.somecompany.net/foo/bar", Created: time.Now()},
21+
{OrgRepoName: "foo/bar", TagName: "v0.0.2", ModulePath: "github.somecompany.net/foo/bar", Created: time.Now().Add(time.Second)},
22+
{OrgRepoName: "foo/gaz", TagName: "v0.0.1", ModulePath: "github.somecompany.net/foo/gaz", Created: time.Now().Add(time.Minute)},
2323
}
2424
populateRepoTags(t, sqlDB, allTags)
2525

0 commit comments

Comments
 (0)