database

package
v0.0.0-...-1305305 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2021 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LOGGER = logging.MustGetLogger("database")

Functions

func InitializeAtlasConnection

func InitializeAtlasConnection(username string, password string, id string) (*mongo.Client, error)

func ParseResult

func ParseResult(cursor *mongo.Cursor, ctx context.Context) ([]byte, error)

used when return result will be array

Types

type MongoClient

type MongoClient struct {
	Session *mongo.Client
}

func InitializeIbmCloudConnection

func InitializeIbmCloudConnection() (*MongoClient, error)

func (*MongoClient) GetCollection

func (client *MongoClient) GetCollection() (*mongo.Collection, context.Context)

func (*MongoClient) GetSpecificCollection

func (client *MongoClient) GetSpecificCollection(dbName, dbCollection string) (*mongo.Collection, context.Context)

type MongoDBConnect

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

struct to hold driver instance, db name and collection name

func InitializeConnection

func InitializeConnection(addrs []string, timeout int, authDatabase string, username string, password string, workDatabase string) (conn MongoDBConnect, err error)

*Create object to establish session to MongoDB for pool of socket connections

func (MongoDBConnect) CloseSession

func (mongoDBConnect MongoDBConnect) CloseSession()

* Close the session when the goroutine exits

func (MongoDBConnect) GetCollection

func (mongoDBConnection MongoDBConnect) GetCollection(session *mgo.Session, collectionName string) (collection *mgo.Collection)

* Get the collection object from the session and collection name provided

func (MongoDBConnect) GetSocketConn

func (mongoDBConnection MongoDBConnect) GetSocketConn() (session *mgo.Session)

* Request a socket connection from the session and retrieve collection to process query.

type PaymentData

type PaymentData struct {
	InstructionID    *string              `json:"instruction_id,omitempty" db:"instructionid"`
	TxData           *string              `json:"tx_data,omitempty" db:"txdata"`
	TxStatus         *string              `json:"tx_status,omitempty" db:"txstatus"`
	ResId            *string              `json:"res_id,omitempty" db:"resid"`
	TxDetail         *transaction.Payment `json:"tx_detail,omitempty" db:"txdetail"`
	TxDetail64       *string              `db:"txdetail"`
	CreatedTimeStamp int64                `json:"created_timestamp,omitempty" db:"created_timestamp"`
	UpdatedTimeStamp int64                `json:"updated_timestamp,omitempty" db:"updated_timestamp"`
}

type PostgreDatabaseClient

type PostgreDatabaseClient struct {
	Host     string
	Port     int
	User     string
	Password string
	Dbname   string

	Tablename string
	// contains filtered or unexported fields
}

func (*PostgreDatabaseClient) CloseConnection

func (dbc *PostgreDatabaseClient) CloseConnection()

CloseConnection closes DB connection

func (*PostgreDatabaseClient) CreateConnection

func (dbc *PostgreDatabaseClient) CreateConnection() error

CreateConnection opens DB connection

func (*PostgreDatabaseClient) CreateTx

func (dbc *PostgreDatabaseClient) CreateTx(input *PaymentData) error

Create new tx record to DB

func (*PostgreDatabaseClient) GetTx

func (dbc *PostgreDatabaseClient) GetTx(instructionId string) (*PaymentData, error)

Get tx

func (*PostgreDatabaseClient) UpdateTx

func (dbc *PostgreDatabaseClient) UpdateTx(input *PaymentData) error

Jump to

Keyboard shortcuts

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