struct

Episode

Inherits Struct < Value < Object

Constants

EF_SEARCH = 200

pgvector hnsw.ef_search for the recs kNN. 200 gives ~near-exact recall@20 on the current corpus; pinned by scripts/verify-recs-hnsw.sh. Code literal (SET LOCAL takes no bind params) — not user input.

Constructors

new(id : Int64, feed_id : Int64, guid : String, title : String, description : Nil | String, audio_url : String, duration_sec : Int32 | Nil, published_at : Time | Nil, image_url : Nil | String = nil)
Source

Class methods

completed_ids(user_id : Int64, feed_id : Int64) : Set(Int64)
Source
completed_ids_for_user(user_id : Int64) : Set(Int64)
Source
find(id : Int64) : Episode | Nil
Source
for_feed(feed_id : Int64, limit : Int32 = 50, offset : Int32 = 0, order : String = "desc") : Array(Episode)
Source
for_inbox(user_id : Int64, limit : Int32 = 100, offset : Int32 = 0) : Array(Episode)
Source
for_inbox_semantic(user_id : Int64, query_vec : Array(Float64), limit : Int32 = 100, offset : Int32 = 0) : Array(Episode)
Source
for_topic(user_id : Int64, tag : String, limit : Int32 = 100, offset : Int32 = 0) : Array(Episode)
Source
in_progress_for_user(user_id : Int64) : Tuple(Episode, Int32) | Nil
Source
liked_for_user(user_id : Int64, limit : Int32 = 50, offset : Int32 = 0) : Array(Episode)
Source
next_in_feed(feed_id : Int64, current_id : Int64, order : String = "desc") : Int64 | Nil
Source
original_language(id : Int64) : String | Nil
Source
save_original_language(id : Int64, lang_code : String)
Source
save_transcript(id : Int64, text : String)
Source
search_for_user(user_id : Int64, query : String, limit : Int32 = 30) : Array(Episode)
Source
transcript(id : Int64) : String | Nil
Source
upsert(feed_id : Int64, guid : String, title : String, description : String | Nil, audio_url : String, duration_sec : Int32 | Nil, published_at : Time | Nil, image_url : String | Nil = nil) : UpsertResult | Nil

Insert-or-update an episode. Returns nil only if neither path runs (current SQL guarantees a row either way; the nil branch is for safety against future schema/constraint changes). The was_inserted flag uses the standard Postgres trick: xmax is 0 on a fresh INSERT and set to the deleter's xid on an UPDATE-from-conflict.

Source

Instance methods

audio_url
Source
audio_url=(audio_url : String)
Source
description
Source
description=(description : String | Nil)
Source
duration_display
Source
duration_sec
Source
duration_sec=(duration_sec : Int32 | Nil)
Source
feed_id
Source
feed_id=(feed_id : Int64)
Source
guid
Source
guid=(guid : String)
Source
id=(id : Int64)
Source
image_url
Source
image_url=(image_url : String | Nil)
Source
published_at
Source
published_at=(published_at : Time | Nil)
Source
title
Source
title=(title : String)
Source

Nested types