appdb

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: Apache-2.0 Imports: 32 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadMasterKey

func LoadMasterKey(dataDir string, engine Engine) ([]byte, error)

Types

type BackupManifest

type BackupManifest struct {
	Format        string           `json:"format"`
	Version       string           `json:"version"`
	Engine        Engine           `json:"engine"`
	SchemaVersion int              `json:"schema_version"`
	CreatedAt     time.Time        `json:"created_at"`
	RowsByTable   map[string]int64 `json:"rows_by_table"`
	Sensitive     bool             `json:"sensitive"`
}

type Config

type Config struct {
	Engine          Engine
	DSN             string
	Path            string
	Host            string
	Port            int
	Database        string
	Schema          string
	Username        string
	Password        string
	TLSMode         string
	CAFile          string
	AppVersion      string
	ConnectTimeout  time.Duration
	MaxOpenConns    int
	MaxIdleConns    int
	ConnMaxLifetime time.Duration
}

func ConfigFromEnv

func ConfigFromEnv(dataDir, appVersion string) (Config, error)

func (Config) Validate

func (c Config) Validate() error

type Engine

type Engine string
const (
	EngineSQLite   Engine = "sqlite"
	EnginePostgres Engine = "postgres"
	EngineMySQL    Engine = "mysql"
)

type Store

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

func Open

func Open(path string) (*Store, error)

func OpenConfig

func OpenConfig(cfg Config) (*Store, error)

func OpenWithVersion

func OpenWithVersion(path, appVersion string) (*Store, error)

func (*Store) APIKeyByHash

func (s *Store) APIKeyByHash(hash string) (core.APIKey, error)

func (*Store) APIKeys

func (s *Store) APIKeys() core.APIKeyStore

func (*Store) AcquireLease

func (s *Store) AcquireLease(ctx context.Context, name, owner string, ttl time.Duration) (bool, error)

func (*Store) AddLineage

func (s *Store) AddLineage(edge core.LineageEdge) error

func (*Store) AddMember

func (s *Store) AddMember(groupID, userID string) error

func (*Store) AlertByID

func (s *Store) AlertByID(id string) (core.Alert, error)

func (*Store) Alerts

func (s *Store) Alerts() core.AlertStore

func (*Store) Bookmarks

func (s *Store) Bookmarks() core.BookmarkStore

func (*Store) ByEmail

func (s *Store) ByEmail(email string) (core.User, error)

func (*Store) ByID

func (s *Store) ByID(id string) (core.User, error)

func (*Store) Close

func (s *Store) Close() error

func (*Store) CollectionByID

func (s *Store) CollectionByID(id string) (core.Collection, error)

func (*Store) Collections

func (s *Store) Collections() core.CollectionStore

func (*Store) ConnectionSecrets

func (s *Store) ConnectionSecrets(key []byte) (core.ConnectionSecretStore, error)

func (*Store) Create

func (s *Store) Create(user core.User) error

func (*Store) CreateAPIKey

func (s *Store) CreateAPIKey(key core.APIKey) error

func (*Store) CreateAlert

func (s *Store) CreateAlert(a core.Alert) error

func (*Store) CreateBookmark

func (s *Store) CreateBookmark(b core.Bookmark) error

func (*Store) CreateCollection

func (s *Store) CreateCollection(c core.Collection) error

func (*Store) CreateDashboard

func (s *Store) CreateDashboard(d core.Dashboard) error

func (*Store) CreateGlossary

func (s *Store) CreateGlossary(term core.GlossaryTerm) error

func (*Store) CreateGroup

func (s *Store) CreateGroup(group core.Group) error

func (*Store) CreateMetric

func (s *Store) CreateMetric(m core.Metric) error

func (*Store) CreateModel

func (s *Store) CreateModel(m core.Model) error

func (*Store) CreateNotification

func (s *Store) CreateNotification(n core.Notification) error

func (*Store) CreateQuestion

func (s *Store) CreateQuestion(q core.Question) error

func (*Store) CreateRevision

func (s *Store) CreateRevision(r core.Revision) error

func (*Store) CreateRun

func (s *Store) CreateRun(item core.Run) error

func (*Store) CreateSchedule

func (s *Store) CreateSchedule(item core.Schedule) error

func (*Store) CreateSegment

func (s *Store) CreateSegment(seg core.Segment) error

func (*Store) CreateSession

func (s *Store) CreateSession(session core.Session) error

func (*Store) CreateSubscription

func (s *Store) CreateSubscription(item core.Subscription) error

func (*Store) DashboardByID

func (s *Store) DashboardByID(id string) (core.Dashboard, error)

func (*Store) DashboardByPublicUUID

func (s *Store) DashboardByPublicUUID(uuid string) (core.Dashboard, error)

func (*Store) Dashboards

func (s *Store) Dashboards() core.DashboardStore

func (*Store) Delete

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

func (*Store) DeleteAPIKey

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

func (*Store) DeleteAlert

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

func (*Store) DeleteBookmark

func (s *Store) DeleteBookmark(id, userID string) error

func (*Store) DeleteCollection

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

func (*Store) DeleteExpired

func (s *Store) DeleteExpired(now time.Time) error

func (*Store) DeleteSession

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

func (*Store) DeleteSnapshot

func (s *Store) DeleteSnapshot(databaseID string) error

func (*Store) DeleteSubscription

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

func (*Store) DeleteUploadedTable

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

func (*Store) Engine

func (s *Store) Engine() Engine

func (*Store) ExportLogical

func (s *Store) ExportLogical(ctx context.Context, writer io.Writer, version string) (BackupManifest, error)

ExportLogical writes a consistent, engine-neutral ZIP. Each table is a JSONL stream whose first row declares columns; remaining rows contain values.

func (*Store) Fields

func (s *Store) Fields() core.FieldStore

func (*Store) Get

func (s *Store) Get(key string) (string, bool, error)

func (*Store) GetSnapshot

func (s *Store) GetSnapshot(databaseID string) (core.SchemaSnapshot, error)

func (*Store) GetTableAnnotation

func (s *Store) GetTableAnnotation(databaseID, schema, table string) (core.TableAnnotation, error)

func (*Store) Glossary

func (s *Store) Glossary() core.GlossaryStore

func (*Store) Groups

func (s *Store) Groups() core.GroupStore

func (*Store) GroupsForUser

func (s *Store) GroupsForUser(userID string) ([]core.Group, error)

func (*Store) HasMember

func (s *Store) HasMember(groupID, userID string) (bool, error)

func (*Store) ImportCatalog

func (s *Store) ImportCatalog(items []core.Database) error

func (*Store) IsCollectionSharedWith

func (s *Store) IsCollectionSharedWith(collectionID, userID string) (bool, error)

func (*Store) Lineage

func (s *Store) Lineage() core.LineageStore

func (*Store) List

func (s *Store) List() ([]core.Database, error)

func (*Store) ListAPIKeys

func (s *Store) ListAPIKeys(userID string) ([]core.APIKey, error)

func (*Store) ListAlerts

func (s *Store) ListAlerts() ([]core.Alert, error)

func (*Store) ListAllAPIKeys

func (s *Store) ListAllAPIKeys() ([]core.APIKey, error)

func (*Store) ListAllNotifications

func (s *Store) ListAllNotifications() ([]core.Notification, error)

func (*Store) ListBookmarks

func (s *Store) ListBookmarks(userID string) ([]core.Bookmark, error)

func (*Store) ListCollectionShares

func (s *Store) ListCollectionShares(collectionID string) ([]core.CollectionShare, error)

func (*Store) ListCollections

func (s *Store) ListCollections() ([]core.Collection, error)

func (*Store) ListDashboards

func (s *Store) ListDashboards(includeArchived bool) ([]core.Dashboard, error)

func (*Store) ListDatabaseFields

func (s *Store) ListDatabaseFields(databaseID string) ([]core.FieldMeta, error)

func (*Store) ListFields

func (s *Store) ListFields(databaseID, schema, table string) ([]core.FieldMeta, error)

func (*Store) ListGlossary

func (s *Store) ListGlossary() ([]core.GlossaryTerm, error)

func (*Store) ListGroups

func (s *Store) ListGroups() ([]core.Group, error)

func (*Store) ListLineage

func (s *Store) ListLineage(entityType, id string) ([]core.LineageEdge, error)

func (*Store) ListMaterializedTables

func (s *Store) ListMaterializedTables() ([]core.MaterializedTable, error)

func (*Store) ListMaterializedTablesByDatabase

func (s *Store) ListMaterializedTablesByDatabase(databaseID string) ([]core.MaterializedTable, error)

func (*Store) ListMetrics

func (s *Store) ListMetrics() ([]core.Metric, error)

func (*Store) ListModels

func (s *Store) ListModels() ([]core.Model, error)

func (*Store) ListNotifications

func (s *Store) ListNotifications(userID string) ([]core.Notification, error)

func (*Store) ListQuestions

func (s *Store) ListQuestions(includeArchived bool) ([]core.Question, error)

func (*Store) ListRevisions

func (s *Store) ListRevisions(targetType, targetID string) ([]core.Revision, error)

func (*Store) ListRuns

func (s *Store) ListRuns(scheduleID string) ([]core.Run, error)

func (*Store) ListScheduleSummaries

func (s *Store) ListScheduleSummaries() ([]core.ScheduleSummary, error)

ListScheduleSummaries reads one indexed run per plan, including plans that have never produced a materialized table. Compiled SQL stays in run history.

func (*Store) ListSchedules

func (s *Store) ListSchedules() ([]core.Schedule, error)

func (*Store) ListSegments

func (s *Store) ListSegments() ([]core.Segment, error)

func (*Store) ListSubscriptions

func (s *Store) ListSubscriptions() ([]core.Subscription, error)

func (*Store) ListSubscriptionsByDashboard

func (s *Store) ListSubscriptionsByDashboard(dashboardID string) ([]core.Subscription, error)

func (*Store) ListUploadedTables

func (s *Store) ListUploadedTables() ([]core.UploadedTable, error)

func (*Store) ListUsers

func (s *Store) ListUsers() ([]core.User, error)

func (*Store) Materialized

func (s *Store) Materialized() core.MaterializedTableStore

func (*Store) MaterializedTableByTarget

func (s *Store) MaterializedTableByTarget(databaseID, schema, name string) (core.MaterializedTable, error)

func (*Store) MetricByID

func (s *Store) MetricByID(id string) (core.Metric, error)

func (*Store) Metrics

func (s *Store) Metrics() core.MetricStore

func (*Store) MigrateSQLiteToProduction

func (s *Store) MigrateSQLiteToProduction(ctx context.Context, targetConfig Config) (TransferReport, error)

MigrateSQLiteToProduction copies a consistent snapshot into a freshly initialized PostgreSQL or MySQL application database. It never switches the running process; operators must apply the returned configuration and restart.

func (*Store) ModelByID

func (s *Store) ModelByID(id string) (core.Model, error)

func (*Store) Models

func (s *Store) Models() core.ModelStore

func (*Store) Notifications

func (s *Store) Notifications() core.NotificationStore

func (*Store) Ping

func (s *Store) Ping(ctx context.Context) error

func (*Store) PreviewUploadedTable

func (s *Store) PreviewUploadedTable(ctx context.Context, id string) (core.UploadedTablePreview, error)

Old and new uploads store the sheet as a JSON array. Read a bounded prefix so opening a preview never transfers the full sheet to the server.

func (*Store) ProductionMigrationCompleted

func (s *Store) ProductionMigrationCompleted() (bool, string, error)

func (*Store) PublicDashboardAccess

func (s *Store) PublicDashboardAccess(ctx context.Context, uuid string) (core.DashboardPublicAccess, error)

PublicDashboardAccess checks access without reading the dashboard's contents. The card and metadata handlers check the same condition when loading the dashboard snapshot used for the request.

func (*Store) PublicDashboardPageAvailable

func (s *Store) PublicDashboardPageAvailable(ctx context.Context, uuid string, embed bool) (bool, error)

func (*Store) QuestionByID

func (s *Store) QuestionByID(id string) (core.Question, error)

func (*Store) Questions

func (s *Store) Questions() core.QuestionStore

func (*Store) ReleaseLease

func (s *Store) ReleaseLease(ctx context.Context, name, owner string) error

func (*Store) ReplaceCollectionShares

func (s *Store) ReplaceCollectionShares(collectionID string, userIDs []string) error

func (*Store) ReplaceMembers

func (s *Store) ReplaceMembers(groupID string, userIDs []string) error

func (*Store) Revisions

func (s *Store) Revisions() core.RevisionStore

func (*Store) Runs

func (s *Store) Runs() core.RunStore

func (*Store) Save

func (s *Store) Save(database core.Database) error

func (*Store) SaveField

func (s *Store) SaveField(field core.FieldMeta) error

func (*Store) SaveSnapshot

func (s *Store) SaveSnapshot(item core.SchemaSnapshot) error

func (*Store) SaveTableAnnotation

func (s *Store) SaveTableAnnotation(databaseID, schema, table string, annotation core.TableAnnotation) error

func (*Store) SaveUploadedTable

func (s *Store) SaveUploadedTable(item core.UploadedTable, rows [][]string) error

func (*Store) ScheduleByID

func (s *Store) ScheduleByID(id string) (core.Schedule, error)

func (*Store) Schedules

func (s *Store) Schedules() core.ScheduleStore

func (*Store) SchemaVersion

func (s *Store) SchemaVersion() int

func (*Store) Search

func (s *Store) Search(query string) ([]core.SearchHit, error)

func (*Store) SegmentByID

func (s *Store) SegmentByID(id string) (core.Segment, error)

func (*Store) Segments

func (s *Store) Segments() core.SegmentStore

func (*Store) SessionByID

func (s *Store) SessionByID(id string) (core.Session, error)

func (*Store) Sessions

func (s *Store) Sessions() core.SessionStore

func (*Store) Set

func (s *Store) Set(key, value string) error

func (*Store) SetActive

func (s *Store) SetActive(id string, active bool) error

func (*Store) SetDashboardArchived

func (s *Store) SetDashboardArchived(id string, archivedAt *time.Time) error

func (*Store) SetPassword

func (s *Store) SetPassword(id, passwordHash string) error

func (*Store) SetQuestionArchived

func (s *Store) SetQuestionArchived(id string, archivedAt *time.Time) error

func (*Store) SubscriptionByID

func (s *Store) SubscriptionByID(id string) (core.Subscription, error)

func (*Store) Subscriptions

func (s *Store) Subscriptions() core.SubscriptionStore

func (*Store) UpdateAlert

func (s *Store) UpdateAlert(a core.Alert) error

func (*Store) UpdateCollection

func (s *Store) UpdateCollection(c core.Collection) error

func (*Store) UpdateDashboard

func (s *Store) UpdateDashboard(d core.Dashboard) error

func (*Store) UpdateModel

func (s *Store) UpdateModel(m core.Model) error

func (*Store) UpdateQuestion

func (s *Store) UpdateQuestion(q core.Question) error

func (*Store) UpdateRun

func (s *Store) UpdateRun(item core.Run) error

func (*Store) UpdateSchedule

func (s *Store) UpdateSchedule(item core.Schedule) error

func (*Store) UpdateSubscription

func (s *Store) UpdateSubscription(item core.Subscription) error

func (*Store) UpdateUserProfile

func (s *Store) UpdateUserProfile(id, name, email, locale, theme, avatarURL string) error

func (*Store) UpsertGroup

func (s *Store) UpsertGroup(group core.Group) error

func (*Store) UpsertMaterializedTable

func (s *Store) UpsertMaterializedTable(item core.MaterializedTable) error

func (*Store) UserByFeishuOpenID

func (s *Store) UserByFeishuOpenID(openID string) (core.User, error)

func (*Store) Users

func (s *Store) Users() core.UserStore

type TransferReport

type TransferReport struct {
	SourceEngine    Engine           `json:"source_engine"`
	TargetEngine    Engine           `json:"target_engine"`
	Tables          int              `json:"tables"`
	Rows            int64            `json:"rows"`
	RowsByTable     map[string]int64 `json:"rows_by_table"`
	CompletedAt     time.Time        `json:"completed_at"`
	RestartRequired bool             `json:"restart_required"`
}

Jump to

Keyboard shortcuts

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