metadata

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package metadata provides access to SQLite databases and collections information.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Registry

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

Registry provides access to SQLite databases and collections information.

func NewRegistry

func NewRegistry(u string, l *zap.Logger) (*Registry, error)

NewRegistry creates a registry for the given directory.

func (*Registry) Close

func (r *Registry) Close()

Close closes the registry.

func (*Registry) CollectionCreate

func (r *Registry) CollectionCreate(ctx context.Context, dbName string, collectionName string) (bool, error)

CollectionCreate creates a collection in the database.

Returned boolean value indicates whether the collection was created. If collection already exists, (false, nil) is returned.

func (*Registry) CollectionDrop

func (r *Registry) CollectionDrop(ctx context.Context, dbName string, collectionName string) (bool, error)

CollectionDrop drops a collection in the database.

Returned boolean value indicates whether the collection was dropped. If database or collection did not exist, (false, nil) is returned.

func (*Registry) CollectionList

func (r *Registry) CollectionList(ctx context.Context, dbName string) ([]string, error)

CollectionList returns a sorted list of collections in the database.

If database does not exist, no error is returned.

func (*Registry) CollectionToTable

func (r *Registry) CollectionToTable(collectionName string) string

CollectionToTable converts FerretDB collection name to SQLite table name.

func (*Registry) DatabaseDrop

func (r *Registry) DatabaseDrop(ctx context.Context, dbName string) bool

DatabaseDrop drops the database.

Returned boolean value indicates whether the database was dropped.

func (*Registry) DatabaseGetExisting

func (r *Registry) DatabaseGetExisting(ctx context.Context, dbName string) *sql.DB

DatabaseGetExisting returns a connection to existing database or nil if it doesn't exist.

func (*Registry) DatabaseGetOrCreate

func (r *Registry) DatabaseGetOrCreate(ctx context.Context, dbName string) (*sql.DB, error)

DatabaseGetOrCreate returns a connection to existing database or newly created database.

func (*Registry) DatabaseList

func (r *Registry) DatabaseList(ctx context.Context) []string

DatabaseList returns a sorted list of existing databases.

Directories

Path Synopsis
Package pool provides access to SQLite database connections.
Package pool provides access to SQLite database connections.

Jump to

Keyboard shortcuts

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