-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add hotness queries and scaffolding for materializer (#25)
also reformatted some sql
- Loading branch information
Showing
9 changed files
with
359 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package hotness | ||
|
||
import ( | ||
"github.com/strideynet/bsky-furry-feed/store" | ||
"go.uber.org/zap" | ||
) | ||
|
||
type Materializer struct { | ||
log *zap.Logger | ||
store *store.PGXStore | ||
} | ||
|
||
func NewMaterializer( | ||
log *zap.Logger, store *store.PGXStore, | ||
) *Materializer { | ||
return &Materializer{ | ||
log: log, | ||
store: store, | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
DROP TABLE post_hotness; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
CREATE TABLE post_hotness ( | ||
uri TEXT PRIMARY KEY, | ||
alg TEXT NOT NULL, | ||
score REAL NOT NULL, | ||
generated_at TIMESTAMPTZ NOT NULL DEFAULT NOW() | ||
); | ||
CREATE INDEX post_hotness_alg_score_idx ON post_hotness (alg, score); | ||
CREATE INDEX post_hotness_alg_generated_at_idx ON post_hotness ( | ||
alg, generated_at | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.