Documentation
¶
Index ¶
- Constants
- Variables
- func BuildClientOptions(config ClientConfig) (*options.ClientOptions, error)
- func CompareServerVersions(a, b string) (int, error)
- func GetCollectionNames(ctx context.Context, client *mongo.Client, databaseName string) ([]string, error)
- func GetDatabaseNames(ctx context.Context, client *mongo.Client) ([]string, error)
- func GetTopologyType(ctx context.Context, client *mongo.Client) (string, error)
- func ValidateCollections(ctx context.Context, client *mongo.Client, tables []*common.QualifiedTable) error
- func ValidateOplogRetention(ctx context.Context, client *mongo.Client) error
- func ValidateServerCompatibility(ctx context.Context, client *mongo.Client) error
- func ValidateUserRoles(ctx context.Context, client *mongo.Client) error
- type AuthInfo
- type BuildInfo
- type ClientConfig
- type CollStats
- type ConnectionStatus
- type HelloResponse
- type OpTime
- type OpTimes
- type OplogTruncation
- type ReplSetStatus
- type Role
- type ServerStatus
- type StorageEngine
Constants ¶
View Source
const ( ReadPreferencePrimary = "primary" ReadPreferencePrimaryPreferred = "primaryPreferred" ReadPreferenceSecondary = "secondary" ReadPreferenceSecondaryPreferred = "secondaryPreferred" ReadPreferenceNearest = "nearest" )
View Source
const ( MinSupportedVersion = "4.4.0" MinOplogRetentionHours = 24 ReplicaSet = "ReplicaSet" ShardedCluster = "ShardedCluster" AtlasDomain = ".mongodb.net" DocumentDBDomain = "docdb.amazonaws.com" )
Variables ¶
View Source
var RequiredRoles = [...]string{"readAnyDatabase", "clusterMonitor"}
Functions ¶
func BuildClientOptions ¶
func BuildClientOptions(config ClientConfig) (*options.ClientOptions, error)
func CompareServerVersions ¶
func GetCollectionNames ¶
func GetCollectionNames(ctx context.Context, client *mongo.Client, databaseName string) ([]string, error)
Filter out views and system collections after listing all collections. Some MongoDB Atlas tiers (e.g., free tier) don't support regex filters in ListCollections.
func GetDatabaseNames ¶
Filter out system databases after listing all databases. Some MongoDB Atlas tiers (e.g., free tier) don't support regex filters in ListDatabases.
func GetTopologyType ¶
func ValidateCollections ¶
func ValidateOplogRetention ¶
Types ¶
type AuthInfo ¶
type AuthInfo struct {
AuthenticatedUserRoles []Role `bson:"authenticatedUserRoles"`
}
type ClientConfig ¶
type ClientConfig struct {
Uri string
Username string
Password string
ReadPreference string
DisableTls bool
SkipCertVerification bool
RootCa string
TlsHost string
CreateTlsConfigFunc func(minVersion uint16, rootCAs string, host string, tlsHost string, skipCertVerification bool) (*tls.Config, error)
Dialer options.ContextDialer
}
type CollStats ¶
type ConnectionStatus ¶
type ConnectionStatus struct {
AuthInfo AuthInfo `bson:"authInfo"`
}
func GetConnectionStatus ¶
type HelloResponse ¶
type HelloResponse struct {
Msg string `bson:"msg,omitempty"`
Hosts []string `bson:"hosts,omitempty"`
}
func GetHelloResponse ¶
type OplogTruncation ¶
type OplogTruncation struct {
OplogMinRetentionHours float64 `bson:"oplogMinRetentionHours"`
}
type ReplSetStatus ¶
type ReplSetStatus struct {
OpTimes OpTimes `bson:"optimes"`
}
func GetReplSetStatus ¶
type ServerStatus ¶
type ServerStatus struct {
StorageEngine StorageEngine `bson:"storageEngine"`
OplogTruncation OplogTruncation `bson:"oplogTruncation"`
Host string `bson:"host"`
}
func GetServerStatus ¶
type StorageEngine ¶
type StorageEngine struct {
Name string `bson:"name"`
}
Click to show internal directories.
Click to hide internal directories.