cluster

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cluster

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

Cluster is a type for holding a db cluster

func NewFromConfig

func NewFromConfig(conf config.DBConf) *Cluster

NewFromConfig creates a new Cluster from the passed config.DBConf

func (*Cluster) AddNode

func (c *Cluster) AddNode(host string) error

AddNode adds the passed host a a db node to the cluster

func (*Cluster) AddNodes

func (c *Cluster) AddNodes()

AddNodes adds the nodes specified for this Cluster to the cluster

func (*Cluster) Close

func (c *Cluster) Close()

Close closes the cluster

func (*Cluster) RunWithinTransaction

func (c *Cluster) RunWithinTransaction(rlog log.Ext1FieldLogger, tx *sqlx.Tx, fn func(*sqlx.Tx) error) error

RunWithinTransaction runs the passed function using the passed transaction; if nil is passed as tx a new transaction is created. This is basically a wrapper function, that works with a possible nil-tx

func (*Cluster) Transact

func (c *Cluster) Transact(rlog log.Ext1FieldLogger, fn func(*sqlx.Tx) error) error

Transact does a database transaction for the passed function

Jump to

Keyboard shortcuts

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