dbapi

package module
v0.0.0-...-4c79784 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

README

README

This library provides APIs to access CAMARA models based DB. The underlying DB used in MongoDB.

Documentation

Index

Constants

View Source
const (
	COLLECTION_CAMARA_QOD_PROV_SESSION    = "camara.qod.provisionedData.session"
	COLLECTION_CAMARA_QOD_SERVICE_SESSION = "camara.qod.service.session"
	COLLECTION_CAMARA_QOD_SERVICE_UE_FLOW = "camara.qod.service.ueflow"
)
View Source
const (
	DB_CONNECT_TIMEOUT_SECS    = 10
	DB_DISCONNECT_TIMEOUT_SECS = 5
	DB_GETMANY_TIMEOUT_SECS    = 30
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DbApi

type DbApi struct {
	// contains filtered or unexported fields
}

func NewDbApi

func NewDbApi(dbName, dbUrl string) *DbApi

func (*DbApi) Connect

func (d *DbApi) Connect() error

Connect to DB

func (*DbApi) DeleteCamaraQoDServiceUeSession

func (d *DbApi) DeleteCamaraQoDServiceUeSession(sessionId string) (int, error)

func (*DbApi) Disconnect

func (d *DbApi) Disconnect()

Disconnect

func (*DbApi) DropDb

func (d *DbApi) DropDb()

Drop DB

func (*DbApi) GetAllCamaraQoDServiceUeFlows

func (d *DbApi) GetAllCamaraQoDServiceUeFlows() (*[]db.ServiceQoDUeFlow, error)

func (*DbApi) GetAllCamaraQoDServiceUeSession

func (d *DbApi) GetAllCamaraQoDServiceUeSession(ueIpv4Addr, scsAsId, qosProfile string) (*[]db.ServiceQoDUeSession, error)

func (*DbApi) GetCamaraProvQoDAppServerData

func (d *DbApi) GetCamaraProvQoDAppServerData(asIpv4Addr string) (*db.ProvQoDAppServerData, error)

Get Provisioned UE data with asIpv4Addr as key

func (*DbApi) GetCamaraQoDServiceIncrementUeFlow

func (d *DbApi) GetCamaraQoDServiceIncrementUeFlow(ueIpv4Addr, scsAsId string) (*db.ServiceQoDUeFlow, error)

func (*DbApi) GetCamaraQoDServiceUeFlow

func (d *DbApi) GetCamaraQoDServiceUeFlow(ueIpv4Addr, scsAsId string) (*db.ServiceQoDUeFlow, error)

func (*DbApi) GetCamaraQoDServiceUeSession

func (d *DbApi) GetCamaraQoDServiceUeSession(sessionId string) (*db.ServiceQoDUeSession, error)

func (*DbApi) GetNumCamaraQoDSericeUeSessions

func (d *DbApi) GetNumCamaraQoDSericeUeSessions(ueIpv4Addr, scsAsId string) (int, error)

func (*DbApi) GetWrapper

func (d *DbApi) GetWrapper() *DbClient

func (*DbApi) PutCamaraProvQoDAppServerData

func (d *DbApi) PutCamaraProvQoDAppServerData(asIpv4Addr string, data *db.ProvQoDAppServerData) (int, error)

func (*DbApi) PutCamaraQoDServiceUeFlow

func (d *DbApi) PutCamaraQoDServiceUeFlow(ueIpv4Addr, scsAsId string, data *db.ServiceQoDUeFlow) (int, error)

func (*DbApi) PutCamaraQoDServiceUeSession

func (d *DbApi) PutCamaraQoDServiceUeSession(ueIpv4Addr, sessionId string, data *db.ServiceQoDUeSession) (int, error)

func (*DbApi) PutManyCamaraProvQoDAppServerData

func (d *DbApi) PutManyCamaraProvQoDAppServerData(data *[]db.ProvQoDAppServerData) error

To provision multiple records are once

type DbClient

type DbClient struct {
	DbName string
	DbUrl  string
	// contains filtered or unexported fields
}

func NewDbClient

func NewDbClient(dbName, dbUrl string) *DbClient

func (*DbClient) ConnectDB

func (d *DbClient) ConnectDB() (err error)

func (*DbClient) CountRecords

func (d *DbClient) CountRecords(collName string, filter bson.M) (int64, error)

func (*DbClient) DeleteMany

func (d *DbClient) DeleteMany(collName string, filter bson.M) (int, error)

func (*DbClient) DeleteOne

func (d *DbClient) DeleteOne(collName string, filter bson.M) (int, error)

func (*DbClient) DisconnectDB

func (d *DbClient) DisconnectDB() error

func (*DbClient) DropCollection

func (d *DbClient) DropCollection(collName string) error

func (*DbClient) DropDb

func (d *DbClient) DropDb() error

func (*DbClient) GetIncrementedOne

func (d *DbClient) GetIncrementedOne(collName string, filter bson.M, toUpdate bson.M) (map[string]interface{}, error)

Document will be created if not present

func (*DbClient) GetMany

func (d *DbClient) GetMany(collName string, filter bson.M) ([]map[string]interface{}, error)

func (*DbClient) GetOne

func (d *DbClient) GetOne(collName string, filter bson.M) (map[string]interface{}, error)

func (*DbClient) InsertMany

func (d *DbClient) InsertMany(collName string, putData []interface{}) error

InsertMany

func (*DbClient) InsertOne

func (d *DbClient) InsertOne(collName string, putData interface{}) error

InsertOne

func (*DbClient) UpdateInsertOne

func (d *DbClient) UpdateInsertOne(collName string, filter bson.M, putData bson.M) (int, error)

Update existing doc if found. If not found insert new one

func (*DbClient) UpdateMany

func (d *DbClient) UpdateMany(collName string, filterArray []bson.M, putDataArray []bson.M) error

Updates existing one if present

func (*DbClient) UpdateOne

func (d *DbClient) UpdateOne(collName string, filter bson.M, putData bson.M) (int, error)

Update only if present. Do not insert

Jump to

Keyboard shortcuts

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