sqlite

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package sqlite provides SQLite database storage for clonr.

Package sqlite provides SQLite database storage for clonr.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Migration

type Migration struct {
	Version     int
	Description string
	UpSQL       string
	DownSQL     string
}

Migration represents a database migration.

type MigrationRecord

type MigrationRecord struct {
	Version     int
	AppliedAt   time.Time
	Description string
}

MigrationRecord represents a record in the schema_migrations table.

type Migrator

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

Migrator handles database migrations.

func NewMigrator

func NewMigrator(db *sql.DB) *Migrator

NewMigrator creates a new migration handler.

func (*Migrator) AppliedMigrations

func (m *Migrator) AppliedMigrations() ([]MigrationRecord, error)

AppliedMigrations returns all applied migrations.

func (*Migrator) CurrentVersion

func (m *Migrator) CurrentVersion() (int, error)

CurrentVersion returns the current schema version.

func (*Migrator) LoadMigrations

func (m *Migrator) LoadMigrations() ([]Migration, error)

LoadMigrations loads all migrations from the embedded filesystem.

func (*Migrator) MigrateDown

func (m *Migrator) MigrateDown() error

MigrateDown rolls back the last migration.

func (*Migrator) MigrateTo

func (m *Migrator) MigrateTo(targetVersion int) error

MigrateTo migrates to a specific version.

func (*Migrator) MigrateUp

func (m *Migrator) MigrateUp() error

MigrateUp applies all pending migrations.

func (*Migrator) PendingMigrations

func (m *Migrator) PendingMigrations() ([]Migration, error)

PendingMigrations returns migrations that have not been applied.

type Store

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

Store implements the store.Store interface using SQLite.

func GetDB

func GetDB() *Store

GetDB returns the singleton SQLite store instance.

func New

func New(dbPath string) (*Store, error)

New creates a new SQLite store with the given database path.

func (*Store) Close

func (s *Store) Close() error

Close closes the database connection.

func (*Store) DeleteProfile

func (s *Store) DeleteProfile(name string) error

func (*Store) DeleteRegisteredClient

func (s *Store) DeleteRegisteredClient(clientID string) error

func (*Store) DeleteStandaloneClient

func (s *Store) DeleteStandaloneClient(id string) error

func (*Store) DeleteStandaloneConfig

func (s *Store) DeleteStandaloneConfig() error

func (*Store) DeleteStandaloneConnection

func (s *Store) DeleteStandaloneConnection(name string) error

func (*Store) DeleteSyncedData

func (s *Store) DeleteSyncedData(connectionName, dataType, name string) error

func (*Store) DeleteWorkspace

func (s *Store) DeleteWorkspace(name string) error

func (*Store) GetActiveProfile

func (s *Store) GetActiveProfile() (*model.Profile, error)

func (*Store) GetActiveWorkspace

func (s *Store) GetActiveWorkspace() (*model.Workspace, error)

func (*Store) GetAllRepos

func (s *Store) GetAllRepos() ([]*model.Repository, error)

func (*Store) GetConfig

func (s *Store) GetConfig() (*model.Config, error)

func (*Store) GetPendingRegistration

func (s *Store) GetPendingRegistration(clientID string) (*standalone.ClientRegistration, error)

func (*Store) GetProfile

func (s *Store) GetProfile(name string) (*model.Profile, error)

func (*Store) GetRegisteredClient

func (s *Store) GetRegisteredClient(clientID string) (*standalone.RegisteredClient, error)

func (*Store) GetRepos

func (s *Store) GetRepos(workspace string, favoritesOnly bool) ([]*model.Repository, error)

func (*Store) GetReposByWorkspace

func (s *Store) GetReposByWorkspace(workspace string) ([]*model.Repository, error)

func (*Store) GetServerEncryptionConfig

func (s *Store) GetServerEncryptionConfig() (*standalone.ServerEncryptionConfig, error)

func (*Store) GetStandaloneClients

func (s *Store) GetStandaloneClients() ([]*standalone.Client, error)

func (*Store) GetStandaloneConfig

func (s *Store) GetStandaloneConfig() (*standalone.StandaloneConfig, error)

func (*Store) GetStandaloneConnection

func (s *Store) GetStandaloneConnection(name string) (*standalone.StandaloneConnection, error)

func (*Store) GetSyncedData

func (s *Store) GetSyncedData(connectionName, dataType, name string) (*standalone.SyncedData, error)

func (*Store) GetWorkspace

func (s *Store) GetWorkspace(name string) (*model.Workspace, error)

func (*Store) InsertRepoIfNotExists

func (s *Store) InsertRepoIfNotExists(u *url.URL, path string) error

func (*Store) ListPendingRegistrations

func (s *Store) ListPendingRegistrations() ([]*standalone.ClientRegistration, error)

func (*Store) ListProfiles

func (s *Store) ListProfiles() ([]*model.Profile, error)

func (*Store) ListRegisteredClients

func (s *Store) ListRegisteredClients() ([]*standalone.RegisteredClient, error)

func (*Store) ListStandaloneConnections

func (s *Store) ListStandaloneConnections() ([]*standalone.StandaloneConnection, error)

func (*Store) ListSyncedData

func (s *Store) ListSyncedData(connectionName string) ([]*standalone.SyncedData, error)

func (*Store) ListSyncedDataByState

func (s *Store) ListSyncedDataByState(state standalone.SyncState) ([]*standalone.SyncedData, error)

func (*Store) ListWorkspaces

func (s *Store) ListWorkspaces() ([]*model.Workspace, error)

func (*Store) Ping

func (s *Store) Ping() error

Ping checks if the database is accessible.

func (*Store) ProfileExists

func (s *Store) ProfileExists(name string) (bool, error)

func (*Store) RemovePendingRegistration

func (s *Store) RemovePendingRegistration(clientID string) error

func (*Store) RemoveRepoByURL

func (s *Store) RemoveRepoByURL(u *url.URL) error

func (*Store) RepoExistsByPath

func (s *Store) RepoExistsByPath(path string) (bool, error)

func (*Store) RepoExistsByURL

func (s *Store) RepoExistsByURL(u *url.URL) (bool, error)

func (*Store) SaveConfig

func (s *Store) SaveConfig(cfg *model.Config) error

func (*Store) SavePendingRegistration

func (s *Store) SavePendingRegistration(reg *standalone.ClientRegistration) error

func (*Store) SaveProfile

func (s *Store) SaveProfile(profile *model.Profile) error

func (*Store) SaveRegisteredClient

func (s *Store) SaveRegisteredClient(client *standalone.RegisteredClient) error

func (*Store) SaveRepo

func (s *Store) SaveRepo(u *url.URL, path string) error

func (*Store) SaveRepoWithWorkspace

func (s *Store) SaveRepoWithWorkspace(u *url.URL, path, workspace string) error

func (*Store) SaveServerEncryptionConfig

func (s *Store) SaveServerEncryptionConfig(config *standalone.ServerEncryptionConfig) error

func (*Store) SaveStandaloneClient

func (s *Store) SaveStandaloneClient(client *standalone.Client) error

func (*Store) SaveStandaloneConfig

func (s *Store) SaveStandaloneConfig(config *standalone.StandaloneConfig) error

func (*Store) SaveStandaloneConnection

func (s *Store) SaveStandaloneConnection(conn *standalone.StandaloneConnection) error

func (*Store) SaveSyncedData

func (s *Store) SaveSyncedData(data *standalone.SyncedData) error

func (*Store) SaveWorkspace

func (s *Store) SaveWorkspace(workspace *model.Workspace) error

func (*Store) SetActiveProfile

func (s *Store) SetActiveProfile(name string) error

func (*Store) SetActiveWorkspace

func (s *Store) SetActiveWorkspace(name string) error

func (*Store) SetFavoriteByURL

func (s *Store) SetFavoriteByURL(urlStr string, fav bool) error

func (*Store) UpdateRepoTimestamp

func (s *Store) UpdateRepoTimestamp(urlStr string) error

func (*Store) UpdateRepoWorkspace

func (s *Store) UpdateRepoWorkspace(urlStr, workspace string) error

func (*Store) WorkspaceExists

func (s *Store) WorkspaceExists(name string) (bool, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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