Documentation
¶
Overview ¶
Package datastore is used to interact with a datastore. It has functions to help set up a sql.DB as well as helpers for working with the sql.DB once it's initialized.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewNullInt64 ¶ added in v0.18.0
NewNullInt64 returns a null if i == 0, otherwise it returns the int64 which was input.
func NewNullString ¶ added in v0.18.0
func NewNullString(s string) sql.NullString
NewNullString returns a null if s is empty, otherwise it returns the string which was input
func NewPostgreSQLDB ¶ added in v0.34.0
NewPostgreSQLDB returns an open database handle of 0 or more underlying PostgreSQL connections
Types ¶
type Datastore ¶
type Datastore struct {
// contains filtered or unexported fields
}
Datastore is a concrete implementation for a sql database
func NewDatastore ¶ added in v0.13.0
NewDatastore is an initializer for the Datastore struct
func (Datastore) BeginTx ¶
BeginTx is a wrapper for sql.DB.BeginTx in order to expose from the Datastore interface
func (Datastore) CommitTx ¶
CommitTx is a wrapper for sql.Tx.Commit in order to expose from the Datastore interface. Proper error handling is also considered.
type PostgreSQLDSN ¶ added in v0.34.0
PostgreSQLDSN is a PostgreSQL datasource name
func NewPostgreSQLDSN ¶ added in v0.34.0
func NewPostgreSQLDSN(host, dbname, user, password string, port int) PostgreSQLDSN
NewPostgreSQLDSN is an initializer for PostgreSQLDSN
func (PostgreSQLDSN) String ¶ added in v0.34.0
func (dsn PostgreSQLDSN) String() string
String returns a formatted PostgreSQL datasource name. If you are using a local db with no password, it removes the password from the string, otherwise the connection will fail.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package datastoretest provides testing helper functions for the datastore package.
|
Package datastoretest provides testing helper functions for the datastore package. |
|
Package moviestore performs all DML and select operations for a movie
|
Package moviestore performs all DML and select operations for a movie |
|
Package pingstore enables database health checks through the db PingContext method.
|
Package pingstore enables database health checks through the db PingContext method. |