sqldb

package
v0.0.0-...-b7a354f Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

type Service interface {
	// Health returns a map of health status information.
	// The keys and values in the map are service-specific.
	Health() map[string]string

	// Close terminates the database connection.
	// It returns an error if the connection cannot be closed.
	Close() error

	// ExecuteQuery executes the query with the given arguments.
	// It returns the result of the query execution.
	ExecuteQuery(query string, args ...interface{}) (sql.Result, error)

	// QueryRow executes the query with the given arguments and returns a single row.
	// It returns the result of the query execution.
	QueryRow(query string, args ...interface{}) *sql.Row

	// Query executes the query with the given arguments and returns the result set.
	// It returns the result of the query execution.
	Query(query string, args ...interface{}) (*sql.Rows, error)

	// Transaction executes the function within a transaction.
	// If the function returns an error, the transaction is rolled back.
	// If the function returns nil, the transaction is committed.
	Transaction(ctx context.Context, fn func(tx *sql.Tx) error) error
}

Service represents a service that interacts with a database.

func New

func New() Service

Jump to

Keyboard shortcuts

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