MCPcopy Index your code
hub / github.com/cameri/nostream / applySelectiveFilters

Function applySelectiveFilters

src/clean-db.ts:161–173  ·  view source on GitHub ↗
(query: Knex.QueryBuilder, options: CleanDbOptions)

Source from the content-addressed store, hash-verified

159}
160
161const applySelectiveFilters = (query: Knex.QueryBuilder, options: CleanDbOptions): Knex.QueryBuilder => {
162 if (options.olderThanDays !== undefined) {
163 const olderThanSeconds = options.olderThanDays * 24 * 60 * 60
164 const cutoff = Math.floor(Date.now() / 1000) - olderThanSeconds
165 query.where('event_created_at', '<', cutoff)
166 }
167
168 if (options.kinds.length) {
169 query.whereIn('event_kind', options.kinds)
170 }
171
172 return query
173}
174
175const getMatchingEventsCount = async (dbClient: Knex, options: CleanDbOptions): Promise<number> => {
176 const query = dbClient('events')

Callers 2

getMatchingEventsCountFunction · 0.85
runSelectiveDeleteFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected