sqlxurl

package module
v0.0.0-...-02467ee Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2014 License: MIT Imports: 5 Imported by: 0

README

go-sqlxurl

Connect to a database using a DATABASE_URL.

Usage

It uses Sqlx under the hood:

import "github.com/josegonzalez/go-sqlxurl"

// Connect using os.Getenv("DATABASE_URL").
c, err := sqlxurl.Connect()

// Alternatively, connect using a custom Database URL.
c, err := sqlxurl.ConnectToURL("mysql://...")

In both cases you will get the result values of calling sqlx.Connect(...), that is, an instance of sqlx.DB and an error.

This library currently only supports the PEARDB-like format in use by the Mysql library. Please keep this in mind when using it with other sqlx backends.

Installation

Install it using the "go get" command:

go get github.com/josegonzalez/go-sqlxurl

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connect

func Connect() (*sqlx.DB, error)

func ConnectToURL

func ConnectToURL(s string) (c *sqlx.DB, err error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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