adapters

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2020 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLogAdapter

func NewLogAdapter(cfg config.LogConfig) (adapters.LogAdapterInterface, error)

NewLogAdapter creates a new Log adapter instance.

func NewMySQLAdapter added in v1.5.0

func NewMySQLAdapter(cfg config.DBConfig) (adapters.DBAdapterInterface, error)

NewMySQLAdapter creates a new MySQL adapter instance.

func NewMySQLTxAdapter added in v1.5.0

NewPostgresTxAdapter creates a new Postgres transaction adapter instance.

func NewPostgresAdapter

func NewPostgresAdapter(cfg config.DBConfig) (adapters.DBAdapterInterface, error)

NewPostgresAdapter creates a new Postgres adapter instance.

func NewPostgresTxAdapter

func NewPostgresTxAdapter(dba adapters.DBAdapterInterface) adapters.DBTxAdapterInterface

NewPostgresTxAdapter creates a new Postgres transaction adapter instance.

Types

type LogAdapter

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

LogAdapter is used to provide structured log messages.

func (*LogAdapter) Debug

func (a *LogAdapter) Debug(ctx context.Context, message string, options ...interface{})

Debug logs a message as of debug type.

func (*LogAdapter) Destruct

func (a *LogAdapter) Destruct()

Destruct will close the logger gracefully releasing all resources.

func (*LogAdapter) Error

func (a *LogAdapter) Error(ctx context.Context, message string, options ...interface{})

Error logs a message as of error type.

func (*LogAdapter) Info

func (a *LogAdapter) Info(ctx context.Context, message string, options ...interface{})

Info logs a message as of information type.

func (*LogAdapter) Warn

func (a *LogAdapter) Warn(ctx context.Context, message string, options ...interface{})

Warn logs a message as of warning type.

type MySQLAdapter added in v1.5.0

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

MySQLAdapter is used to communicate with a MySQL/MariaDB databases.

func (*MySQLAdapter) Destruct added in v1.5.0

func (a *MySQLAdapter) Destruct()

Destruct will close the MySQL adapter releasing all resources.

func (*MySQLAdapter) NewTransaction added in v1.5.0

func (a *MySQLAdapter) NewTransaction() (*sql.Tx, error)

NewTransaction creates a new database transaction.

func (*MySQLAdapter) Query added in v1.5.0

func (a *MySQLAdapter) Query(ctx context.Context, query string, parameters map[string]interface{}) ([]map[string]interface{}, error)

Query runs a query and returns the result.

type MySQLTxAdapter added in v1.5.0

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

MySQLTxAdapter is used to handle postgres db transactions.

func (*MySQLTxAdapter) Wrap added in v1.5.0

func (a *MySQLTxAdapter) Wrap(ctx context.Context, fn func(ctx context.Context) (interface{}, error)) (interface{}, error)

Wrap runs the content of the function in a single transaction.

type PostgresAdapter

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

PostgresAdapter is used to communicate with a Postgres database.

func (*PostgresAdapter) Destruct

func (a *PostgresAdapter) Destruct()

Destruct will close the Postgres adapter releasing all resources.

func (*PostgresAdapter) NewTransaction

func (a *PostgresAdapter) NewTransaction() (*sql.Tx, error)

NewTransaction creates a new database transaction.

func (*PostgresAdapter) Query

func (a *PostgresAdapter) Query(ctx context.Context, query string, parameters map[string]interface{}) ([]map[string]interface{}, error)

Query runs a query and returns the result.

type PostgresTxAdapter

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

PostgresTxAdapter is used to handle postgres db transactions.

func (*PostgresTxAdapter) Wrap

func (a *PostgresTxAdapter) Wrap(ctx context.Context, fn func(ctx context.Context) (interface{}, error)) (interface{}, error)

Wrap runs the content of the function in a single transaction.

Jump to

Keyboard shortcuts

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