repository

package
v0.0.0-...-ec66866 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func AccountByID

func AccountByID(id shared.RepositoryID) (shared.Account, error)

func Boot

func Boot(remotes map[shared.RemoteName]shared.Remote) error

func DebugCleanAllExceptAccounts

func DebugCleanAllExceptAccounts() error

func DebugSetEntityMissing

func DebugSetEntityMissing(entityID uint64, entityName string, remoteName shared.RemoteName) error

func RemoteByName

func RemoteByName(name shared.RemoteName) (shared.Remote, error)

Types

type Account

type Account struct {
	HID         shared.RepositoryID `db:"id"`
	HRemoteName shared.RemoteName   `db:"remote_name"`
	HAuth       string              `db:"auth"`
	HAlias      string              `db:"alias"`
	HAddedAt    int64               `db:"added_at"`
	// contains filtered or unexported fields
}

func (*Account) Actions

func (e *Account) Actions() (shared.AccountActions, error)

func (Account) AddedAt

func (e Account) AddedAt() time.Time

func (Account) Alias

func (e Account) Alias() string

func (Account) Auth

func (e Account) Auth() string

func (Account) Delete

func (e Account) Delete() error

func (Account) ID

func (e Account) ID() shared.RepositoryID

func (Account) RemoteName

func (e Account) RemoteName() shared.RemoteName

func (Account) Repository

func (e Account) Repository() (shared.RemoteRepository, error)

func (*Account) SetAlias

func (e *Account) SetAlias(alias string) error

func (*Account) SetAuth

func (e *Account) SetAuth(auth string) error

func (*Account) Settings

func (e *Account) Settings() (shared.AccountSettings, error)

type AccountSettings

type AccountSettings struct {
	HID        shared.RepositoryID `db:"id"`
	HAccountID shared.RepositoryID `db:"account_id"`

	HSyncLikedAlbums  bool `db:"sync_liked_albums"`
	HSyncLikedArtists bool `db:"sync_liked_artists"`
	HSyncLikedTracks  bool `db:"sync_liked_tracks"`
	HSyncPlaylists    bool `db:"sync_playlists"`

	HLastSyncLikedAlbums  int64 `db:"last_sync_liked_albums"`
	HLastSyncLikedArtists int64 `db:"last_sync_liked_artists"`
	HLastSyncLikedTracks  int64 `db:"last_sync_liked_tracks"`
	HLastSyncPlaylists    int64 `db:"last_sync_playlists"`
}

func (*AccountSettings) LikedAlbums

func (*AccountSettings) LikedArtists

func (*AccountSettings) LikedTracks

func (*AccountSettings) Playlist

func (e *AccountSettings) Playlist(playlistID shared.EntityID) (shared.PlaylistSyncSettings, error)

func (*AccountSettings) Playlists

func (*AccountSettings) Update

func (e *AccountSettings) Update(from *AccountSettings) error

type AccountSyncedPlaylistSettings

type AccountSyncedPlaylistSettings struct {
	HID         shared.RepositoryID `db:"id"`
	HPlaylistID shared.EntityID     `db:"playlist_id"`
	HAccountID  shared.RepositoryID `db:"account_id"`

	HSyncName        bool `db:"sync_name"`
	HSyncDescription bool `db:"sync_description"`
	HSyncVisibility  bool `db:"sync_visibility"`
	HSyncTracks      bool `db:"sync_tracks"`

	HLastSyncName        int64 `db:"last_sync_name"`
	HLastSyncDescription int64 `db:"last_sync_description"`
	HLastSyncVisibility  int64 `db:"last_sync_visibility"`
	HLastSyncTracks      int64 `db:"last_sync_tracks"`
}

func (*AccountSyncedPlaylistSettings) Description

func (*AccountSyncedPlaylistSettings) Name

func (*AccountSyncedPlaylistSettings) Tracks

func (*AccountSyncedPlaylistSettings) Visibility

type Entity

type Entity struct {
	HID shared.EntityID `db:"id"`
}

func (Entity) ID

func (e Entity) ID() shared.EntityID

type EntityName

type EntityName string
const (
	EntityNameArtist   EntityName = "artist"
	EntityNameAlbum    EntityName = "album"
	EntityNameTrack    EntityName = "track"
	EntityNamePlaylist EntityName = "playlist"
)

func (EntityName) String

func (e EntityName) String() string

type EntityRepository

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

func NewEntityRepository

func NewEntityRepository(name EntityName) EntityRepository

Example: artist.

func (EntityRepository) CreateEntity

func (e EntityRepository) CreateEntity() (shared.EntityID, error)

func (EntityRepository) DeleteAll

func (e EntityRepository) DeleteAll() error

func (EntityRepository) DeleteNotLinked

func (e EntityRepository) DeleteNotLinked() error

type LinkableEntity

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

Linkable.

func NewLinkableEntity

func NewLinkableEntity(entityName EntityName, remoteName shared.RemoteName) *LinkableEntity

func NewLinkablePlaylist

func NewLinkablePlaylist(accountID uint64) *LinkableEntity
func (e LinkableEntity) CreateLink(ctx context.Context, eId shared.EntityID, id *shared.RemoteID) (linker.Linked, error)

func (LinkableEntity) LinkedEntity

func (e LinkableEntity) LinkedEntity(eId shared.EntityID) (linker.Linked, error)

func (LinkableEntity) LinkedRemoteID

func (e LinkableEntity) LinkedRemoteID(id shared.RemoteID) (linker.Linked, error)
func (e LinkableEntity) Links() ([]linker.Linked, error)

func (LinkableEntity) NotMatchedCount

func (e LinkableEntity) NotMatchedCount() (int, error)

type LinkedEntity

type LinkedEntity struct {
	HID         shared.RepositoryID `db:"id"`
	HEntityID   shared.EntityID     `db:"entity_id"`
	HRemoteName shared.RemoteName   `db:"remote_name"`
	IdOnRemote  *shared.RemoteID    `db:"id_on_remote"`
	HModifiedAt int64               `db:"modified_at"`
	// contains filtered or unexported fields
}

Linked.

func (LinkedEntity) EntityID

func (e LinkedEntity) EntityID() shared.EntityID

func (LinkedEntity) ModifiedAt

func (e LinkedEntity) ModifiedAt() time.Time

func (LinkedEntity) RemoteID

func (e LinkedEntity) RemoteID() *shared.RemoteID

func (*LinkedEntity) SetRemoteID

func (e *LinkedEntity) SetRemoteID(id *shared.RemoteID) error

type Remote

type Remote struct {
	HID      shared.RepositoryID `db:"id"`
	HName    shared.RemoteName   `db:"name"`
	HEnabled bool                `db:"is_enabled"`
	// contains filtered or unexported fields
}

func (*Remote) Account

func (e *Remote) Account(id shared.RepositoryID) (shared.Account, error)

func (*Remote) Accounts

func (e *Remote) Accounts(ctx context.Context) ([]shared.Account, error)

func (Remote) Actions

func (e Remote) Actions() (shared.RemoteActions, error)

func (*Remote) CreateAccount

func (e *Remote) CreateAccount(alias string, auth string) (shared.Account, error)

func (Remote) Enabled

func (e Remote) Enabled() bool

func (Remote) ID

func (e Remote) ID() shared.RepositoryID

func (Remote) Name

func (e Remote) Name() shared.RemoteName

func (*Remote) SetEnabled

func (e *Remote) SetEnabled(val bool) error

type Snapshot

type Snapshot struct {
	HID                      shared.RepositoryID `db:"id"`
	HRemoteName              shared.RemoteName   `db:"remote_name"`
	HAlias                   string              `db:"alias"`
	HAuto                    bool                `db:"auto"`
	HRestoreableLikedAlbums  bool                `db:"restoreable_liked_albums"`
	HRestoreableLikedArtists bool                `db:"restoreable_liked_artists"`
	HRestoreableLikedTracks  bool                `db:"restoreable_liked_tracks"`
	HRestoreablePlaylists    bool                `db:"restoreable_playlists"`
	HCreatedAt               int64               `db:"created_at"`
}

func (*Snapshot) AddPlaylist

func (e *Snapshot) AddPlaylist(name string,
	description *string,
	isVisible bool,
	tracks []shared.RemoteID) (snapshot.Playlist, error)

func (Snapshot) Alias

func (e Snapshot) Alias() string

func (Snapshot) Auto

func (e Snapshot) Auto() bool

func (Snapshot) CreatedAt

func (e Snapshot) CreatedAt() time.Time

func (Snapshot) Delete

func (e Snapshot) Delete() error

func (Snapshot) ID

func (e Snapshot) ID() shared.RepositoryID

func (Snapshot) LikedAlbums

func (e Snapshot) LikedAlbums() ([]shared.RemoteID, error)

func (Snapshot) LikedAlbumsCount

func (e Snapshot) LikedAlbumsCount() (int, error)

func (Snapshot) LikedAlbumsRestoreable

func (e Snapshot) LikedAlbumsRestoreable() bool

func (Snapshot) LikedArtists

func (e Snapshot) LikedArtists() ([]shared.RemoteID, error)

func (Snapshot) LikedArtistsCount

func (e Snapshot) LikedArtistsCount() (int, error)

func (Snapshot) LikedArtistsRestoreable

func (e Snapshot) LikedArtistsRestoreable() bool

func (Snapshot) LikedTracks

func (e Snapshot) LikedTracks() ([]shared.RemoteID, error)

func (Snapshot) LikedTracksCount

func (e Snapshot) LikedTracksCount() (int, error)

func (Snapshot) LikedTracksRestoreable

func (e Snapshot) LikedTracksRestoreable() bool

func (Snapshot) Playlist

func (e Snapshot) Playlist(id string) (snapshot.Playlist, error)

func (Snapshot) Playlists

func (e Snapshot) Playlists() ([]snapshot.Playlist, error)

func (Snapshot) PlaylistsCount

func (e Snapshot) PlaylistsCount() (int, error)

func (Snapshot) PlaylistsRestoreable

func (e Snapshot) PlaylistsRestoreable() bool

func (Snapshot) RemoteName

func (e Snapshot) RemoteName() shared.RemoteName

func (Snapshot) RestoreLikedAlbums

func (e Snapshot) RestoreLikedAlbums(ctx context.Context, merge bool, action shared.LikedActions) error

func (Snapshot) RestoreLikedArtists

func (e Snapshot) RestoreLikedArtists(ctx context.Context, merge bool, action shared.LikedActions) error

func (Snapshot) RestoreLikedTracks

func (e Snapshot) RestoreLikedTracks(ctx context.Context, merge bool, action shared.LikedActions) error

func (Snapshot) RestorePlaylists

func (e Snapshot) RestorePlaylists(ctx context.Context, merge bool, action shared.PlaylistActions) error

func (Snapshot) SetAlias

func (e Snapshot) SetAlias(val string) error

func (*Snapshot) SetLikedAlbums

func (e *Snapshot) SetLikedAlbums(ids []shared.RemoteID) error

func (*Snapshot) SetLikedArtists

func (e *Snapshot) SetLikedArtists(ids []shared.RemoteID) error

func (*Snapshot) SetLikedTracks

func (e *Snapshot) SetLikedTracks(ids []shared.RemoteID) error

type SnapshotLiked

type SnapshotLiked struct {
	HID         uint64          `db:"id"`
	HSnapshotID uint64          `db:"snapshot_id"`
	HIdOnRemote shared.RemoteID `db:"id_on_remote"`
}

type SnapshotPlaylist

type SnapshotPlaylist struct {
	HID          shared.RepositoryID `db:"id"`
	HSnapshotID  shared.RepositoryID `db:"snapshot_id"`
	HName        string              `db:"name"`
	HIsVisible   bool                `db:"is_visible"`
	HDescription *string             `db:"description"`
	HCreatedAt   int64               `db:"created_at"`
}

func (SnapshotPlaylist) CreatedAt

func (e SnapshotPlaylist) CreatedAt() time.Time

func (SnapshotPlaylist) Delete

func (e SnapshotPlaylist) Delete() error

func (SnapshotPlaylist) Description

func (e SnapshotPlaylist) Description() *string

func (SnapshotPlaylist) ID

func (SnapshotPlaylist) IsVisible

func (e SnapshotPlaylist) IsVisible() bool

func (SnapshotPlaylist) Name

func (e SnapshotPlaylist) Name() string

func (SnapshotPlaylist) Restore

func (SnapshotPlaylist) SetTracks

func (e SnapshotPlaylist) SetTracks(ids []shared.RemoteID) error

func (SnapshotPlaylist) Tracks

func (e SnapshotPlaylist) Tracks() ([]shared.RemoteID, error)

type Snapshotter

type Snapshotter struct {
}
var Snap Snapshotter

func (Snapshotter) Create

func (e Snapshotter) Create(in shared.RemoteName, alias string, auto bool) (snapshot.Snapshot, error)

func (Snapshotter) DeleteOldestAuto

func (e Snapshotter) DeleteOldestAuto(in shared.RemoteName, max int) error

func (Snapshotter) Snapshot

func (Snapshotter) Snapshots

func (e Snapshotter) Snapshots(
	remote shared.RemoteName,
	filter snapshot.SnapshotsFilterAuto,
) ([]snapshot.Snapshot, error)

type SyncableEntity

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

Syncable.

func NewSyncableEntity

func NewSyncableEntity(name EntityName) SyncableEntity

Example: artist.

func (SyncableEntity) CreateSynced

func (e SyncableEntity) CreateSynced(ctx context.Context, id shared.EntityID) (syncer.Synced[bool], error)

func (SyncableEntity) DeleteUnsynced

func (e SyncableEntity) DeleteUnsynced() error

func (SyncableEntity) Synced

func (SyncableEntity) SyncesNewer

func (e SyncableEntity) SyncesNewer(ctx context.Context, newerThan time.Time) (map[shared.EntityID]syncer.Synced[bool], error)

func (SyncableEntity) SyncesOlder

func (e SyncableEntity) SyncesOlder(ctx context.Context, olderThan time.Time) (map[shared.EntityID]syncer.Synced[bool], error)

type SyncedEntity

type SyncedEntity struct {
	HID                 shared.RepositoryID `db:"id"`
	HEntityID           shared.EntityID     `db:"entity_id"`
	HIsSynced           bool                `db:"is_synced"`
	HIsSyncedModifiedAt int64               `db:"is_synced_modified_at"`
	// contains filtered or unexported fields
}

Liked.

func (SyncedEntity) ModifiedAt

func (e SyncedEntity) ModifiedAt() time.Time

func (*SyncedEntity) SyncableParam

func (e *SyncedEntity) SyncableParam() syncer.SyncableParam[bool]

Jump to

Keyboard shortcuts

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