Documentation
¶
Index ¶
- func NewTestDB(t *testing.T) *dbgen.Queries
- func NewTestDBWithSQL(t *testing.T) (*dbgen.Queries, *sql.DB)
- func SeedGrabHistory(t *testing.T, q *dbgen.Queries, movieID, title string) dbgen.GrabHistory
- func SeedLibrary(t *testing.T, q *dbgen.Queries) dbgen.Library
- func SeedLibraryWithProfile(t *testing.T, q *dbgen.Queries, profileID string) dbgen.Library
- func SeedMovie(t *testing.T, q *dbgen.Queries, opts ...MovieOption) dbgen.Movie
- func SeedMovieInLibrary(t *testing.T, q *dbgen.Queries, libraryID, profileID string, ...) dbgen.Movie
- func SeedQualityProfile(t *testing.T, q *dbgen.Queries) dbgen.QualityProfile
- type MovieOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewTestDB ¶
NewTestDB creates a fresh SQLite database with all migrations applied. The database is registered with t.Cleanup to be closed after the test completes. Each call gets its own file under t.TempDir() so tests never share state.
func NewTestDBWithSQL ¶
NewTestDBWithSQL returns both the Queries and the underlying *sql.DB. Use this when you need to execute raw SQL in tests (e.g. for low-level assertions).
func SeedGrabHistory ¶
SeedGrabHistory inserts one grab_history row for movieID and returns it.
func SeedLibrary ¶
SeedLibrary inserts a library backed by a freshly created quality profile.
func SeedLibraryWithProfile ¶
SeedLibraryWithProfile inserts a library using the given quality profile ID.
func SeedMovieInLibrary ¶
func SeedMovieInLibrary(t *testing.T, q *dbgen.Queries, libraryID, profileID string, opts ...MovieOption) dbgen.Movie
SeedMovieInLibrary inserts a movie into the specified library.
func SeedQualityProfile ¶
SeedQualityProfile inserts a quality profile with sensible defaults and returns it. The inserted profile accepts 1080p BluRay releases.
Types ¶
type MovieOption ¶
type MovieOption func(*dbgen.CreateMovieParams)
MovieOption is a functional option for SeedMovie.
func WithMonitored ¶
func WithMonitored(monitored bool) MovieOption
WithMonitored sets the monitored flag on the seeded movie.
func WithTMDBID ¶
func WithTMDBID(id int) MovieOption
WithTMDBID sets the TMDB ID on the seeded movie.