Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConnectionDetail ¶
type ConnectionDetail struct { User string Password string Location string Port string Database string Options map[string]string }
ConnectionDetail represents the information used to connect to the database.
func NewConnectionDetail ¶
func NewConnectionDetail() ConnectionDetail
NewConnectionDetail will return a ConnectionDetail with the Options map correctly initialized.
func ParseDetails ¶
func ParseDetails(connection string) (ConnectionDetail, error)
ParseDetails extracts the connection details out of the connection URI.
func (*ConnectionDetail) Copy ¶
func (cd *ConnectionDetail) Copy() ConnectionDetail
Copy returns a deep copy of the ConnectionDetail so it can be manipulated without impacting the original.
func (*ConnectionDetail) IsValid ¶
func (cd *ConnectionDetail) IsValid() bool
IsValid indicates if the information in the ConnectionDetail can be used to construct a valid connection.
func (*ConnectionDetail) String ¶
func (cd *ConnectionDetail) String() string
Returns a URL with the same values as the ConnectionDetail represents. It will not check if the returned URL is valid, that is left up to the user.
type DB ¶
type DB struct { *sql.DB Connection ConnectionDetail }
DB wraps around *sql.DB so that additional information, such as the name of the server and current database name can be recorded.
type DataProvider ¶
type DataProvider interface { Query(string, ...interface{}) (*sql.Rows, error) QueryRow(string, ...interface{}) *sql.Row Exec(string, ...interface{}) (sql.Result, error) }
DataProvider provides methods for interating with a SQL database, and is fulfilled by both *sql.DB and *sql.TX which allow for transactioned unit tests or mock structs.