Documentation ¶
Index ¶
Constants ¶
const ( DriverPostgreSQL = "postgres" DriverMySQL = "mysql" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type OptionModifier ¶
type OptionModifier func(*options)
OptionModifier is a wrapper for options.
func WithAllowRoot ¶
func WithAllowRoot() OptionModifier
WithAllowRoot will make it so that root spans will be created if a trace could not be found using opentracing's SpanFromContext method.
func WithDistributedTracing ¶
func WithDistributedTracing() OptionModifier
WithDistributedTracing will make it so that a wrapped driver is used that supports the opentracing API.
func WithOmitArgsFromTraceSpans ¶
func WithOmitArgsFromTraceSpans() OptionModifier
WithOmitArgsFromTraceSpans will make it so that query arguments are omitted from tracing spans.
func WithRandomDriverName ¶
func WithRandomDriverName() OptionModifier
WithRandomDriverName is specifically for writing tests as you can't register a driver with the same name more than once.
type SQLConnection ¶
type SQLConnection struct { URL *url.URL L logrus.FieldLogger // contains filtered or unexported fields }
SQLConnection represents a connection to a SQL database.
func NewSQLConnection ¶
func NewSQLConnection(db string, l logrus.FieldLogger, opts ...OptionModifier) (*SQLConnection, error)
NewSQLConnection returns a new SQLConnection.
func (*SQLConnection) GetDatabase ¶
func (c *SQLConnection) GetDatabase() (*sqlx.DB, error)
GetDatabase retrusn a database instance.
func (*SQLConnection) GetDatabaseRetry ¶
func (c *SQLConnection) GetDatabaseRetry(maxWait time.Duration, failAfter time.Duration) (*sqlx.DB, error)
GetDatabaseRetry tries to connect to a database and fails after failAfter.