store

package
v1.15.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 15, 2026 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Slugify

func Slugify(rawURL string) string

Slugify turns a studio URL into a safe, human-readable filename stem. e.g. "https://www.manyvids.com/Profile/590705/bettie-bondage/Store/Videos"

→ "manyvids.com-profile-590705-bettie-bondage-store-videos"

func WriteCSV

func WriteCSV(scenes []models.Scene, path string) error

func WriteJSON

func WriteJSON(sf studioFile, path string) error

Types

type Flat

type Flat struct {
	// contains filtered or unexported fields
}

Flat is the default store backed by a per-studio JSON file on disk. JSON is always written — it is the backing format for incremental updates. CSV is written as an additional export when included in formats.

func NewFlat

func NewFlat(dir string, formats []string) *Flat

func (*Flat) Export

func (f *Flat) Export(_, _, _ string) error

Export is a no-op for the flat store — files are written directly by Save.

func (*Flat) ListStudios

func (f *Flat) ListStudios() ([]models.Studio, error)

ListStudios is a no-op for the flat store.

func (*Flat) Load

func (f *Flat) Load(studioURL string) ([]models.Scene, error)

func (*Flat) MarkDeleted

func (f *Flat) MarkDeleted(studioURL, _ string, ids []string) error

func (*Flat) Save

func (f *Flat) Save(studioURL string, scenes []models.Scene) error

func (*Flat) UpsertStudio

func (f *Flat) UpsertStudio(_ models.Studio) error

UpsertStudio is a no-op for the flat store — studio tracking requires SQLite.

type SQLite

type SQLite struct {
	// contains filtered or unexported fields
}

SQLite is the optional store backed by a SQLite database. Enabled with the --db flag. JSON/CSV are exported from it on request.

func NewSQLite

func NewSQLite(path string) (*SQLite, error)

func (*SQLite) Close

func (s *SQLite) Close() error

func (*SQLite) Export

func (s *SQLite) Export(format, path, studioURL string) error

func (*SQLite) ListStudios

func (s *SQLite) ListStudios() ([]models.Studio, error)

func (*SQLite) Load

func (s *SQLite) Load(studioURL string) ([]models.Scene, error)

func (*SQLite) MarkDeleted

func (s *SQLite) MarkDeleted(studioURL, siteID string, ids []string) error

func (*SQLite) Save

func (s *SQLite) Save(studioURL string, scenes []models.Scene) error

func (*SQLite) UpsertStudio

func (s *SQLite) UpsertStudio(studio models.Studio) error

type Store

type Store interface {
	// Load returns all scenes previously scraped for this studio URL.
	Load(studioURL string) ([]models.Scene, error)

	// Save persists the full scene list for a studio URL, replacing any prior data.
	Save(studioURL string, scenes []models.Scene) error

	// MarkDeleted soft-deletes scenes by ID — sets DeletedAt, does not remove records.
	MarkDeleted(studioURL, siteID string, ids []string) error

	// Export writes scenes for a studio URL to a file in the given format ("json" or "csv").
	// Used when SQLite is the source of truth and flat files are requested as output.
	Export(format, path, studioURL string) error

	// UpsertStudio records or updates a studio entry. No-op for the flat store.
	UpsertStudio(studio models.Studio) error

	// ListStudios returns all known studios. Empty for the flat store.
	ListStudios() ([]models.Studio, error)
}

Store is the persistence layer. The default implementation uses flat JSON/CSV files. An optional SQLite-backed implementation is selected with the --db flag.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL