mongo_pool_service

package
v0.0.0-...-7bb60f4 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetTimeRangeFilter

func GetTimeRangeFilter(from string, to string) (bson.M, error)

func GetTimeRangeFilterWithPatientUID

func GetTimeRangeFilterWithPatientUID(patientUID string, from string, to string) (bson.M, error)

func GetUIDFilter

func GetUIDFilter(uid string) (bson.M, error)

func LoadConfig

func LoadConfig(filePath *string) map[string]MongoConfig

Types

type MongoConfig

type MongoConfig struct {
	Nickname           string `json:"nickname"`
	Hostname           string `json:"hostname"`
	Port               int    `json:"port"`
	User               string `json:"user"`
	Password           string `json:"password"`
	Database           string `json:"database"`
	ConnectionPoolSize int    `json:"connectionPoolSize"`
}

type MongoConnectionPool

type MongoConnectionPool struct {
	InputChannel chan MongoLogData
	// contains filtered or unexported fields
}

func NewMongoConnectionPool

func NewMongoConnectionPool(conf MongoConfig) *MongoConnectionPool

func (*MongoConnectionPool) Run

func (s *MongoConnectionPool) Run()

func (*MongoConnectionPool) Terminate

func (s *MongoConnectionPool) Terminate()

type MongoDBServer

type MongoDBServer struct {
	PoolIdx        int
	Hostname       string
	Port           int
	User           string
	Password       string
	Uri            string
	Client         *mongo.Client
	LogDataChannel (chan MongoLogData)
}

func NewMongoDBServer

func NewMongoDBServer(poolIdx int, conf MongoConfig) *MongoDBServer

func (*MongoDBServer) Connect

func (mongodb *MongoDBServer) Connect() *mongo.Client

Connect DB

func (*MongoDBServer) Disconnect

func (mongodb *MongoDBServer) Disconnect(client *mongo.Client)

Disconnect DB

func (*MongoDBServer) InsertOne

func (mongodb *MongoDBServer) InsertOne(data *MongoLogData) error

type MongoLogData

type MongoLogData struct {
	HostNickname string      `json:hostnickname`
	Database     string      `json:database`
	Collection   string      `json:collection`
	Timestamp    string      `json:timestamp`
	Data         interface{} `json:data`
}

type MongoService

type MongoService struct {
	MongoDbConfigs map[string]MongoConfig
	// contains filtered or unexported fields
}

func New

func New(configFilePath *string) *MongoService

func (*MongoService) GetInputChannel

func (s *MongoService) GetInputChannel(hostnickname string) (chan MongoLogData, error)

func (*MongoService) Init

func (s *MongoService) Init(configFilePath *string)

func (*MongoService) PutData

func (s *MongoService) PutData(data *MongoLogData) error

Jump to

Keyboard shortcuts

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