{"modulePath":"github.com/operator-framework/operator-registry","version":"v1.74.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package sqlite\n\n## Constants\n\n```go\nconst (\n\tConfigMapCRDName     = \"customResourceDefinitions\"\n\tConfigMapCSVName     = \"clusterServiceVersions\"\n\tConfigMapPackageName = \"packages\"\n)\n```\n\n```go\nconst (\n\tDefaultMigrationsTable = \"schema_migrations\"\n\tNilVersion             = -1\n)\n```\n\n```go\nconst ClusterServiceVersionKind = \"ClusterServiceVersion\"\n```\n\n## Variables\n\n```go\nvar DeprecationMessage = fmt.Sprintf(noticeColor, `DEPRECATION NOTICE:\nSqlite-based catalogs and their related subcommands are deprecated. Support for\nthem will be removed in a future release. Please migrate your catalog workflows\nto the new file-based catalog format.`)\n```\n\n## Functions\n\n```go\nfunc EnableForeignKeys(fileName string) string\n```\nEnableForeignKeys appends the option to enable foreign keys on connections note that without this option, PRAGMAs about foreign keys will lie.\n\n```go\nfunc EnableImmutable(fileName string) string\n```\nImmutable appends the option to mark the db immutable on connections\n\n```go\nfunc LogSqliteDeprecation()\n```\n\n```go\nfunc Open(fileName string) (*sql.DB, error)\n```\nOpen opens a connection to a sqlite db. It should be used everywhere instead of sql.Open so that foreign keys are ensured.\n\n```go\nfunc OpenReadOnly(fileName string) (*sql.DB, error)\n```\nOpen opens a connection to a sqlite db. It is\n\n```go\nfunc ToModel(ctx context.Context, q *SQLQuerier) (model.Model, error)\n```\n\n## Types\n\n```go\ntype BundleDeprecator struct {\n\t// contains filtered or unexported fields\n}\n```\nBundleDeprecator removes bundles from the database\n\n```go\nfunc NewSQLDeprecatorForBundles(store registry.Load, bundles []string) *BundleDeprecator\n```\n\n```go\nfunc (d *BundleDeprecator) Deprecate() error\n```\n\n```go\ntype ConfigMapLoader struct {\n\t// contains filtered or unexported fields\n}\n```\nConfigMapLoader loads a configmap of resources into the database entries under \"customResourceDefinitions\" will be parsed as CRDs entries under \"clusterServiceVersions\"  will be parsed as CSVs entries under \"packages\" will be parsed as Packages\n\n```go\nfunc NewSQLLoaderForConfigMap(store registry.Load, configMap corev1.ConfigMap) *ConfigMapLoader\n```\n\n```go\nfunc NewSQLLoaderForConfigMapData(logger *logrus.Entry, store registry.Load, configMapData map[string]string) *ConfigMapLoader\n```\nNewSQLLoaderForConfigMapData is useful when the operator manifest(s) originate from a different source than a configMap. For example, operator manifest(s) can be downloaded from a remote registry like quay.io.\n\n```go\nfunc (c *ConfigMapLoader) Populate() error\n```\n\n```go\ntype DbOption func(*DbOptions)\n```\n\n```go\nfunc WithEnableAlpha(enableAlpha bool) DbOption\n```\n\n```go\nfunc WithMigratorBuilder(m func(loader *sql.DB) (Migrator, error)) DbOption\n```\n\n```go\ntype DbOptions struct {\n\t// MigratorBuilder is a function that returns a migrator instance\n\tMigratorBuilder func(*sql.DB) (Migrator, error)\n\tEnableAlpha     bool\n}\n```\n\n```go\ntype DeprecationAwareLoader struct {\n\t// contains filtered or unexported fields\n}\n```\nDeprecationAwareLoader understands how bundle deprecations are handled in SQLite and decorates the sqlLoader with proxy methods that handle deprecation related table housekeeping.\n\n```go\nfunc NewDeprecationAwareLoader(db *sql.DB, opts ...DbOption) (*DeprecationAwareLoader, error)\n```\nNewDeprecationAwareLoader returns a new DeprecationAwareLoader.\n\n```go\nfunc (s DeprecationAwareLoader) AddBundlePackageChannels(manifest registry.PackageManifest, bundle *registry.Bundle) error\n```\n\n```go\nfunc (s DeprecationAwareLoader) AddBundleSemver(graph *registry.Package, bundle *registry.Bundle) error\n```\n\n```go\nfunc (s DeprecationAwareLoader) AddOperatorBundle(bundle *registry.Bundle) error\n```\n\n```go\nfunc (s DeprecationAwareLoader) AddPackageChannels(manifest registry.PackageManifest) error\n```\n\n```go\nfunc (s DeprecationAwareLoader) AddPackageChannelsFromGraph(graph *registry.Package) error\n```\n\n```go\nfunc (s DeprecationAwareLoader) ClearNonHeadBundles() error\n```\n\n```go\nfunc (s DeprecationAwareLoader) DeprecateBundle(path string) error\n```\n\n```go\nfunc (s DeprecationAwareLoader) Migrate(ctx context.Context) error\n```\n\n```go\nfunc (s DeprecationAwareLoader) RemoveOverwrittenChannelHead(pkg, bundle string) error\n```\nRemoveOverwrittenChannelHead removes a bundle if it is the channel head and has nothing replacing it\n\n```go\nfunc (d *DeprecationAwareLoader) RemovePackage(pkg string) error\n```\n\n```go\nfunc (s DeprecationAwareLoader) RemoveStrandedBundles() error\n```\n\n```go\ntype DirectoryLoader struct {\n\t// contains filtered or unexported fields\n}\n```\nDirectoryLoader loads a directory of resources into the database\n\n```go\nfunc NewSQLLoaderForDirectory(store registry.Load, directory string) *DirectoryLoader\n```\n\n```go\nfunc (d *DirectoryLoader) LoadBundleWalkFunc(path string, f os.FileInfo, _ error) error\n```\nLoadBundleWalkFunc walks the directory. When it sees a \\`.clusterserviceversion.yaml\\` file, it attempts to load the surrounding files in the same directory as a bundle, and stores them in the db for querying\n\n```go\nfunc (d *DirectoryLoader) LoadPackagesWalkFunc(path string, f os.FileInfo, _ error) error\n```\nLoadPackagesWalkFunc attempts to unmarshal the file at the given path into a PackageManifest resource. If unmarshaling is successful, the PackageManifest is added to the loader's store.\n\n```go\nfunc (d *DirectoryLoader) Populate() error\n```\n\n```go\ntype MigratableLoader interface {\n\tregistry.Load\n\tMigrate(context.Context) error\n}\n```\n\n```go\nfunc NewSQLLiteLoader(db *sql.DB, opts ...DbOption) (MigratableLoader, error)\n```\n\n```go\ntype Migrator interface {\n\tMigrate(ctx context.Context) error\n\tUp(ctx context.Context, migrations migrations.Migrations) error\n\tDown(ctx context.Context, migrations migrations.Migrations) error\n}\n```\n\n```go\nfunc NewSQLLiteMigrator(db *sql.DB) (Migrator, error)\n```\nNewSQLLiteMigrator returns a SQLLiteMigrator.\n\n```go\ntype PackageDeprecator struct {\n\t*BundleDeprecator\n\t// contains filtered or unexported fields\n}\n```\nPackageDeprecator removes bundles and optionally entire packages from the index\n\n```go\nfunc NewSQLDeprecatorForBundlesAndPackages(deprecator *BundleDeprecator, querier *SQLQuerier) *PackageDeprecator\n```\n\n```go\nfunc (d *PackageDeprecator) MaybeRemovePackages() error\n```\nMaybeRemovePackages queries the DB to establish if any provided bundles are the head of the default channel of a package. If so, the list of bundles must also contain the head of all other channels in the package, otherwise an error is produced. If the heads of all channels are being deprecated (including the default channel), the package is removed entirely from the index. MaybeRemovePackages deletes all bundles from the associated package from the bundles array, so that the subsequent Deprecate() call can proceed with deprecating other potential bundles from other packages.\n\n```go\ntype PackageRemover struct {\n\t// contains filtered or unexported fields\n}\n```\nPackageRemover removes a package from the database\n\n```go\nfunc NewSQLRemoverForPackages(store registry.Load, packages string) *PackageRemover\n```\n\n```go\nfunc (d *PackageRemover) Remove() error\n```\n\n```go\ntype Querier interface {\n\tQueryContext(ctx context.Context, query string, args ...interface{}) (RowScanner, error)\n}\n```\n\n```go\ntype RowScanner interface {\n\tNext() bool\n\tClose() error\n\tScan(dest ...interface{}) error\n}\n```\n\n```go\ntype SQLDeprecator interface {\n\tDeprecate() error\n}\n```\n\n```go\ntype SQLGraphLoader struct {\n\tQuerier registry.Query\n}\n```\n\n```go\nfunc NewSQLGraphLoader(dbFilename string) (*SQLGraphLoader, error)\n```\n\n```go\nfunc NewSQLGraphLoaderFromDB(db *sql.DB) (*SQLGraphLoader, error)\n```\n\n```go\nfunc (g *SQLGraphLoader) Generate(packageName string) (*registry.Package, error)\n```\n\n```go\ntype SQLLiteMigrator struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (m *SQLLiteMigrator) Down(ctx context.Context, migrations migrations.Migrations) error\n```\n\n```go\nfunc (m *SQLLiteMigrator) Migrate(ctx context.Context) error\n```\nMigrate gets the current version from the database, the latest version from the migrations, and migrates up the the latest\n\n```go\nfunc (m *SQLLiteMigrator) Up(ctx context.Context, migrations migrations.Migrations) error\n```\nUp runs a specific set of migrations.\n\n```go\ntype SQLPopulator interface {\n\tPopulate() error\n}\n```\n\n```go\ntype SQLQuerier struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc NewSQLLiteQuerier(dbFilename string, opts ...SQLiteQuerierOption) (*SQLQuerier, error)\n```\n\n```go\nfunc NewSQLLiteQuerierFromDBQuerier(q Querier, opts ...SQLiteQuerierOption) *SQLQuerier\n```\n\n```go\nfunc NewSQLLiteQuerierFromDb(db *sql.DB, opts ...SQLiteQuerierOption) *SQLQuerier\n```\n\n```go\nfunc (s *SQLQuerier) BundlePathForChannelHead(ctx context.Context, pkg string, channel string) (string, error)\n```\nBundlePathForChannelHead returns the bundlepath for the given package and channel\n\n```go\nfunc (s *SQLQuerier) GetApisForEntry(ctx context.Context, entryID int64) ([]*api.GroupVersionKind, []*api.GroupVersionKind, error)\n```\n\n```go\nfunc (s *SQLQuerier) GetBundle(ctx context.Context, pkgName, channelName, csvName string) (*api.Bundle, error)\n```\n\n```go\nfunc (s *SQLQuerier) GetBundleForChannel(ctx context.Context, pkg string, channel string) (*api.Bundle, error)\n```\n\n```go\nfunc (s *SQLQuerier) GetBundlePathIfExists(ctx context.Context, bundleName string) (string, error)\n```\n\n```go\nfunc (s *SQLQuerier) GetBundlePathsForPackage(ctx context.Context, pkgName string) ([]string, error)\n```\n\n```go\nfunc (s *SQLQuerier) GetBundleThatProvides(ctx context.Context, group, apiVersion, kind string) (*api.Bundle, error)\n```\nGet the the latest bundle that provides the API in a default channel, error unless there is ONLY one\n\n```go\nfunc (s *SQLQuerier) GetBundleThatReplaces(ctx context.Context, name, pkgName, channelName string) (*api.Bundle, error)\n```\n\n```go\nfunc (s *SQLQuerier) GetBundleVersion(ctx context.Context, image string) (string, error)\n```\n\n```go\nfunc (s *SQLQuerier) GetBundlesForPackage(ctx context.Context, pkgName string) (map[registry.BundleKey]struct{}, error)\n```\n\n```go\nfunc (s *SQLQuerier) GetChannelEntriesFromPackage(ctx context.Context, packageName string) ([]registry.ChannelEntryAnnotated, error)\n```\n\n```go\nfunc (s *SQLQuerier) GetChannelEntriesThatProvide(ctx context.Context, group, version, kind string) ([]*registry.ChannelEntry, error)\n```\n\n```go\nfunc (s *SQLQuerier) GetChannelEntriesThatReplace(ctx context.Context, name string) ([]*registry.ChannelEntry, error)\n```\n\n```go\nfunc (s *SQLQuerier) GetCurrentCSVNameForChannel(ctx context.Context, pkgName, channel string) (string, error)\n```\n\n```go\nfunc (s *SQLQuerier) GetDefaultChannelForPackage(ctx context.Context, pkgName string) (string, error)\n```\n\n```go\nfunc (s *SQLQuerier) GetDefaultPackage(ctx context.Context, name string) (string, error)\n```\n\n```go\nfunc (s *SQLQuerier) GetDependenciesForBundle(ctx context.Context, name, version, path string) ([]*api.Dependency, error)\n```\n\n```go\nfunc (s *SQLQuerier) GetImagesForBundle(ctx context.Context, csvName string) ([]string, error)\n```\n\n```go\nfunc (s *SQLQuerier) GetLatestChannelEntriesThatProvide(ctx context.Context, group, version, kind string) ([]*registry.ChannelEntry, error)\n```\nGet latest channel entries that provide an api\n\n```go\nfunc (s *SQLQuerier) GetPackage(ctx context.Context, name string) (*registry.PackageManifest, error)\n```\n\n```go\nfunc (s *SQLQuerier) GetPropertiesForBundle(ctx context.Context, name, version, path string) ([]*api.Property, error)\n```\n\n```go\nfunc (s *SQLQuerier) ListBundles(ctx context.Context) ([]*api.Bundle, error)\n```\n\n```go\nfunc (s *SQLQuerier) ListChannels(ctx context.Context, pkgName string) ([]string, error)\n```\n\n```go\nfunc (s *SQLQuerier) ListImages(ctx context.Context) ([]string, error)\n```\n\n```go\nfunc (s *SQLQuerier) ListPackages(ctx context.Context) ([]string, error)\n```\nListPackages returns a list of package names as strings\n\n```go\nfunc (s *SQLQuerier) ListRegistryBundles(ctx context.Context) ([]*registry.Bundle, error)\n```\nListRegistryBundles returns a set of registry bundles. The set can be filtered by package by setting the given context's 'package' key to a desired package name. e.g. ctx := ContextWithPackage(context.TODO(), \"etcd\") bundles, err := querier.ListRegistryBundles(ctx) // ...\n\n```go\nfunc (s *SQLQuerier) ListTables(ctx context.Context) ([]string, error)\n```\n\n```go\nfunc (s *SQLQuerier) PackageFromDefaultChannelHeadBundle(ctx context.Context, bundle string) (string, error)\n```\nPackageFromDefaultChannelHeadBundle returns the package name if the provided bundle is the head of its default channel.\n\n```go\nfunc (s *SQLQuerier) SendBundles(ctx context.Context, stream registry.BundleSender) error\n```\n\n```go\ntype SQLRemover interface {\n\tRemove() error\n}\n```\n\n```go\ntype SQLStrandedBundleRemover interface {\n\tRemove() error\n}\n```\n\n```go\ntype SQLiteQuerierOption func(*querierConfig)\n```\n\n```go\nfunc OmitManifests(b bool) SQLiteQuerierOption\n```\nIf true, ListBundles will omit inline manifests (the object and csvJson fields) from response elements that contain a bundle image reference.\n\n```go\ntype StrandedBundleRemover struct {\n\t// contains filtered or unexported fields\n}\n```\nStrandedBundleRemover removes stranded bundles from the database\n\n```go\nfunc NewSQLStrandedBundleRemover(store registry.Load) *StrandedBundleRemover\n```\n\n```go\nfunc (d *StrandedBundleRemover) Remove() error\n```\n\n","path":"github.com/operator-framework/operator-registry/pkg/sqlite","name":"sqlite","synopsis":"","isRedistributable":true}
