Documentation ¶
Overview ¶
Package metadata provides access to SQLite databases and collections information.
Index ¶
- type Registry
- func (r *Registry) Close()
- func (r *Registry) CollectionCreate(ctx context.Context, dbName string, collectionName string) (bool, error)
- func (r *Registry) CollectionDrop(ctx context.Context, dbName string, collectionName string) (bool, error)
- func (r *Registry) CollectionList(ctx context.Context, dbName string) ([]string, error)
- func (r *Registry) CollectionToTable(collectionName string) string
- func (r *Registry) DatabaseDrop(ctx context.Context, dbName string) bool
- func (r *Registry) DatabaseGetExisting(ctx context.Context, dbName string) *sql.DB
- func (r *Registry) DatabaseGetOrCreate(ctx context.Context, dbName string) (*sql.DB, error)
- func (r *Registry) DatabaseList(ctx context.Context) []string
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 ¶
NewRegistry creates a registry for the given directory.
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 ¶
CollectionList returns a sorted list of collections in the database.
If database does not exist, no error is returned.
func (*Registry) CollectionToTable ¶
CollectionToTable converts FerretDB collection name to SQLite table name.
func (*Registry) DatabaseDrop ¶
DatabaseDrop drops the database.
Returned boolean value indicates whether the database was dropped.
func (*Registry) DatabaseGetExisting ¶
DatabaseGetExisting returns a connection to existing database or nil if it doesn't exist.
func (*Registry) DatabaseGetOrCreate ¶
DatabaseGetOrCreate returns a connection to existing database or newly created database.