Documentation
¶
Index ¶
- Constants
- type Database
- type Manager
- type MySQL
- func (m *MySQL) Close()
- func (m *MySQL) CreateDatabase(name, user string) error
- func (m *MySQL) CreateUser(user, password string) error
- func (m *MySQL) DeleteDatabase(name string) error
- func (m *MySQL) ListDatabases() ([]string, error)
- func (m *MySQL) Name() string
- func (m *MySQL) Title() string
- func (m *MySQL) Version() string
- type Postgres
- func (p *Postgres) Close()
- func (p *Postgres) CreateDatabase(name, user string) error
- func (p *Postgres) CreateUser(user, password string) error
- func (p *Postgres) DeleteDatabase(name string) error
- func (p *Postgres) ListDatabases() ([]string, error)
- func (p *Postgres) Name() string
- func (p *Postgres) Title() string
- func (p *Postgres) Version() string
Constants ¶
View Source
const NameMySQL = "mysql"
View Source
const NamePostgreSQL = "postgres"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Database ¶
type Database interface { // Name returns the unique identifier for the database server. Name() string // Title returns the human-readable name of the database server. Title() string // Version returns the version string for the database server. Version() string // CreateUser ensures that the specified user exists, creating them if not using the provided password. CreateUser(username, password string) error // CreateDatabase ensures that the specified database exists, creating it if not using the provided owner. CreateDatabase(name, user string) error // ListDatabases returns a list of databases in the database server. ListDatabases() ([]string, error) // DeleteDatabase removes the specified database. DeleteDatabase(name string) error // Shut down the connection to the database server. Close() }
Database provides a generic interface for working with a database server.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages connections to database servers.
type MySQL ¶
type MySQL struct {
// contains filtered or unexported fields
}
MySQL provides access to a MySQL database.
func (*MySQL) CreateDatabase ¶
func (*MySQL) CreateUser ¶
func (*MySQL) DeleteDatabase ¶
func (*MySQL) ListDatabases ¶
type Postgres ¶
type Postgres struct {
// contains filtered or unexported fields
}
Postgres provides access to a PostgreSQL database.
func NewPostgres ¶
NewPostgres attempts to create a connection to a PostgreSQL database. The server version is retrieved as well.
func (*Postgres) CreateDatabase ¶
func (*Postgres) CreateUser ¶
func (*Postgres) DeleteDatabase ¶
func (*Postgres) ListDatabases ¶
Click to show internal directories.
Click to hide internal directories.