Documentation ¶
Index ¶
Constants ¶
View Source
const ( DB = "canopsis" ConfigurationMongoCollection = "configuration" RightsMongoCollection = "default_rights" SessionMongoCollection = "session" SessionStatsMongoCollection = "default_session" AlarmMongoCollection = "periodical_alarm" EntityMongoCollection = "default_entities" PbehaviorMongoCollection = "pbehavior" PbehaviorTypeMongoCollection = "pbehavior_type" PbehaviorReasonMongoCollection = "pbehavior_reason" PbehaviorExceptionMongoCollection = "pbehavior_exception" ScenarioMongoCollection = "action_scenario" FileMongoCollection = "files" InstructionMongoCollection = "instruction" InstructionExecutionMongoCollection = "instruction_execution" InstructionRatingMongoCollection = "instruction_rating" JobConfigMongoCollection = "job_config" JobMongoCollection = "job" JobHistoryMongoCollection = "job_history" MetaAlarmRulesMongoCollection = "meta_alarm_rules" HeartbeatMongoCollection = "heartbeat" IdleRuleMongoCollection = "idle_rule" ExportTaskMongoCollection = "export_task" ActionLogMongoCollection = "action_log" EventFilterRulesMongoCollection = "eventfilter" DynamicInfosRulesMongoCollection = "dynamic_infos" WebhookMongoCollection = "webhooks" EntityCategoryMongoCollection = "entity_category" ImportJobMongoCollection = "default_importgraph" JunitTestSuiteMongoCollection = "junit_test_suite" JunitTestCaseMediaMongoCollection = "junit_test_case_media" ViewMongoCollection = "views" ViewGroupMongoCollection = "viewgroups" PlaylistMongoCollection = "view_playlist" StateSettingsMongoCollection = "state_settings" BroadcastMessageMongoCollection = "broadcast_message" AssociativeTableCollection = "default_associativetable" )
View Source
const (
EnvURL = "CPS_MONGO_URL"
)
Variables ¶
This section is empty.
Functions ¶
func IsConnectionError ¶
Types ¶
type Config ¶
type Config struct { // Indexes structure is [collectionName][indexName]indexConfig Indexes map[string]map[string]IndexConfig `yaml:"indexes"` }
Config represents format of config file.
type DbClient ¶
type DbClient interface {
Collection(string) DbCollection
}
DbClient connected MongoDB client settings
type DbCollection ¶
type DbCollection interface { Aggregate(ctx context.Context, pipeline interface{}, opts ...*options.AggregateOptions) (Cursor, error) BulkWrite(ctx context.Context, models []mongo.WriteModel, opts ...*options.BulkWriteOptions) (*mongo.BulkWriteResult, error) CountDocuments(ctx context.Context, filter interface{}, opts ...*options.CountOptions) (int64, error) DeleteOne(ctx context.Context, filter interface{}, opts ...*options.DeleteOptions) (int64, error) DeleteMany(ctx context.Context, filter interface{}, opts ...*options.DeleteOptions) (int64, error) Distinct(ctx context.Context, fieldName string, filter interface{}, opts ...*options.DistinctOptions) ([]interface{}, error) Drop(ctx context.Context) error Find(ctx context.Context, filter interface{}, opts ...*options.FindOptions) (Cursor, error) FindOne(ctx context.Context, filter interface{}, opts ...*options.FindOneOptions) SingleResultHelper FindOneAndDelete(ctx context.Context, filter interface{}, opts ...*options.FindOneAndDeleteOptions) SingleResultHelper FindOneAndReplace(ctx context.Context, filter interface{}, replacement interface{}, opts ...*options.FindOneAndReplaceOptions) SingleResultHelper FindOneAndUpdate(ctx context.Context, filter interface{}, update interface{}, opts ...*options.FindOneAndUpdateOptions) SingleResultHelper Indexes() mongo.IndexView InsertOne(ctx context.Context, document interface{}, opts ...*options.InsertOneOptions) (interface{}, error) InsertMany(ctx context.Context, documents []interface{}, opts ...*options.InsertManyOptions) ([]interface{}, error) ReplaceOne(ctx context.Context, filter interface{}, replacement interface{}, opts ...*options.ReplaceOptions) (*mongo.UpdateResult, error) UpdateMany(ctx context.Context, filter interface{}, update interface{}, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error) UpdateOne(ctx context.Context, filter interface{}, update interface{}, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error) }
type IndexConfig ¶
type IndexConfig struct { Keys map[string]int `yaml:"keys"` Options map[string]interface{} `yaml:"options"` }
IndexConfig represent format of index in config file.
type IndexService ¶
type IndexService interface {
Create() error
}
IndexService is used to implement mongo indexes creations. Base implementation uses config configDir as source of index options.
func NewIndexService ¶
func NewIndexService( dbClient DbClient, configDir string, logger *zerolog.Logger, ) IndexService
NewIndexService creates index service.
Click to show internal directories.
Click to hide internal directories.