Documentation ¶
Overview ¶
Package metadata provides access to SQLite databases and collections information.
Index ¶
- Constants
- type Collection
- type Registry
- func (r *Registry) Close()
- func (r *Registry) Collect(ch chan<- prometheus.Metric)
- func (r *Registry) CollectionCreate(ctx context.Context, dbName, collectionName string) (bool, error)
- func (r *Registry) CollectionDrop(ctx context.Context, dbName, collectionName string) (bool, error)
- func (r *Registry) CollectionGet(ctx context.Context, dbName, collectionName string) *Collection
- func (r *Registry) CollectionList(ctx context.Context, dbName string) ([]string, error)
- func (r *Registry) CollectionRename(ctx context.Context, dbName, oldCollectionName, newCollectionName string) (bool, error)
- func (r *Registry) DatabaseDrop(ctx context.Context, dbName string) bool
- func (r *Registry) DatabaseGetExisting(ctx context.Context, dbName string) *fsql.DB
- func (r *Registry) DatabaseGetOrCreate(ctx context.Context, dbName string) (*fsql.DB, error)
- func (r *Registry) DatabaseList(ctx context.Context) []string
- func (r *Registry) Describe(ch chan<- *prometheus.Desc)
Constants ¶
const ( // IDColumn is a SQLite path expression for _id field. IDColumn = "_ferretdb_sjson->'$._id'" // DefaultColumn is a column name for all fields expect _id. DefaultColumn = "_ferretdb_sjson" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Collection ¶ added in v1.7.0
Collection represents collection metadata.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry provides access to SQLite databases and collections information.
Exported methods are safe for concurrent use. Unexported methods are not.
func NewRegistry ¶
NewRegistry creates a registry for SQLite databases in the directory specified by SQLite URI.
func (*Registry) Collect ¶ added in v1.7.0
func (r *Registry) Collect(ch chan<- prometheus.Metric)
Collect implements prometheus.Collector.
func (*Registry) CollectionCreate ¶
func (r *Registry) CollectionCreate(ctx context.Context, dbName, 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 ¶
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) CollectionGet ¶ added in v1.7.0
func (r *Registry) CollectionGet(ctx context.Context, dbName, collectionName string) *Collection
CollectionGet returns collection metadata.
If database or collection does not exist, 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) CollectionRename ¶ added in v1.9.0
func (r *Registry) CollectionRename(ctx context.Context, dbName, oldCollectionName, newCollectionName string) (bool, error)
CollectionRename renames a collection in the database.
Returned boolean value indicates whether the collection was renamed. If database or collection did not exist, (false, nil) is returned.
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.
func (*Registry) DatabaseList ¶
DatabaseList returns a sorted list of existing databases.
func (*Registry) Describe ¶ added in v1.7.0
func (r *Registry) Describe(ch chan<- *prometheus.Desc)
Describe implements prometheus.Collector.