genericsql

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PingQuery = "SELECT 1"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type GenericSqlRepository

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

GenericSqlRepository is an implementation of repository.Repository that works for a subset of ANSI SQL compatible databases. In addition to the standard repository.Repository methods, it also exposes some SQL-specific functionality, which may be useful for other repository.Repository implementations.

func NewGenericSqlRepository

func NewGenericSqlRepository(repoName, repoType, database, connStr string) (*GenericSqlRepository, error)

NewGenericSqlRepository is the constructor for the GenericSqlRepository type. Note that it returns a pointer to GenericSqlRepository rather than repository.Repository. This is intentional, as the GenericSqlRepository type exposes additional functionality on top of the repository.Repository interface. If the caller is not concerned with this additional functionality, they are free to assign to the return value to repository.Repository

func (*GenericSqlRepository) Close

func (repo *GenericSqlRepository) Close() error

func (*GenericSqlRepository) GetDb

func (repo *GenericSqlRepository) GetDb() *sql.DB

GetDb is a getter for the repository's sql.DB handle.

func (*GenericSqlRepository) Ping

func (repo *GenericSqlRepository) Ping(ctx context.Context) error

func (*GenericSqlRepository) Type

func (repo *GenericSqlRepository) Type() string

Jump to

Keyboard shortcuts

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