Documentation ¶
Index ¶
- Variables
- func AccountByID(id shared.RepositoryID) (shared.Account, error)
- func Boot(remotes map[shared.RemoteName]shared.Remote) error
- func DebugCleanAllExceptAccounts() error
- func DebugSetEntityMissing(entityID uint64, entityName string, remoteName shared.RemoteName) error
- func RemoteByName(name shared.RemoteName) (shared.Remote, error)
- type Account
- func (e *Account) Actions() (shared.AccountActions, error)
- func (e Account) AddedAt() time.Time
- func (e Account) Alias() string
- func (e Account) Auth() string
- func (e Account) Delete() error
- func (e Account) ID() shared.RepositoryID
- func (e Account) RemoteName() shared.RemoteName
- func (e Account) Repository() (shared.RemoteRepository, error)
- func (e *Account) SetAlias(alias string) error
- func (e *Account) SetAuth(auth string) error
- func (e *Account) Settings() (shared.AccountSettings, error)
- type AccountSettings
- func (e *AccountSettings) LikedAlbums() shared.SynchronizationSettings
- func (e *AccountSettings) LikedArtists() shared.SynchronizationSettings
- func (e *AccountSettings) LikedTracks() shared.SynchronizationSettings
- func (e *AccountSettings) Playlist(playlistID shared.EntityID) (shared.PlaylistSyncSettings, error)
- func (e *AccountSettings) Playlists() shared.SynchronizationSettings
- func (e *AccountSettings) Update(from *AccountSettings) error
- type AccountSyncedPlaylistSettings
- func (e *AccountSyncedPlaylistSettings) Description() shared.SynchronizationSettings
- func (e *AccountSyncedPlaylistSettings) Name() shared.SynchronizationSettings
- func (e *AccountSyncedPlaylistSettings) Tracks() shared.SynchronizationSettings
- func (e *AccountSyncedPlaylistSettings) Visibility() shared.SynchronizationSettings
- type Entity
- type EntityName
- type EntityRepository
- type LinkableEntity
- func (e LinkableEntity) CreateLink(ctx context.Context, eId shared.EntityID, id *shared.RemoteID) (linker.Linked, error)
- func (e LinkableEntity) LinkedEntity(eId shared.EntityID) (linker.Linked, error)
- func (e LinkableEntity) LinkedRemoteID(id shared.RemoteID) (linker.Linked, error)
- func (e LinkableEntity) Links() ([]linker.Linked, error)
- func (e LinkableEntity) NotMatchedCount() (int, error)
- type LinkedEntity
- type Remote
- func (e *Remote) Account(id shared.RepositoryID) (shared.Account, error)
- func (e *Remote) Accounts(ctx context.Context) ([]shared.Account, error)
- func (e Remote) Actions() (shared.RemoteActions, error)
- func (e *Remote) CreateAccount(alias string, auth string) (shared.Account, error)
- func (e Remote) Enabled() bool
- func (e Remote) ID() shared.RepositoryID
- func (e Remote) Name() shared.RemoteName
- func (e *Remote) SetEnabled(val bool) error
- type Snapshot
- func (e *Snapshot) AddPlaylist(name string, description *string, isVisible bool, tracks []shared.RemoteID) (snapshot.Playlist, error)
- func (e Snapshot) Alias() string
- func (e Snapshot) Auto() bool
- func (e Snapshot) CreatedAt() time.Time
- func (e Snapshot) Delete() error
- func (e Snapshot) ID() shared.RepositoryID
- func (e Snapshot) LikedAlbums() ([]shared.RemoteID, error)
- func (e Snapshot) LikedAlbumsCount() (int, error)
- func (e Snapshot) LikedAlbumsRestoreable() bool
- func (e Snapshot) LikedArtists() ([]shared.RemoteID, error)
- func (e Snapshot) LikedArtistsCount() (int, error)
- func (e Snapshot) LikedArtistsRestoreable() bool
- func (e Snapshot) LikedTracks() ([]shared.RemoteID, error)
- func (e Snapshot) LikedTracksCount() (int, error)
- func (e Snapshot) LikedTracksRestoreable() bool
- func (e Snapshot) Playlist(id string) (snapshot.Playlist, error)
- func (e Snapshot) Playlists() ([]snapshot.Playlist, error)
- func (e Snapshot) PlaylistsCount() (int, error)
- func (e Snapshot) PlaylistsRestoreable() bool
- func (e Snapshot) RemoteName() shared.RemoteName
- func (e Snapshot) RestoreLikedAlbums(ctx context.Context, merge bool, action shared.LikedActions) error
- func (e Snapshot) RestoreLikedArtists(ctx context.Context, merge bool, action shared.LikedActions) error
- func (e Snapshot) RestoreLikedTracks(ctx context.Context, merge bool, action shared.LikedActions) error
- func (e Snapshot) RestorePlaylists(ctx context.Context, merge bool, action shared.PlaylistActions) error
- func (e Snapshot) SetAlias(val string) error
- func (e *Snapshot) SetLikedAlbums(ids []shared.RemoteID) error
- func (e *Snapshot) SetLikedArtists(ids []shared.RemoteID) error
- func (e *Snapshot) SetLikedTracks(ids []shared.RemoteID) error
- type SnapshotLiked
- type SnapshotPlaylist
- func (e SnapshotPlaylist) CreatedAt() time.Time
- func (e SnapshotPlaylist) Delete() error
- func (e SnapshotPlaylist) Description() *string
- func (e SnapshotPlaylist) ID() shared.RepositoryID
- func (e SnapshotPlaylist) IsVisible() bool
- func (e SnapshotPlaylist) Name() string
- func (e SnapshotPlaylist) Restore(ctx context.Context, action shared.PlaylistActions) error
- func (e SnapshotPlaylist) SetTracks(ids []shared.RemoteID) error
- func (e SnapshotPlaylist) Tracks() ([]shared.RemoteID, error)
- type Snapshotter
- func (e Snapshotter) Create(in shared.RemoteName, alias string, auto bool) (snapshot.Snapshot, error)
- func (e Snapshotter) DeleteOldestAuto(in shared.RemoteName, max int) error
- func (e Snapshotter) Snapshot(id shared.RepositoryID) (snapshot.Snapshot, error)
- func (e Snapshotter) Snapshots(remote shared.RemoteName, filter snapshot.SnapshotsFilterAuto) ([]snapshot.Snapshot, error)
- type SyncableEntity
- func (e SyncableEntity) CreateSynced(ctx context.Context, id shared.EntityID) (syncer.Synced[bool], error)
- func (e SyncableEntity) DeleteUnsynced() error
- func (e SyncableEntity) Synced(id shared.EntityID) (syncer.Synced[bool], error)
- func (e SyncableEntity) SyncesNewer(ctx context.Context, newerThan time.Time) (map[shared.EntityID]syncer.Synced[bool], error)
- func (e SyncableEntity) SyncesOlder(ctx context.Context, olderThan time.Time) (map[shared.EntityID]syncer.Synced[bool], error)
- type SyncedEntity
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Remotes map[shared.RemoteName]shared.Remote ArtistEntity = NewEntityRepository(EntityNameArtist) AlbumEntity = NewEntityRepository(EntityNameAlbum) TrackEntity = NewEntityRepository(EntityNameTrack) PlaylistEntity = NewEntityRepository(EntityNamePlaylist) ArtistLinkable = NewEntityRepository(EntityNameArtist) AlbumLinkable = NewEntityRepository(EntityNameAlbum) TrackLinkable = NewEntityRepository(EntityNameTrack) ArtistSyncable = NewSyncableEntity(EntityNameArtist) AlbumSyncable = NewSyncableEntity(EntityNameAlbum) TrackSyncable = NewSyncableEntity(EntityNameTrack) PlaylistSyncable = NewSyncableEntity(EntityNamePlaylist) )
Functions ¶
func AccountByID ¶
func AccountByID(id shared.RepositoryID) (shared.Account, 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) 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)
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 (e *AccountSettings) LikedAlbums() shared.SynchronizationSettings
func (*AccountSettings) LikedArtists ¶
func (e *AccountSettings) LikedArtists() shared.SynchronizationSettings
func (*AccountSettings) LikedTracks ¶
func (e *AccountSettings) LikedTracks() shared.SynchronizationSettings
func (*AccountSettings) Playlist ¶
func (e *AccountSettings) Playlist(playlistID shared.EntityID) (shared.PlaylistSyncSettings, error)
func (*AccountSettings) Playlists ¶
func (e *AccountSettings) Playlists() shared.SynchronizationSettings
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 (e *AccountSyncedPlaylistSettings) Description() shared.SynchronizationSettings
func (*AccountSyncedPlaylistSettings) Name ¶
func (e *AccountSyncedPlaylistSettings) Name() shared.SynchronizationSettings
func (*AccountSyncedPlaylistSettings) Tracks ¶
func (e *AccountSyncedPlaylistSettings) Tracks() shared.SynchronizationSettings
func (*AccountSyncedPlaylistSettings) Visibility ¶
func (e *AccountSyncedPlaylistSettings) Visibility() shared.SynchronizationSettings
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 (LinkableEntity) CreateLink ¶
func (LinkableEntity) LinkedEntity ¶
func (LinkableEntity) LinkedRemoteID ¶
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) CreateAccount ¶
func (Remote) ID ¶
func (e Remote) ID() shared.RepositoryID
func (Remote) Name ¶
func (e Remote) Name() shared.RemoteName
func (*Remote) SetEnabled ¶
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 (Snapshot) ID ¶
func (e Snapshot) ID() shared.RepositoryID
func (Snapshot) LikedAlbumsCount ¶
func (Snapshot) LikedAlbumsRestoreable ¶
func (Snapshot) LikedArtistsCount ¶
func (Snapshot) LikedArtistsRestoreable ¶
func (Snapshot) LikedTracksCount ¶
func (Snapshot) LikedTracksRestoreable ¶
func (Snapshot) PlaylistsCount ¶
func (Snapshot) PlaylistsRestoreable ¶
func (Snapshot) RemoteName ¶
func (e Snapshot) RemoteName() shared.RemoteName
func (Snapshot) RestoreLikedAlbums ¶
func (Snapshot) RestoreLikedArtists ¶
func (Snapshot) RestoreLikedTracks ¶
func (Snapshot) RestorePlaylists ¶
type SnapshotLiked ¶
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 (e SnapshotPlaylist) ID() shared.RepositoryID
func (SnapshotPlaylist) IsVisible ¶
func (e SnapshotPlaylist) IsVisible() bool
func (SnapshotPlaylist) Name ¶
func (e SnapshotPlaylist) Name() string
func (SnapshotPlaylist) Restore ¶
func (e SnapshotPlaylist) Restore(ctx context.Context, action shared.PlaylistActions) 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 (e Snapshotter) Snapshot(id shared.RepositoryID) (snapshot.Snapshot, error)
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 (SyncableEntity) CreateSynced ¶
func (SyncableEntity) DeleteUnsynced ¶
func (e SyncableEntity) DeleteUnsynced() error
func (SyncableEntity) SyncesNewer ¶
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]
Click to show internal directories.
Click to hide internal directories.