mysql

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: May 23, 2019 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PrivilegeAll allows a user to perform all operations on a database.
	PrivilegeAll = "ALL"
	// PrivilegeProcess allows a user to see process information.
	PrivilegeProcess = "PROCESS"
	// PrivilegeReplication allows a user to see replication information.
	PrivilegeReplication = "REPLICATION CLIENT"
	// PrivilegeSelect allows a user to perform select operations.
	PrivilegeSelect = "SELECT"
	// PrivilegeInsert allows for insert operations.
	PrivilegeInsert = "INSERT"
	// PrivilegeUpdate allows for update operations.
	PrivilegeUpdate = "UPDATE"
	// PrivilegeDelete allows for delete operations.
	PrivilegeDelete = "DELETE"
	// PrivilegeCreate allows for create operations.
	PrivilegeCreate = "CREATE"
	// PrivilegeDrop allows for drop  operations.
	PrivilegeDrop = "DROP"
	// PrivilegeIndex allows for index operations.
	PrivilegeIndex = "INDEX"
	// PrivilegeAlter allows for alter operations.
	PrivilegeAlter = "ALTER"
	// PrivilegeCrateTemporaryTables allows for temporary tables.
	PrivilegeCrateTemporaryTables = "CREATE TEMPORARY TABLES"
)

Variables

This section is empty.

Functions

func Format

func Format(name string) string

Format to ensure it is the correct format.

Types

type Client

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

Client for interacting with MySQL.

func New

func New(host, user, pass string, port int) (*Client, error)

New client for interfacting with MySQL.

func (*Client) Database

func (m *Client) Database() *DatabaseClient

Database returns the Database client.

func (*Client) Grant

func (m *Client) Grant() *GrantClient

Grant returns the grant client.

func (*Client) User

func (m *Client) User() *UserClient

User returns the user client.

type DatabaseClient

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

DatabaseClient for interacting with

func (DatabaseClient) Create

func (d DatabaseClient) Create(name string) error

Create will create a database and fail if it already exists.

func (DatabaseClient) Delete

func (d DatabaseClient) Delete(name string) error

Delete will delete a database if it exists.

func (DatabaseClient) Exists

func (d DatabaseClient) Exists(name string) (bool, error)

Exists returns if a database exists.

func (DatabaseClient) List

func (d DatabaseClient) List() ([]string, error)

List returns a list of databases.

type GrantClient

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

GrantClient for interacting with MySQL.

func (GrantClient) Create

func (d GrantClient) Create(username, database string, privileges []string) error

Create a database and error if it exists.

func (GrantClient) Exists

func (d GrantClient) Exists(username, database string) (bool, error)

Exists checks if the grant exists.

func (GrantClient) List

func (d GrantClient) List(username string) ([]string, error)

List returns a list of grants.

func (GrantClient) Revoke

func (d GrantClient) Revoke(username, database string) error

Revoke grant if it exists.

type UserClient

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

UserClient for interacting with MySQL.

func (UserClient) Create

func (d UserClient) Create(username, password string) error

Create a user and error if it already exists.

func (UserClient) Delete

func (d UserClient) Delete(name string) error

Delete a user.

func (UserClient) Exists

func (d UserClient) Exists(name string) (bool, error)

Exists check if the user has already been created.

func (UserClient) List

func (d UserClient) List() ([]string, error)

List returns a list of users.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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