mysqldb

package module
v0.9.2-delta Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2023 License: Apache-2.0 Imports: 14 Imported by: 2

Documentation

Overview

Package mysqldb implements functions for dealing with the Delta database

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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

func New

func New(slog *servicelogger.Logger, cfg *configmanager.Configuration, asyncQueryQueue *basicqueue.BasicQueue, eventQueue *basicqueue.BasicQueue, stopNotification *basicqueue.BasicQueue, monitorNotification *basicqueue.BasicQueue, producer_queue_id string, consumer_queue_id string) (dmsl MySQLLink, err error)

New returns a new MySQLLink object

func (MySQLLink) IsConnected

func (dmsl MySQLLink) IsConnected() bool

IsConnected returns true when the MySQLLink object is connected to a database server

func (*MySQLLink) RunMultipleQueriesInTransaction

func (dmsl *MySQLLink) RunMultipleQueriesInTransaction(queries []string) (resultmap map[int]QueryResult, err error)

RunMultipleQueriesInTransaction runs multiple queries in a single transaction. If one of the queries fails, a rollback is performed, if all queries are sucessful, a commit is done. It is possible to use results from previous queries in subsequent queries. The queries array is 0-based and fields from selects (and the 'id' field from an insert) in the query list can be addressed by using the format: <[row-id]:[fieldname]>, for example: Query 0: SELECT selectedfield FROM table, Query 1: UPDATE table SET selectedfield=<0:selectedfield>+1

func (MySQLLink) RunQueryInTransaction

func (dmsl MySQLLink) RunQueryInTransaction(query string) (err error)

RunQueryInTransaction runs a query in a transaction

func (*MySQLLink) Select

func (dmsl *MySQLLink) Select(fields string, table string, filters ...string) (rows *sql.Rows, err error)

func (MySQLLink) SelectSingleRow

func (dmsl MySQLLink) SelectSingleRow(fields []string, table string, conditions []string, variables ...any) (err error)

SelectSingleRow selects a single database row consisting of the values of fields from table, honoring conditions and returns this in variables, which should be pointers to variables you define before calling this function.

func (*MySQLLink) SetAuditing

func (dmsl *MySQLLink) SetAuditing(au *audit.Audit)

func (MySQLLink) Stats

func (dmsl MySQLLink) Stats()

func (MySQLLink) String

func (dmsl MySQLLink) String() string

String returns a string representation of the MySQLLink object

type QueryResult

type QueryResult struct {
	QueryType string
	NumRows   int64
	Fields    []string
	Values    []interface{}
}

Jump to

Keyboard shortcuts

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