Documentation ¶
Overview ¶
Package mysqldb implements functions for dealing with the Delta database
Index ¶
- type MySQLLink
- func (dmsl MySQLLink) IsConnected() bool
- func (dmsl *MySQLLink) RunMultipleQueriesInTransaction(queries []string) (resultmap map[int]QueryResult, err error)
- func (dmsl MySQLLink) RunQueryInTransaction(query string) (err error)
- func (dmsl *MySQLLink) Select(fields string, table string, filters ...string) (rows *sql.Rows, err error)
- func (dmsl MySQLLink) SelectSingleRow(fields []string, table string, conditions []string, variables ...any) (err error)
- func (dmsl *MySQLLink) SetAuditing(au *audit.Audit)
- func (dmsl MySQLLink) Stats()
- func (dmsl MySQLLink) String() string
- type QueryResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MySQLLink ¶
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 ¶
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 ¶
RunQueryInTransaction runs a query in a transaction
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.