instance

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CollectionStats

type CollectionStats struct {
	Ns              string  `bson:"ns" json:"ns"`
	Size            int64   `bson:"size" json:"size"`
	Count           int64   `bson:"count" json:"count"`
	AvgObjSize      float64 `bson:"avgObjSize" json:"avgObjSize"`
	NumOrphanDocs   int64   `bson:"numOrphanDocs" json:"numOrphanDocs"`
	StorageSize     int64   `bson:"storageSize" json:"storageSize"`
	FreeStorageSize int64   `bson:"freeStorageSize" json:"freeStorageSize"`
	Nindexes        int64   `bson:"nindexes" json:"nindexes"`
	TotalIndexSize  int64   `bson:"totalIndexSize" json:"totalIndexSize"`
	TotalSize       int64   `bson:"totalSize" json:"totalSize"`
}

type Config

type Config struct {
	ConnectionString string `json:"connectionString"`
	DatabaseName     string `json:"databaseName"`
}

type DBStats

type DBStats struct {
	Db                   string  `bson:"db" json:"db"`
	Collections          int64   `bson:"collections" json:"collections"`
	Views                int64   `bson:"views" json:"views"`
	Objects              int64   `bson:"objects" json:"objects"`
	AvgObjSize           float64 `bson:"avgObjSize" json:"avgObjSize"`
	DataSize             int64   `bson:"dataSize" json:"dataSize"`
	StorageSize          int64   `bson:"storageSize" json:"storageSize"`
	FreeStorageSize      int64   `bson:"freeStorageSize" json:"freeStorageSize"`
	Indexes              int64   `bson:"indexes" json:"indexes"`
	IndexSize            int64   `bson:"indexSize" json:"indexSize"`
	IndexFreeStorageSize int64   `bson:"indexFreeStorageSize" json:"indexFreeStorageSize"`
	TotalSize            int64   `bson:"totalSize" json:"totalSize"`
	TotalFreeStorageSize int64   `bson:"totalFreeStorageSize" json:"totalFreeStorageSize"`
	ScaleFactor          int64   `bson:"scaleFactor" json:"scaleFactor"`
	FsUsedSize           int64   `bson:"fsUsedSize" json:"fsUsedSize"`
	FsTotalSize          int64   `bson:"fsTotalSize" json:"fsTotalSize"`
}

type Instance

type Instance interface {
	GetName() string
	GetDBStats(ctx context.Context) (*DBStats, error)
	GetDBCollectionNames(ctx context.Context) ([]string, error)
	GetDBCollectionStats(ctx context.Context, collectionName string) (*CollectionStats, error)
	Find(ctx context.Context, collectionName string, query []byte, limit int64, sort string) ([]bson.D, error)
	Count(ctx context.Context, collectionName string, query []byte) (int64, error)
	FindOne(ctx context.Context, collectionName, filter string) (*bson.M, error)
}

func New

func New(name string, options map[string]any) (Instance, error)

Jump to

Keyboard shortcuts

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